Skip to content

feat(roadmap): implement keeps phase marks and the spend of a killed Job #4070

Closed

Description

@dan-petty

Problem

Facts that I checked in implement_run.py.

  1. Every Job runs _pull_request, which calls _comment(pull, _NOTHING_YET). _comment builds its table from self.outcomes[since.outcomes:]. A fresh Job that continues a run has an empty outcomes list. So it posts a comment with the body - and no table. The earlier table is not lost on GitHub, but the new comment is empty.
  2. The scoped checks (_scoped_checks, about 3.5 minutes) and the watch of the PR checks run again in every Job. No mark says that they passed for the same head.
  3. implement.spend is written only at a stop or at ready (stop, _ready).
    • The group mark (_record(group=..., sha=...)) does not carry the spend.
    • _item_spend() sums self.outcomes of this Job only.
    • A killed Job leaves no spend. A continuation starts with a full item budget. With 2 continuations an item can spend three budgets.
    • At a stop, implement.spend is overwritten with the spend of the last Job only.
  4. The wait for the PR checks runs up to 3600 s (monitor_timeout_seconds, watch_pull). The runner writes no log line during it. The stall limit is 4200 s because of this wait (defaults.py).

Expected

This issue is blocked by #3677 (checkpoint of each passed group). #3677 is open and has no pull request. Both change _groups and _start. Start this issue after #3677 merges, and read the final order of the group steps from main. Do not copy the push of #3677.

