Skip to content

feat(roadmap): plan the stage job with a read-only toolbox - #3160

Merged
dan-petty merged 12 commits into
mainfrom
feat/3037-stage-read-only-toolbox
Nov 2, 2026
Merged

dan-petty merged 12 commits into
mainfrom
feat/3037-stage-read-only-toolbox

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The stage job asks the model for one plan on a fixed context. The model cannot read the repository, so many plans name files that do not exist.

This change gives the planner nine read-only tools: list files, read a file, search code, git log, git show, the symbols of a file, the callers of a symbol, a map of a directory, and a read of a base spec. The tools read the staged commit through git, or read a spec through OpenSpec. No tool writes a file, runs a shell command or opens a network connection.

  • A plan run has a budget of 30 tool calls and 50000 output tokens. The run also keeps its messages inside the context window of the analysis task. A run that passes a limit fails its item and names the limit. The other items are still planned.
  • The tools refuse a checkout that is not the staged commit with no change. Each tool bounds its work before it reads a file.
  • The comment of a staged item lists the tool calls and the tokens of the plan run.
  • The stage prompt tells the model to call the tools first and to write each call and its result in the feasibility.
  • devops roadmap eval stage plans with the toolbox. The option --no-toolbox plans with one call and no tool, so two runs of one model compare.
  • The gates of the job stay as they are.

Closes #3037

Archive 3037-the-stage-job-plans-with-a and merge its spec delta into the base specs of roadmap-stage and roadmap-stage-eval. Two test assertions in test_roadmap_stage_plan.py now check values, not presence.
The stage planner now takes a ToolboxModel or a client, so no call gives
both and no bare ValueError is left. A plan run keeps its messages inside
the context window of the analysis task. The tools refuse a checkout that
is not the staged commit with no change, and bound their work: a size
check before a read, a slice before the numbering, and a match limit for
git grep. repo_map gives one short line for each file. read_spec reads the
specs as JSON from OpenSpec and no code parses their markdown.
@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 2, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results

  • Full uv run devops ci on the branch: 2 tests fail, and the failures are host facts, not this change. tests/ai/test_tool_executor_contract.py (popeye on PATH, issue test(floor): every test sees the same tokenizer cache, mounts, process table, PATH and programs on every host, and no skip depends on the host #2165) and tests/commands/test_devcontainer_install_tools_dry_run.py::test_mark_only_commands_under_global_dry_run (the host has the tools installed). All other checks pass. The test check took 286 s (4 min 46 s). The coverage check follows the failed tests.
  • Fail-to-pass: uv run devops ci fail-to-pass --base origin/main ran the changed test files. 9 tests failed on the base and 6 errored (the new modules). The tests of the unchanged behavior passed on the base.

Review findings

Fixed:

  • Bare ValueError in plan_stage and plan_item: plan_stage now takes a ToolboxModel or a client in model, and plan_item takes a client only. A call cannot give both, so no check is left.
  • repo_map: it gives one line for each file (path and top-level names), at most 20 files of 180 characters, so the answer fits and no line is cut. It says when more files are left out. The docstring says that the top maps src/.
  • read_spec parsed markdown by hand: it now reads openspec list --specs --json and openspec show --type spec --json through OpenSpecTool.read_json. The markdown parser is deleted. The proposal names the tool.
  • No cap on the total size of tool output: the plan run takes the tools away when the tokens of its messages plus a quarter of the context window reach the window. A test with a scripted model that reads a big file in every turn proves it.
  • file_symbols and repo_map read the working tree while the other tools read the commit: ToolboxClient now refuses a checkout whose HEAD is not the staged commit, or that has a change or an untracked file, before any model call. The job clone and the eval worktree are such checkouts.
  • read_file and search_code cost: read_file reads the blob size first (limit 2000000 bytes) and numbers only the lines it returns. search_code and callers pass --max-count to git grep.

Not fixed:

  • The score of A1 on the 37 cases, with and without the toolbox. I started devops roadmap eval stage --no-toolbox --json and stopped it. The spend ledger shows 210 to 345 seconds for one analysis call of the gateway, so the 37 cases need hours with --no-toolbox alone. A toolbox run may make 81 requests for each case (--dry-run), and the gateway is shared with other work. The criterion stays open in the change (Workflow follow-up) for a person to run: uv run devops roadmap eval stage --model <model> and the same command with --no-toolbox. If the toolbox score is not higher, the item needs a change.

Note for the reviewer

With a window of 28672 tokens, the body of the item and the repository context already take up to three quarters of the window. So the window rule allows few tool calls when the context is full. The plan is still given. A later change can lower the share of the preloaded context when the toolbox is on, if the eval shows that the tools need the room.

@dan-petty
dan-petty marked this pull request as ready for review November 2, 2026 05:38
@dan-petty
dan-petty merged commit 9179b22 into main Nov 2, 2026
20 checks passed
@dan-petty
dan-petty deleted the feat/3037-stage-read-only-toolbox branch November 2, 2026 05:39
dan-petty pushed a commit that referenced this pull request Nov 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.41.0](v0.40.0...v0.41.0)
(2026-11-02)


### Features

* **k8s:** fall back from Sonnet to DeepSeek
([#3154](#3154))
([11dc347](11dc347)),
closes [#3152](#3152)
* **roadmap:** plan the stage job with a read-only toolbox
([#3160](#3160))
([9179b22](9179b22)),
closes [#3037](#3037)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): the stage job plans with a read-only investigation toolbox

1 participant