Skip to content

feat(roadmap): a stopped step keeps its work and the next attempt resumes from it #3054

Closed

Description

@dan-petty

What happened

The step prompt says that a lost test, an exhausted refusal limit or an unfixed lint error ends the step and "all your work is lost". After a stop, the next Job starts from the last green group, and the minutes of work between are thrown away. #2175 had all five deletions done and the item still stopped.

What should happen

  • The step commits work in progress to a wip/ ref or a labeled commit on the item branch after each green sub-step, and the state of the step (what is done, what failed) goes into the job record.
  • A new attempt or Job reads that state and continues. The final history is squashed by the existing squash-merge, so the branch keeps the WIP commits without harm.

Acceptance criteria

  • A step killed after 3 of 5 edits is resumed by a second Job in a replay test, and the second Job does only the remaining edits.
  • The WIP state survives a pod restart (it is on origin, not in the pod).
  • The first push of a branch keeps the rule: fetch and rebase on origin/main before the push.
  • A stop comment says what was kept and where.

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 implement job discards all work done in a step when that step stops. The next Job starts from the last green group and loses the completed sub-steps. This wastes compute and delays delivery of the item.

Acceptance criteria

Requirement: WIP commit after green sub-step

The step SHALL commit work in progress to the item branch with a wip: commit-message prefix after each green sub-step.

Scenario: Step completes 3 of 5 sub-steps then stops

  • WHEN A step completes three green sub-steps and then stops on the fourth
  • THEN The item branch on origin holds three commits whose messages start with wip:

Requirement: State in job record

The step SHALL write its progress state (done sub-steps, failed sub-step, last WIP commit SHA) into the job record in the issue body.

Scenario: Job record reflects in-progress step

  • WHEN A step is in progress and has completed two of five sub-steps
  • THEN The hidden job-record block in the issue body lists the two done sub-steps and the SHA of the last WIP commit

Requirement: Resume from WIP state

A new Job SHALL read the job record and continue from the last WIP commit, executing only the remaining sub-steps.

Scenario: Second Job resumes after stop

  • WHEN A step stopped after 3 of 5 sub-steps and a second Job is triggered by implement: retry
  • THEN The second Job executes only sub-steps 4 and 5 and does not re-run sub-steps 1 through 3

Requirement: WIP survives pod restart

The WIP commits SHALL be pushed to origin so that they survive a pod restart.

Scenario: Pod restart does not lose WIP

  • WHEN A pod is killed after a WIP commit is made and before the step finishes
  • THEN The WIP commit is present on the item branch on origin and a new pod can read it

Requirement: First push rebases on main

The first push of the item branch SHALL fetch and rebase on origin/main before the push.

Scenario: First push includes rebase

  • WHEN The item branch has no prior push to origin and the step makes its first WIP commit
  • THEN The push command runs git fetch origin main and git rebase origin/main before git push

Requirement: Stop comment states kept work

A stop comment SHALL state what WIP work was kept and where it is stored.

Scenario: Stop comment names the WIP ref

  • WHEN A step stops and the job writes its stop comment on the issue
  • THEN The comment names the item branch, the count of WIP commits kept, and the SHA of the last WIP commit

Existing Tool Considered

No check has run. No open, maintained tool or library covers this need. It is project-specific behavior of the implement job step loop. The written cost is the tokens to build, keep, and fix the WIP commit logic, the job-record state block, and the resume logic in the existing job runner, plus the elapsed time to integrate them with the step loop and the squash-merge flow.

