Repository navigation
fix(report): scope the write_report schema to the phase and name missing dimensions - #134
Merged
Merged
Conversation
…ing dimensions The write_report schema was static: read-only phases were offered commit, non-scoring phases the scoring fields, and a scoring phase was never told dimensions (or any of its six keys) is required or bounded. Models that follow the schema over the description (GLM 5.3 on the review score phase) were rejected six times in a row and the loop guard aborted the phase. - Build the schema and description from the phase's scope (writable, scoring). OpenCode registers the tool once per server, so the plugin narrows it per run agent through the session context hook; the CLI runners' MCP host reads the scope from the attempt bridge. - dimensionsError now names every missing key with what was received, every wrong-typed or out-of-range value, and a non-object dimensions. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Bug
In the
reviewpipeline, the read-only scoring phase onopenrouter/z-ai/glm-5.3always aborted: GLM calledwrite_reportwith rejected arguments six times in a row and the loop guard stopped the phase (run 20261020-091952-sup5):{markdown, confidence, commit: {...}}: "read-only phases cannot supply commit metadata"{markdown, confidence}: "dimensions must include every quality dimension…"{markdown, confidence, commit: {subject: "noop"}}: same read-only commit error{markdown, dimensions: {maintainability: 86.0166}}: "dimensions.prd must be 0–100", then abortedRoot causes: the tool schema was identical for every phase. It offered
committo read-only phases, and it never markeddimensions(or any of its six keys) as required or bounded. GLM follows the schema over the prose. The dimensions error also saidprd must be 0–100whenprdwas simply missing, so the model couldn't correct itself.Changes
Per-phase schema.
writeReportInputJsonSchemaFor(scope)andwriteReportToolDescriptionFor(scope)build the contract from aWriteReportScope(writable,scoring), whichwriteReportScope(agentName, readOnly)derives from the phase:commit, and the description doesn't invite onedimensions/mustFix/gaps/confidencedimensionsis required, with all six keys (taken fromqualityDimensions) required as{type: "number", minimum: 0, maximum: 100}OpenCode: V2 registers a plugin tool once per server, and the plugin is installed once per run. So the generated plugin still registers the unscoped tool, and it also embeds a per-agent map built from the run's agents. A
ctx.session.hook("context", …)swaps in that agent's scopedwrite_reportentry on each model request. An agent's read-only flag is its phase's, because forced read-only steps run on the synthesized__roagent. Sessions on other agents keep the unscoped schema.CLI runners (Claude/Codex): the attempt bridge passes the scope to the MCP host as
CONVOY_REPORT_SCOPE, so every runner offers the same contract.Clearer dimensions error. Missing keys are reported separately from invalid values, all at once, along with what was received. Examples:
dimensions is missing prd, tests, security, operational, scope (received: maintainability)anddimensions.prd must be a number from 0–100 (received: "85"). A missingdimensionsand a non-objectdimensionseach get their own message.The loop guard and the read-only commit rejection are unchanged.
Testing
bun run typecheck: cleanbun test: 3972 pass, 1 skip, 0 failcommit; non-scoring has no scoring fields; scoring requires all six bounded dimensions); the generated plugin's context hook applied per agent; the MCP host's scoped schema and the Codex bridge file's scope; the new dimensions error messages (missing keys, wrong type, out of range, combined, missing, non-object)opencoderuntime with a scripted provider:implementer,bug-auditorandquality-scorerare each offered their own scopedwrite_reportparameters. It passes on opencode 2.0.32 and on 2.0.26 (the version CI pins).🤖 Generated with Claude Code