Skip to content

feat(roadmap): the implement step message states the checkout state #5468

Not planned

Description

@dan-petty

Problem or Motivation

Each task group of an implement step starts a new agent. The agent must find the branch, the kept wip: commits and the changed files again, which the step knows before the first request:

  • Since the run_command prompt of 2026-11-12, the 10 runner runs made 183 git read calls: git status 68, git diff 52, git log 34, git show 29. That is about 18 for each run (n = 10, from 2026-11-12 04:00Z to 2026-11-13 16:00Z).
  • In the 7 days before, 45 runs made 699 git read calls, with 239 identical repeats in 31 runs. The chained start git status --short && git log ... was refused 20 times. Refusals count toward the refusal cap of 30 and toward 3 in a row.
  • One implement request holds about 3.2 tool calls, so about 3 removed calls remove one request (about 5 s at the gateway).

Only the calls at the start of a step can go. The repeats after an edit stay, and git status stays allowed.

Proposed Solution & Architectural Design

  1. Add a # Checkout state section to the step message. Mark it "at step start". It gives:
    • the branch and the base commit;
    • the subjects of the kept wip: commits of the step;
    • the paths that differ from the base, with the counts of added and removed lines.
  2. Build the section from data that the step already holds: its wip: commit list and the base commit. If the step must run git for the paths, run it through the existing local runner with no credentials, after check_settings (src/devops_cli/roadmap/implement/git_isolation.py), with --no-ext-diff --no-textconv -c core.fsmonitor=false. The agent of an earlier group can write .git/config, hooks and .gitattributes.
  3. Give no tick list: tasks.md is already in the message.
  4. Put the section after the change documents (after tasks.md) and just before # Your group. The text that is the same for all steps of an item then stays a cache prefix.
  5. Write the section as a pure function of the step state, so that a later scaffold unit of the pipeline split can own it.

Size: at most about 300 o200k tokens.

Target Subsystem

SDLC, Git & PR Governance: src/devops_cli/roadmap/implement/implement_step.py, implement_run.py, git_isolation.py, the implement prompt in src/devops_cli/ai/tasks/.

Existing Tool Considered

git gives the state, and the step already records the wip: commits (#3054). No tool is necessary. Cost to build: about 0.6M tokens and 2 hours (estimate), about 60 lines and 4 tests.

Acceptance Criteria

  • Test first: for a step with two kept wip: commits and one changed file, the message holds the section with the branch, both subjects and the path, after tasks.md and before # Your group.
  • Test first: a checkout whose .git/config sets core.fsmonitor and an external diff driver starts neither program when the step builds the section.
  • A test: the section has at most 300 o200k tokens for 20 changed paths.
  • Measure: the git read calls and the chain refusals in the first 15 calls of each step, from runner runs since 2026-11-12 (needs the step start line of feat(roadmap): run records give the run, step and path class of tool calls #5460). Give n with each baseline, and extend the window until n is at least 30 runs. Use devops roadmap eval implement as a screen only.
  • Live proof after release: the same counts on real Service runner runs for 7 days.

Dependencies

Standards Compliance

  • I confirm this proposal aligns with AGENTS.md engineering principles (cyclomatic complexity <= 10, nesting <= 4 blocks, zero bare exceptions, tests that cover the changed lines).

Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: git/git (https://github.com/git/git), NOASSERTION, last activity 2026-11-29, maintained.
Reason: Searches found no other tool, and git reads the branch, merge-base, commit subjects and per-path numstat counts; the issue already names git through the existing credential-free local runner, so only the section renderer is new.

Covers:

  • Branch name and base commit from the merge-base
  • Commit subjects oldest first with log format
  • Added and removed line counts for each changed path
  • Hardened flags that skip fsmonitor, external diff and textconv

Lacks:

  • No section text, placement after tasks.md or before the group heading
  • No 300-token cap or dropped-path count
  • No pure renderer or test seam for the pipeline split

Proposed design

Problem statement

Each task group of an implement step starts a new agent. The agent repeats git read calls to find the branch, the commits on the branch and the changed files. The step already holds the branch and can resolve the base once. Add a # Checkout state section to the step message so the agent starts with that state.

Acceptance criteria

Requirement: Checkout state section

The implement step message SHALL hold a # Checkout state section with the mark at step start.

Scenario: Message holds the section

  • WHEN A step builds its message for a group.
  • THEN The message holds # Checkout state and the line at step start.

Requirement: Checkout state content

The section SHALL give the branch, the base commit, the commit subjects oldest first, and each changed path with its added and removed counts.

Scenario: Two commits and one changed file

  • WHEN A step with two commits since the base and one changed file builds its message.
  • THEN The section holds the branch, the base commit, both subjects, and the path with its added and removed counts.

Requirement: Section order

The message MUST place the section after the tasks.md text and the item comments, and before # Your group.

Scenario: Section between tasks.md, comments and the group

  • WHEN A step builds its message from a change that holds tasks.md, one item comment and a group.
  • THEN The index of # Checkout state is greater than the index of the tasks.md text and the comment, and less than the index of # Your group.

Requirement: Hardened changed-path read

The step MUST read the changed paths through the existing local runner with no credentials and with -c core.fsmonitor=false, --no-ext-diff and --no-textconv.

Scenario: Configured fsmonitor and external diff driver

  • WHEN A checkout sets core.fsmonitor and diff.external to programs that write a marker file, and the step builds the section.
  • THEN No marker file exists and the section holds the changed path.

Requirement: Settings check before the read

The step MUST call check_settings before it reads the commit subjects and changed paths.

Scenario: Settings check comes first

  • WHEN The step builds the section.
  • THEN The step calls check_settings before the first git call.

Requirement: Pure section renderer

The renderer SHALL take only the branch, the base commit, the commit subjects and the changed-path stats, and return the section text.

Scenario: Renderer takes only step data

  • WHEN The renderer is called twice with the same data.
  • THEN It returns the same text and starts no process.

Requirement: Token budget

The renderer MUST keep the section within 300 o200k tokens for 20 changed paths.

Scenario: Twenty changed paths

  • WHEN The renderer builds the section for 20 changed paths.
  • THEN The token count that count_tokens gives for the section is at most 300.

Requirement: Token budget overflow

When the section would exceed 300 o200k tokens, the renderer SHALL drop paths from the end and state the count of dropped paths.

Scenario: Long changed-path list

  • WHEN The renderer builds the section for changed paths that would exceed 300 tokens.
  • THEN The token count is at most 300 and the section states the count of dropped paths.

Requirement: No task checklist

The renderer SHALL NOT add a task checklist to the section.

Scenario: Section holds no checkbox

  • WHEN The renderer builds the section.
  • THEN The section holds no - [ ] or - [x] text.

Requirement: Pending a person after the merge

A person SHALL measure the git read calls and chain refusals in the first 15 calls of each step on real Service runner runs.

Scenario: Post-release measurement

Existing Tool Considered

The alternatives check of 2026-11-23 in the issue body returned in-use for git/git (https://github.com/git/git). The repository already uses git through the existing credential-free local runner. The check names what git covers and lacks. The proposal uses git for the branch, base, subjects and numstat. The collector adds the hardened flags, and a pure renderer adds the # Checkout state section, its placement and its 300-token cap. Written cost: about 0.6M tokens and 2 hours, about 60 lines and 4 tests.

Key questions

  • Which data gives the branch, the base commit, the commit subjects and the changed paths?: The run holds the branch and the default branch. The collector resolves the base with resolve_merge_base on the default branch and the branch tip. The step does not hold the commit subjects or the changed-path stats, so the collector reads them with git. The section lists the commits on the branch since the base, because a stopped step keeps no work. [sources: src/devops_cli/roadmap/implement/implement_run.py:629, src/devops_cli/roadmap/implement/implement_run.py:703, src/devops_cli/git/operations.py:579, CONTEXT.md:146]
  • How does the step get the branch and the base?: _ItemRun passes self.branch and self.default to run_step, which passes them to build_step_inputs. The collector resolves the base with resolve_merge_base and gives it to the pure renderer. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:629, src/devops_cli/roadmap/implement/implement_run.py:703, src/devops_cli/roadmap/implement/implement_step.py:433]
    • Chosen: Pass the branch and default branch as parameters. The run holds them, and explicit parameters keep the prompt builder inputs visible and the renderer pure.
    • Rejected: Read the job record inside build_step_inputs. It couples the prompt builder to the store and makes a step test need a job record.
    • Rejected: Read the branch and default branch with git inside build_step_inputs. It repeats data that the run already holds.
  • Which commit is the base for the section?: Use the merge-base of the default branch and the branch tip, resolved with resolve_merge_base. implement.base is for withdraw, not for the diff. It is the branch tip before the job for a Staged item, which is not an ancestor after the start rebase, and new for a Planned item. (best practice) [sources: docs/ROADMAP_WORKFLOW.md:170, src/devops_cli/roadmap/implement/implement_run.py:869, src/devops_cli/roadmap/implement/implement_run.py:886, src/devops_cli/git/operations.py:579]
    • Chosen: Merge-base with the default branch. It is the commit where the item branch left the default branch, and the project already uses resolve_merge_base for changed files.
    • Rejected: The implement.base record. It is the branch tip before the job for a Staged item, which is not an ancestor after the start rebase, and new for a Planned item.
    • Rejected: The step start commit. It is the branch tip, so the diff would hold no earlier group work.
  • Where does the # Checkout state section go in the step message?: Place the section after the text of tasks.md and the item comments, and before # Your group. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:469, src/devops_cli/roadmap/implement/implement_step.py:474, src/devops_cli/ai/tasks/roadmap_implement_step.md:1]
    • Chosen: After tasks.md and the comments, before # Your group. It keeps the change documents and the item comments in the shared cache prefix and puts the step state just before the group.
    • Rejected: Before the change documents. It moves per-item text after the step state and breaks the shared prefix.
    • Rejected: At the end of the message. It puts the state after the group and away from the first read of the agent.
  • How does the step read the changed paths without starting a program that the agent wrote?: Call check_settings first. Then run the hardened local runner with no token: git -C <checkout> -c core.fsmonitor=false merge-base -- <default> HEAD for the base, git -C <checkout> -c core.fsmonitor=false log --format=%s --reverse <base>..HEAD for the subjects, and git -C <checkout> -c core.fsmonitor=false diff --no-ext-diff --no-textconv --numstat <base> HEAD for the paths. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:1929]
    • Chosen: Hardened local git runner. It uses the existing runner, checks the settings first, and disables fsmonitor, external diff and textconv.
    • Rejected: Read .git files directly. It duplicates git parsing and misses the index and worktree state.
    • Rejected: Use pygit2 or dulwich. It adds a dependency and does not render the section. The alternatives check gives in-use for git.
  • Does the section renderer run git or take data?: A pure renderer takes the branch, base, subjects and path stats. A separate collector runs git. (best practice) [sources: src/devops_cli/roadmap/implement/implement_step.py:433]
    • Chosen: Pure renderer plus collector. It is testable offline and a later scaffold unit can own it.
    • Rejected: Renderer runs git. It makes the function impure and hard to test.
  • How does the section stay within 300 o200k tokens?: Count the section with count_tokens. If it exceeds 300, drop changed paths from the end and state the count of dropped paths. (best practice) [sources: src/devops_cli/ai/context_budget.py:90, src/devops_cli/roadmap/implement/implement_step.py:483]
    • Chosen: Cap with an omitted count. It keeps the section bounded and tells the agent that paths are missing.
    • Rejected: List all paths. Long path lists can exceed the 300-token budget.
    • Rejected: Drop the whole changed-path list. It loses the state that the section exists to give.
  • Does the section include a task checklist?: No. tasks.md is already in the message. A second list adds tokens and can disagree. (best practice) [sources: src/devops_cli/ai/tasks/roadmap_implement_step.md:12, src/devops_cli/roadmap/implement/implement_step.py:474]
    • Chosen: No checklist. It avoids duplicate text and token cost.
    • Rejected: Include a checklist. It duplicates tasks.md and can disagree with it.
  • What format does the section use?: Use a Markdown section. Put the mark at step start on its own line after the heading. Give one bullet for the branch. Give one bullet for the base commit. Give a list of commit subjects, oldest first. Give a list of changed paths with (+added/-removed). (best practice) [sources: src/devops_cli/ai/tasks/roadmap_implement_step.md:1, src/devops_cli/roadmap/implement/implement_step.py:474]
    • Chosen: Markdown bullet list. It is compact, readable and cheap in tokens.
    • Rejected: JSON block. It adds syntax and tokens for data that the agent reads as text.
    • Rejected: Table. Long paths wrap and cost tokens.
  • What does the item wait on?: It waits on chore(roadmap): hold incremental stage and implement work #6521, the hold of the re-architecture of refactor(roadmap): re-architect stage and implement on Coder #6519. feat(roadmap): the implement shell and prompt use the preset #4645 changes the implement prompt, so its pull request lands first. feat(roadmap): run records give the run, step and path class of tool calls #5460 supplies the step start line for the measurement. [sources: docs/roadmap/refine.md:19, docs/roadmap/refine.md:21, docs/roadmap/refine.md:23, docs/roadmap/refine.md:29]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#6521, #4645, #5460

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 13, 2026
  2. dan-petty commented on Nov 13, 2026

    @dan-petty
    OwnerAuthor
  3. added
    priority/p2-medium
    on Nov 13, 2026
  4. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: The web searches returned only generic documentation pages and no tool that builds a "Checkout state" section into an agent step message. The issue itself concludes that no tool is necessary: git and the step's recorded wip: commit list already give the branch, base commit, subjects and changed paths, and the work is about 60 lines in the project's own prompt code. The closest libraries found (Dulwich, pygit2) only replace the git reads the project already has through its hardened local runner; they do not produce the section, its position before # Your group, or its token budget.

    Tool: none found

    Lacks:

    • No tool renders the "# Checkout state" section text, its "at step start" marker, or its ordering after the change documents (tasks.md) and before "# Your group"
    • No tool enforces the token budget of at most about 300 o200k tokens for the section
    • A git-reading library would add a new dependency and duplicate the existing credential-free local runner path that already applies --no-ext-diff, --no-textconv and core.fsmonitor=false
    • The section must be a pure function of the step state (wip: commit list, base commit), which is project-specific code, not a library feature

    Tools considered:

    Searches run:

    • Python library read git repository branch diff stat without spawning git subprocess, results: 5
    • dulwich pure Python git diff stats tree changed files, results: 5
    • dulwich pypi git implementation pure python, results: 5
    • pygit2 pypi package git repository read diff, results: 5
    • libgit2 Python bindings read repository status branch commits, results: 5

    Sources:

    Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.

  5. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at 9be129e while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: src/devops_cli/ai/tasks/roadmap_implement_step.md.

  6. devops-cli-service commented on Nov 19, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  7. dan-petty commented on Nov 20, 2026

    @dan-petty
    OwnerAuthor

    Frozen on 2026-11-20. The stage, implement and fix-checks jobs grade under 60%, so the owner rule asks for a re-architecture before more fixes inside the current design (tracker #6519). This item is incremental work on those jobs, so its Dependencies section now names #6521 first. Stage and implement leave this item while #6521 is open. When the experiments of #6519 decide, a person closes #6521 (this item can then continue) or closes this item as not planned.

  8. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  9. devops-cli-service commented on Nov 23, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: none, no tool. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • generate repository context prompt for coding agent branch diff numstat library, results: 5
    • tool that summarizes git branch state, commits since base and changed files for an LLM prompt, results: 5
    • repomix code2prompt gitingest git repository summary prompt tool, results: 5
    • GitPython dulwich pygit2 read branch commits changed files diff stats library, results: 5
    • "merge-base" "numstat" python library render git checkout summary, results: 5

    Sources:

  10. devops-cli-service commented on Nov 27, 2026

    @devops-cli-service
    Contributor

    Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.

  11. dan-petty commented on Nov 30, 2026

    @dan-petty
    OwnerAuthor

    Premise check after the release of the hold #6521 (2026-11-30): the premise is false: StepConversation (implement_step.py:642) carries one conversation across the groups of an item (#6527), and the git_isolation.py runner and its refusals went with the allowlist. Closed as not planned (AGENTS.md rule 2); a person may reopen it, or file a new item from fresh evidence.

  12. removed
    status/new
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/featurevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions