Repository navigation
Conversation
parseClaudeOutput re-encoded structured_output with JSON.parse and JSON.stringify, so a duplicate key or an inexact integer reached parseV1 already resolved. Cut the exact text of structured_output from the envelope with a length-bounded scanner instead, and refuse a planning envelope that repeats a top-level key before classifying it. Whether the Claude API or CLI resolves duplicates before writing the envelope is not verified; the docs say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166.
Stacked on #168 (base
feat/6-plan-library-alignment). #168 added the agent-adapter test that described the old re-encoding; this PR replaces it. Retarget tomainafter #168 merges.Summary
parseClaudeOutputread Claude's envelope withJSON.parseand returnedJSON.stringify(structured_output). That round trip resolved duplicate keys (last wins) and rounded inexact integers beforeparseV1saw the text, which bypassed the v1 parsing contract (schema/versions/1/semantics.md, "Deterministic input parsing").agents/adapters/claude.ts: afterJSON.parsevalidates the envelope,topLevelMemberscuts the exact source text of each top-level member. Planning answers return the exact text ofstructured_output, soparseV1refuses a duplicate key or an inexact integer the envelope holds.is_errorcannot turn a refusal into a provider failure.structured_outputin the envelope, not to a re-encoding.Limit
The Claude API and CLI may resolve duplicates or number spellings before writing the envelope. That is not verified: the real-CLI probes need credentials and do not run in CI. The docs (
docs/implementation/agent-isolation.md) and the code comment say so. This PR guarantees that codeboost itself no longer normalizes the answer.The recorded planning fixtures need no re-recording: their staleness hash covers the recorded repository files and argv only, and their text remains valid validator input.
Validation
Base
f9c2e6b11c884e6814790d7f666c4e2cce3a67be(#168 head, baseline), head083d9162e7b62d2f36a113bb1fb576e9a1d72e3f(validated head).The four core tests (exact text, duplicate key, inexact integer, repeated top-level key) fail against the base decoder. Deliberate breaks of escape skipping, string skipping in nested values, the repeat refusal, its ordering before classification, and the non-object guard each fail a test.
Load-related failure, separate from product results: one full run at load average ~150 had a timing failure in
pre-merge.test.ts("stops an active command check when the operation-wide deadline expires"), a file this PR does not touch. It passed 3/3 alone and in the full rerun.Review record
is_errorclassified before the repeat check; untested spacing, key spellings and raw-byte limit; assertion wording; doc precision; long linesTypeErroron anullenvelope (unchanged from the base); question answers keeping last-wins (plain text, never parsed byparseV1)Copilot review has not been requested: this PR is a draft and stacked.
Review-lesson audit
No new AGENTS.md rule is needed.
🤖 Generated with Claude Code