The steps below name phases, not positions in _groups. They hold for any order that #3677 sets.

  • Add the keys implement.checked_sha and implement.published_sha to ImplementRecordKey (stores/store.py).
    • Write checked_sha after the scoped checks pass.
    • Write published_sha after the push.
    • Use the existing marks writes. A Job with the same head skips the phase.
  • Put a marker line for the run into the PR comment. Read the comments of the PR once per Job. Update the comment that holds the marker. Do not post a comment whose body is -.
  • Write the spend of each passed group in the group mark that exists (_record(group, sha, spend)). Start the Job budgets (_item_spend) from the recorded sum of the earlier Jobs. At a stop or at ready, write the sum, not the spend of the last Job only.
  • Write one log line at a set interval during the watch of the PR checks (watch_pull). Use the existing DEFAULT_ROADMAP_IMPLEMENT_POLL_SECONDS loop.
  • Request cost per Job: 1 read of the PR comments for the marker. Add 1 read and 1 PATCH for each of the two phase marks. This gives 5 requests. The spend rides on the group mark and adds none. This is inside the request budget (fix(service): the metrics row sends too many counted requests #3941, fix(service): the request budget counts only what GitHub counts #3946).

Update docs/ROADMAP_WORKFLOW.md and the spec roadmap-implement-job for the two new keys.

Not in this issue:

Acceptance criteria

  • uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k checked_sha - a second Job at the same head runs zero scoped checks.
  • uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k pr_comment_marker - a rerun with no new outcome posts no - comment. One comment holds the table.
  • uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k spend_survives_kill - a continuation starts with the spend of the killed Job and stops at the item budget as a sum.
  • uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k watch_progress_line - the watch of the checks logs a line at the set interval.
  • uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k request_count - a Job sends at most 5 extra requests for the marker and the two phase marks.

Every command above fails on the unchanged code. The pull request cites the fail-to-pass run (devops ci fail-to-pass --base <ref>).

Feasibility

I read these files at origin/main: implement_run.py (_groups, _record, _item_spend, _spend, _push, _scoped_checks, _pull_request, _comment, _checks, _ready, stop), implement_pull.py (watch_pull), stores/store.py (ImplementRecordKey) and defaults.py. I did not run the code.

I checked that #3677 is open and that no open pull request holds a branch for it. An earlier claim said that a rerun posts a second copy of the comment table. That was wrong. The real fault is an empty comment.

Existing tool considered

Item record marks (set_marks), the branch and the ticks of tasks.md as resume state, and the checkpoint of #3677. No library is needed.

Cost

Build: about 90k tokens and 4 h (two keys, the comment marker, the spend sum, the log line, 6 tests). Keep: about 4k tokens per quarter. Fix: about 20k tokens and 1.5 h.

Related

Part of #3027. Blocked by #3677 (must merge first). #3066, #3997 (comment on a stop), #3941, #3946, #3105.

Proposed design

Problem statement

An implement Job repeats work after a continuation. It posts an empty pull request comment with the body -, and it runs the scoped checks again at the same head. It loses the spend of a killed Job, so one item can spend three budgets. It writes no log line during the 3600 s watch of the checks. This change adds two phase marks, one comment marker, a spend total and a progress line.

Acceptance criteria

Requirement: checked_sha skips the scoped checks

The implement Job SHALL write implement.checked_sha after the scoped checks pass and SHALL run no scoped check at a head that the mark records.

Scenario: A second Job at a checked head

  • WHEN A second Job starts at a head that implement.checked_sha records.
  • THEN The Job runs zero scoped checks, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k checked_sha passes.

Requirement: published_sha skips the push

The implement Job SHALL write implement.published_sha after it pushes the item branch and MUST NOT push that head again.

Scenario: A second Job at a published head

  • WHEN A second Job starts at a head that implement.published_sha records.
  • THEN The Job sends no push for that head, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k published_sha passes.

Requirement: One comment holds the table

The implement Job SHALL keep one pull request comment with the marker line and MUST NOT post a comment whose body is -.

Scenario: A rerun with no new outcome

  • WHEN A rerun makes no new outcome.
  • THEN The Job posts no comment with the body -, the marker comment keeps the rows of the earlier Job, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k pr_comment_marker passes.

Requirement: Spend survives a killed Job

The implement Job SHALL write the spend total of the item with each passed group and SHALL start the item budget from the recorded total.

Scenario: A continuation after a killed Job

  • WHEN A continuation starts after a Job was killed.
  • THEN The continuation starts with the spend of the killed Job, stops at the item budget as a total, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k spend_survives_kill passes.

Requirement: The watch writes a progress line

The implement Job SHALL write one log line at each poll interval during the watch of the pull request checks.

Scenario: A watch longer than one interval

  • WHEN The watch of the checks runs for more than one poll interval.
  • THEN The Job log holds one progress line for each interval, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k watch_progress_line passes.

Requirement: The phase marks cost 5 requests

The implement Job SHALL send at most 5 extra requests for the comment marker and the two phase marks.

Scenario: A Job that writes both phase marks

  • WHEN A Job reads the pull request comments and writes the two phase marks.
  • THEN The Job sends at most 5 extra requests, and uv run pytest tests/roadmap/implement/test_roadmap_implement_phase_marks.py -k request_count passes.

Requirement: The documents name the new keys

The change MUST name implement.checked_sha and implement.published_sha in docs/ROADMAP_WORKFLOW.md and in the spec roadmap-implement-job.

Scenario: The record key table

  • WHEN The invariant test reads the record key table of docs/ROADMAP_WORKFLOW.md.
  • THEN The table lists both keys with what they hold.

Existing Tool Considered

No alternatives check has run on this item. No open, maintained library covers the resume marks of the implement Job. The marks are the job record of the issue, and set_marks already writes them, so this change adds two keys to that record and one marker line to the pull request comment. It builds no code that a library covers. Cost to build: about 90k tokens and 4 h. Cost to keep: about 4k tokens per quarter. Cost to fix: about 20k tokens and 1.5 h.

Key questions

  • Where does the Job keep the two phase marks?: In the job record of the issue, as two members of ImplementRecordKey. The Job writes each one with the existing marks write, and a Job at the same head reads the mark and skips the phase. (best practice) [sources: src/devops_cli/roadmap/stores/store.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: New ImplementRecordKey marks. The job record survives a Job and a continuation, and the existing marks write adds no new request path.
    • Rejected: A label on the issue. A label holds a status and no commit SHA, and a label write is a separate request path.
    • Rejected: A file on the item branch. A file adds a commit and a push, and the branch may not exist at the first check.
  • How does the Job keep one pull request comment across Jobs?: The comment holds the hidden marker line. The Job reads the pull request comments once, keeps the rows that the marker comment holds, and adds the rows of its own steps. A Job with no new row sends no write. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/config/constants.py]
    • Chosen: Marker line and one read of the comments. One read finds the comment, the rows of the earlier Jobs stay, and a person can edit the text around the marker.
    • Rejected: Replace the body with the rows of this Job. The rows of the earlier Jobs would go, so no comment would hold the table of the run.
    • Rejected: A new comment for each Job. The issue shows the result: an empty comment with the body - and no table.
  • How does the spend of the item survive a killed Job?: implement.spend holds the total of the item. The Job reads the total at the start, adds the spend of its own steps, and writes the total with each passed group, at a stop and at ready. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py, src/devops_cli/roadmap/implement/implement_limits.py, docs/ROADMAP_WORKFLOW.md]
    • Chosen: The running total on implement.spend. The key already exists, the group mark already writes it, and the write adds no request.
    • Rejected: A new key for the carried spend. It adds a second key that must stay in step with implement.spend.
    • Rejected: The spend of this Job only. The issue shows the result: an item can spend three budgets with 2 continuations.
  • Which interval writes the progress line during the watch of the checks?: DEFAULT_ROADMAP_IMPLEMENT_POLL_SECONDS, which is 30 s. The watch loop already sleeps that interval, so the line adds no wait and no setting. (best practice) [sources: src/devops_cli/config/defaults.py:869, src/devops_cli/roadmap/implement/implement_pull.py:350]
    • Chosen: Reuse DEFAULT_ROADMAP_IMPLEMENT_POLL_SECONDS. The watch loop already sleeps that interval, so the line adds no wait.
    • Rejected: A new setting for the line. It adds a setting to keep, and the loop already has an interval.
  • Which code does this item change together with feat(roadmap): checkpoint each passed group on origin #3677?: _groups and _start in src/devops_cli/roadmap/implement/implement_run.py. Both items change these functions, so this item starts after feat(roadmap): checkpoint each passed group on origin #3677 merges, and it reads the final order of the group steps from main. [sources: src/devops_cli/roadmap/implement/implement_run.py]
  • Does the progress line change the stall limit of the Job?: No. The stall limit stays at DEFAULT_ROADMAP_IMPLEMENT_DEADLINE_STALL_SECONDS (4200 s), and the line only shows progress. This item does not change the limit. [sources: src/devops_cli/config/defaults.py, src/devops_cli/roadmap/implement/implement_deadline.py]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

#3677

Activity

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

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/feature. The feat prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The change saves redundant work and fixes spend tracking but is blocked by #3677 and does not block other work.
    • Value: Medium. It avoids re-running scoped checks and prevents budget over-spend, but the system functions without it.
    • Effort: Medium. It touches stores, implement_run, the PR comment logic, the watch loop, and docs across several files.
    • Related: feat(roadmap): the implement job keeps, classifies and continues a partial implementation #3098, which asks for a different change. Both concern the implement job continuation, but #3098 keeps and classifies partial work while the candidate adds phase marks and spend tracking across Jobs.
  3. added
    priority/p2-medium
    on Nov 7, 2026
  4. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c8990be 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/roadmap/implement/implement_run.py.

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at c20f73d 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/roadmap/implement/implement_run.py.

  6. added
    owner/agent
    status/in-review
    and removed
    status/new
    on Nov 8, 2026
  7. removed
    status/in-review
    owner/agent
    on Nov 9, 2026
  8. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor
  9. devops-cli-service commented on Nov 9, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-09 03:15 UTC

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/mediumpriority/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