Key questions

  • Where are WIP commits stored: a separate wip/ ref or labeled commits on the item branch?: Labeled commits on the item branch, with a wip: prefix in the commit message. The squash-merge at delivery collapses them into one commit, so they cause no harm. A separate ref adds a ref to create, update, and delete, and the resume logic must cherry-pick or merge from it. Commits on the branch let the new Job simply continue from the branch tip. (best practice) [sources: CONTEXT.md]
    • Rejected: Separate wip/ ref. Adds a ref to manage. Resume must merge or cherry-pick from it. More moving parts for no benefit given squash-merge.
    • Chosen: Labeled commits on the item branch with wip: prefix. Simplest. The new Job continues from the branch tip. Squash-merge collapses all commits at delivery. No extra ref to manage.
  • What does the job record track for an in-progress step?: The task-group index, the list of done sub-steps, the failed sub-step (if any), and the SHA of the last WIP commit. This is written into the hidden job-record block in the issue body, consistent with ADR 0001 which states the issue body holds the job record. (best practice) [sources: docs/adr/0001-github-is-the-roadmap-source.md, CONTEXT.md]
    • Rejected: Track only the failed sub-step. Insufficient. The resume logic needs to know which sub-steps are done to skip them.
    • Chosen: Track done sub-steps, failed sub-step, and last WIP SHA. Complete. The resume logic skips done sub-steps, knows what failed, and can verify the branch tip matches the recorded SHA.
  • How does a new Job resume from the WIP state?: The new Job reads the job-record block in the issue body, finds the in-progress task group and its done sub-steps, checks out the item branch (which already holds the WIP commits on origin), and executes only the remaining sub-steps. No cherry-pick or merge is needed because the WIP commits are already on the branch. (best practice) [sources: CONTEXT.md]
    • Rejected: Re-run the entire task group. Wastes compute. Redoes work that is already committed and green.
    • Chosen: Read job record, check out branch, run only remaining sub-steps. Minimal work. The branch already has the WIP commits. The job record says which sub-steps are done.

Open questions

  • Does the first push of the item branch rebase on origin/main? (missing verified source)

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-04: partly.
Tool: langchain-ai/langgraph (https://github.com/langchain-ai/langgraph), MIT, last activity 2026-11-04, maintained.

Activity

  1. added
    source/agent
    type/feature
    scope/roadmap
    status/new
    value/high
    effort/medium
    on Nov 1, 2026
  2. dan-petty commented on Nov 1, 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. It saves hours of work per stop but the system still completes items; no blocker or security impact.
    • Value: High. Each stop currently discards all in-progress edits, so persisting them avoids repeated agent work.
    • Effort: Medium. Requires WIP ref logic, job-record state, resumption code, and a replay test across two jobs.
    • Related: feat(roadmap): every step repairs before it gives up, in bounded rounds #3053, which asks for a different change. Both address work lost when a step stops, but #3053 retries within the step while the candidate persists state so a new job resumes it.
  3. added
    priority/p2-medium
    on Nov 1, 2026
  4. dan-petty commented on Nov 1, 2026

    @dan-petty
    OwnerAuthor

    The owner asks (2026-11-01) that the job identify and handle partial implementations, to fix them or iterate on them, instead of discarding them and blocking the issue. The issue #3098 holds the design: keep the pushed work, classify the state, continue from the branch with a repair step for the class, block last. It builds on this issue (repair rounds), #3054 (keep work and resume) and #3065 (failure classes).

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

    @devops-cli-service
    Contributor

    Refine cannot set this item to Ready at d5dc921 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Does the first push of the item branch rebase on origin/main? (missing verified source)
  6. devops-cli-service commented on Nov 4, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Tool: langchain-ai/langgraph (https://github.com/langchain-ai/langgraph)

    • License: MIT
    • Last activity: 2026-11-04
    • Maintained: yes

    Covers:

    • Persists per-step state in a checkpoint store outside the running process, so an interrupted run can be resumed instead of restarted
    • Resumes a run from its last completed step and skips steps already recorded as done, given a thread/run identifier

    Lacks:

    • Does not commit work in progress to the item branch as wip: commits, nor push them to origin
    • Does not keep step state in the hidden job-record block in the issue body; its checkpoints live in its own store
    • Does not implement the first-push fetch/rebase on origin/main or interaction with the existing squash-merge
    • Does not write a stop comment naming the kept WIP commits
    • Does not read or write the project's own step/task-group model; the job runner would have to be moved onto its graph/checkpointer model

    Searches run:

    • coding agent resume work in progress checkpoint git branch state
    • durable execution workflow checkpoint resume from last completed step library
    • OpenHands agent resume task from git branch WIP commits persisted state

    Sources:

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

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

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

    @devops-cli-service
    Contributor

    Live since 2026-11-05 01:17 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/high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions