Repository navigation
Description
What happened
The stage job makes one structured model call on a fixed context: the issue, at most 10 cited files, at most 5 identifier greps of 20 lines and a tree of 50 files. The prompt says "You cannot run a command". 25 of 37 plans name files that do not exist, 17 ignore code or tests that exist.
What should happen
- The planner is an agent with read-only tools: list files, read a file or a line range, grep,
git logandgit showon the staged commit, the AST graph and callers of a symbol,devops ai repomap, and a read of a base spec. It has a bounded budget of tool calls and tokens. - It writes the plan and the evidence it gathered (the commands and what they showed) into
Feasibility. - The deterministic gates (fix(roadmap): the stage job refuses a plan that names a path that does not exist #3010, feat(roadmap): the stage job probes the premise at the staging commit and returns an item whose premise is false #3011, feat(roadmap): the stage context holds the callers and tests of each cited symbol #3012, fix(roadmap): the stage job refuses a spec delta that the changed paths do not need #3013, fix(roadmap): the stage job requires devops ci test verify commands and mirrored test paths #3015) still validate the result.
Acceptance criteria
- The planner runs with the toolbox in a scratch clone and has no write tool and no network tool.
- The score of A1 on the 37 cases is higher with the toolbox than without it.
- The tool calls and tokens of a plan run are in the trace (A3).
- A plan run stops at its budget and reports the reason.
Related: tracker for this set (filed with it), #2908 (issue workflow), #2867 (draft PR evaluator), #3005 (task kind), #3010 to #3015 (plan gates), #2919 (stuck-item metrics), #2953 (Ollama parser).
Proposed design
Problem statement
The stage job planner makes one model call on a fixed context of at most 10 files, 5 greps, and a 50-file tree. It cannot investigate the codebase. As a result, 25 of 37 plans name files that do not exist and 17 ignore code or tests that do exist. The planner needs a read-only investigation toolbox with a bounded budget so it can ground its plans in the actual code.
Acceptance criteria
Requirement: Read-only toolbox in sandbox
The planner SHALL run with read-only tools in a scratch clone and SHALL NOT have a write tool or a network tool.
Scenario: Planner tool set is read-only
- WHEN the planner starts a plan run in the scratch clone
- THEN the available tools are only list files, read file, read line range, grep, git log, git show, AST graph, callers of symbol, devops ai repomap, and read base spec
Requirement: Higher A1 score with toolbox
The score of A1 on the 37 cases SHALL be higher with the toolbox than without it.
Scenario: A1 score comparison
- WHEN the 37 cases are scored with and without the toolbox
- THEN the score with the toolbox is strictly greater than the score without
Requirement: Trace records tool calls and tokens
The trace of a plan run SHALL record every tool call and the total token count.
Scenario: Trace contains tool calls
- WHEN a plan run completes
- THEN the trace lists each tool call with its arguments and the total token count
Requirement: Budget stop with reason
A plan run SHALL stop at its budget and SHALL report the reason in the trace.
Scenario: Budget exhaustion
- WHEN the tool call count or token count reaches the budget limit
- THEN the run stops and the trace records the limit that was hit
Existing Tool Considered
No check has run. No single open-source tool covers the full need because the tool set includes project-specific tools (AST graph, devops ai repomap, OpenSpec spec reading). The agent loop with tool calling is already in the project (the implement job step infrastructure). The written cost is the tokens to define the read-only tool schemas, enforce the call and token budget, record the trace, and wire the stage job to the existing step loop, plus the elapsed time to integrate and test against the 37 cases.
Key questions
- What tools does the planner have?: list files, read file or line range, grep, git log, git show, AST graph, callers of symbol, devops ai repomap, and read base spec. All are read-only. [sources: CONTEXT.md, docs/adr/0005-review-findings-come-from-tools-not-models.md]
- How is the scratch clone created and sandboxed?: Use git worktree on the staged commit. The sandbox has no network and no write access. This matches the project pattern for tool runs. (best practice) [sources: docs/adr/0005-review-findings-come-from-tools-not-models.md]
- Chosen: git worktree on staged commit. Project pattern. ADR 0005 states tools run on a worktree of the reviewed commit. Supports git log and git show.
- Rejected: git clone --local. Heavier than a worktree. Creates a full copy. No advantage over a worktree for read-only access.
- Rejected: git archive to a directory. No git history. Cannot run git log or git show. Rejected.
- What is the tool call and token budget?: Configurable per run. Default: 30 tool calls and 50,000 output tokens. The budget is enforced by the agent loop. When either limit is hit, the run stops and the trace records the reason. (best practice) [sources: CONTEXT.md]
- Chosen: Fixed default of 30 calls and 50k tokens, configurable. Bounded and testable. Matches the Step pattern in CONTEXT.md where inputs fit a token budget. Larger than the current fixed context (10 files + 5 greps + 50-file tree) so the agent can investigate more.
- Rejected: Unbounded calls with a token cap only. A token cap alone does not stop a loop of cheap calls. The call count cap is needed to bound the number of round-trips.
- Rejected: Per-tool limits only. More complex to configure and enforce. A total budget is simpler and covers the same risk.
- Where does the trace go?: In the job record of the stage job run, alongside the plan output. The trace lists each tool call, its arguments, its output summary, and the total token count. (best practice) [sources: CONTEXT.md]
- Chosen: Job record alongside the plan output. Consistent with the implement job pattern. One place to find the run record. The Service already stores job records.
- Rejected: Separate trace file in the change folder. Two places to look. The change folder is for the plan, not the run record.
- Rejected: Issue comment. Too verbose for a trace. Pollutes the issue history.
- Does the planner have write or network access?: No. The planner has no write tool and no network tool. The sandbox enforces this. [sources: CONTEXT.md, docs/adr/0005-review-findings-come-from-tools-not-models.md]
- How does the planner record evidence in Feasibility?: The planner writes the commands it ran and what they showed into the Feasibility section of the plan. This matches the existing requirement that Feasibility names how the premise was confirmed against the real system. [sources: AGENTS.md, docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 1, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
featprefix of the title gives the type.(roadmap)scope of the title gives the scope.It targets the root cause of 25 of 37 plans naming non-existent files and 17 ignoring existing code.It directly fixes the two dominant failure modes of the stage job's plans.It requires an agentic loop, a scratch clone, budget enforcement, tool plumbing, and integration with five existing gates.Both give the stage job read-only access to the codebase, but #3011 runs bounded probes before the model call while the candidate lets the model choose and sequence its own read-only tool calls.devops-cli-service commentedon Nov 1, 2026
Status set to Ready at 9f3b701 (see proposed design in issue body).
devops-cli-service commentedon Nov 1, 2026
Staged: branch
feat/3037-the-stage-job-plans-with-a, draft pull request #3089. The pull request plans the item and closes no issue.The task groups, with the tokens of the inputs of each step, for a budget of 40000 tokens:
docs(openspec): fix plan #3037 reuse the investigation loop, add tool…
docs(openspec): fix plan #3037 budget behavior and notes
docs(openspec): fix review findings of plan #3037
docs(openspec): fix re-review findings of plan #3037
docs(openspec): fix third review findings of plan #3037
docs(openspec): plan #3037 plan stage job read-only toolbox (#3089)
chore(main): release 0.41.0 (#3161)