fix: sync contract wrappers into stage-behavior expectedTools#25
Merged
Conversation
Task 3 added the artifact fill-tools to the guard policy (STEP_ALLOWED_TOOLS) but not to the parallel expectedTools allowlist in stage-behavior.ts, so checkPlannerStageBehaviorWrapperTool blocked them with "Stage behavior does not list <tool> as expected at <stage>/<step>". For discovery/plan/summary the model could fall back to a built-in write, but for tdd.md — where edit/write is blocked — it was a hard deadlock. Add each fill-tool to expectedTools at exactly the steps where the guard policy already allows it: planner_discovery_submit (scan_project_structure, handle_change_request), planner_plan_submit (draft_plan, handle_change_request), planner_tdd_submit (every execution step that writes tdd.md), planner_summary_submit (write_final_summary). artifactBehavior gains an optional extraTools param for draft_plan. Add a regression test asserting every fill-tool is permitted by BOTH the guard policy and the stage-behavior gate at each of its steps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…iant A general gating invariant (new tool-gating-invariant.test.ts) revealed that the guard policy and stage-behavior expectedTools had drifted for contract helpers too — not only the new fill-tools. The guard allowed these at steps where the behavior gate blocked them, so the model hit "Stage behavior does not list <tool>" if it tried: - planning/draft_plan, planning/split_tasks: planner_contract_route/read - finalize/verify_plan_branch, finalize/write_final_summary: planner_contract_route/read - done/present_result, done/await_user_acceptance: planner_contract_decide These are read-only/decision helpers (non-deadlocking, the model can proceed without them) but the instructions explicitly tell it to route and read contracts there, so the behavior gate was the side that was wrong. Add the missing tools to expectedTools. Debug wrappers were already consistent across both gates. The invariant test now asserts that at every step, every guard-allowed wrapper also passes the behavior gate. Document the dual-allowlist requirement in src/runtime/AGENTS.md so future tool changes update both. Co-Authored-By: Claude Opus 4.8 <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.
No description provided.