Repository navigation
Description
Problem Description
When ImplementRun stops on a task group before completion (such as when it hits a token budget limit or a test fails), _push_passed() pushes the commits of completed groups to the branch on GitHub. end_stopped() writes a status comment to the issue (self.number), but it writes no comment to the pull request (self.pull) unless self.amendments is not empty. In addition, a staged pull request keeps its staging title (docs(openspec): plan #...) and body. The GitHub Actions workflow Plan Check then runs on the pushed code commits and fails, while human reviewers see no explanation on the pull request.
Reproduction Steps
- Start an implement run for a staged item with 3 task groups.
- Complete group 1 and group 2.
- Stop group 3 due to token limit or a failed command.
- Inspect the pull request on GitHub:
_push_passed()pushed commits for group 1 and 2, but the pull request has no comment and its title still starts withdocs(openspec): plan #. CIPlan Checkruns and fails.
Expected vs Actual Behavior
Expected: When ImplementRun stops after pushing commits to a pull request, it writes a status comment to self.pull that names the stopped step and the failure class.
Actual: ImplementRun writes no comment to self.pull, leaving the pull request without status information.
Environment Diagnostics
- DevOps CLI Version: 0.80.0
- Python Version: 3.14.10
- Execution Environment: Kubernetes runner pod
Alternatives check of 2026-11-09: partly.
Tool: gidgethub (https://pypi.org/project/gidgethub), Apache-2.0 AND MIT, last activity 2026-09-25, maintained.
Proposed design
Problem statement
When _ItemRun stops before the item is ready, _push_passed() puts the commits of the passed groups on the branch of the pull request, but stop() writes only the issue comment: it writes a pull request comment only when the run applied an amendment. A reviewer sees a draft pull request whose Plan Check run fails on the delivery commits and no explanation of the stop. The change writes one status comment on the pull request at every stop that has one, names the stopped step and the failure class, and updates that comment when the same run stops again. The staging title and body are the separate change #3991, not this item. A scope note on the issue says #4713 makes the item obsolete, but no repository record at this commit names #4713, and the code still has the defect.
Acceptance criteria
Requirement: Task group stop comment
When _ItemRun stops at a task group and self.pull is set, it SHALL write one status comment to the pull request.
Scenario: Stop at a task group
- WHEN A run of a Staged item stops at the step
group 1after it pushed the commits of the passed group. - THEN The pull request holds exactly one comment, and its body holds
Stopped at group 1.andFailure class:with the class of the stop.
Requirement: Verify phase stop comment
When _ItemRun stops in the verify phase, at the checks step or at a fix step of a failed check, it SHALL write one status comment to the pull request.
Scenario: Stop in the verify phase
- WHEN A run stops at the step
checksor at the stepfixandself.pullis set. - THEN The pull request holds exactly one comment, and its body names the stopped step and the failure class.
Requirement: Scoped checks stop comment
When _ItemRun stops in the scoped checks, it SHALL write one status comment to the pull request.
Scenario: Stop in the scoped checks
- WHEN A run stops at the step
scoped checksafter it kept the branch of a finished item andself.pullis set. - THEN The pull request holds exactly one comment, and its body names
scoped checksand the failure class.
Requirement: Push step stop comment
When _ItemRun stops in the push step and self.pull is set, it SHALL write one status comment to the pull request.
Scenario: Stop in the push step
- WHEN A run that already holds a pull request stops at the step
push. - THEN The pull request holds exactly one comment, and its body names
pushand the failure class.
Requirement: Published draft gets the stop comment
When the push during a stop publishes the branch of a Planned item and opens its draft, _ItemRun SHALL write the status comment to the pull request that the publish opened.
Scenario: Stop that publishes a draft
- WHEN A Planned run with no pull request stops with new commits and
_push_passed()opens the draft during the stop. - THEN The new pull request holds exactly one comment, and its body names the stopped step and the failure class.
Requirement: Run marker line
The status comment on the pull request MUST hold one marker line that carries the run id.
Scenario: Marker line of the status comment
- WHEN The run writes the stop comment to the pull request.
- THEN The body of the comment holds exactly one marker line with the run id, and the test finds the comment by that line.
Requirement: Repeated stop updates one comment
When _ItemRun stops again with the same run id, it SHALL update the existing status comment in place and SHALL NOT post a second comment.
Scenario: Second stop with the same run id
- WHEN A run with the same run id stops a second time and the pull request already holds the status comment of that run.
- THEN The pull request still holds one status comment for the run id, and its body names the latest step and failure class.
Requirement: One comment on a stop with an amendment
When a stop has amendments or scoped-check notes, _ItemRun SHALL put them in the one status comment and SHALL NOT post a second comment.
Scenario: Stop with an amendment
- WHEN A run that applied an amendment stops and
self.pullis set. - THEN The pull request holds exactly one comment, and it holds the bullet of the amendment.
Requirement: Stop without pull request
When _ItemRun stops and self.pull is None after the push, it SHALL NOT write a pull request comment.
Scenario: Stop with no pull request
- WHEN A run stops with no pull request and no new commit to publish.
- THEN The run writes the issue comment and writes no pull request comment.
Existing Tool Considered
gidgethub 6.0.0 (Apache-2.0 AND MIT, maintained) covers the comment transport: the project's GitHub session lists, posts and updates pull request comments with it (docs/adr/0006-github-session-requests-go-through-gidgethub.md; src/devops_cli/github/client.py:428). It lacks the stop-phase logic of _ItemRun, the stop comment text, and its merge with the amendment and scoped-check lines. The run id marker that the alternatives check named as missing now exists from #4070: _comment writes <!-- devops roadmap implement run: <job> --> from ImplementRecordKey.JOB (src/devops_cli/roadmap/implement/implement_run.py:1538). The change builds only that stop logic and text merge, reusing the session's comment calls: about 25,000 tokens to build with tests, about 3,000 tokens a year to keep and fix, and about 4 hours of elapsed time.
Key questions
- Is the requested pull request stop comment still needed?: Yes. At the commit under refinement
stop()writes the pull request comment only when the run has amendments (src/devops_cli/roadmap/implement/implement_run.py:1818), so every other stop leaves the pushed commits unexplained. feat(roadmap): implement keeps phase marks and the spend of a killed Job #4070 added the run marker and explicitly left the stop comment to fix(roadmap): comment on pull request when implement stops #3997 (openspec/changes/archive/2026-11-09-4070-implement-keeps-phase-marks-and-the/proposal.md:24). No repository path at this commit names feat(roadmap): the implement Job opens its PR at the end #4713 or feat(ci): track the iteration lane and push cuts #4667, so the reply's claim that feat(roadmap): the implement Job opens its PR at the end #4713 removes the pull request is not evidence that the work is obsolete; the defect is still present. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1818, src/devops_cli/roadmap/implement/implement_run.py:1858, openspec/changes/archive/2026-11-09-4070-implement-keeps-phase-marks-and-the/proposal.md:24, docs/roadmap/implement.md:80, AGENTS.md:10]- Chosen: Build the stop comment now. The code at the refined commit still has the defect, and feat(roadmap): implement keeps phase marks and the spend of a killed Job #4070 left the stop comment to this issue.
- Rejected: Close as not planned on the feat(roadmap): the implement Job opens its PR at the end #4713 scope note. No repository record names feat(roadmap): the implement Job opens its PR at the end #4713 or feat(ci): track the iteration lane and push cuts #4667; the claim is unverified at this commit, and the code still pushes commits without a comment.
- Rejected: Wait for feat(roadmap): the implement Job opens its PR at the end #4713 before deciding. It leaves the defect in place on an unverified plan, while feat(roadmap): implement keeps phase marks and the spend of a killed Job #4070 already left the work to this issue.
- Which stop phases must post a status comment to the pull request?: Every stop with
self.pullset: a task group, the verify phase (checksandfix), the scoped checks, and the push step._push_passed()can publish a Planned item's draft during the stop and setself.pull, so the comment is written after that call. A stop that publishes nothing has no pull request. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1815, src/devops_cli/roadmap/implement/implement_run.py:1920, src/devops_cli/roadmap/implement/implement_run.py:1924, src/devops_cli/roadmap/implement/implement_run.py:1424]- Chosen: Every stop with a pull request. Each of these phases can leave pushed commits on the pull request.
- Rejected: Task group only.
stop()is one path for every phase; the verify, scoped-check and push stops would still have no comment. - Rejected: Only when amendments exist. That is the current defect.
- What must the stop comment state?: The stopped step and the failure class, then the reason, the table of the steps, the last message of the agent, and the diff, as the issue stop comment states them. The template opens
Stopped at {step}., and the failure lines name the class, the action taken and the action left. (best practice) [sources: src/devops_cli/lang/en/messages.py:3237, src/devops_cli/lang/en/messages.py:3251, docs/roadmap/implement.md:80]- Chosen: Same text as the issue stop comment. One renderer for both comments, and the pull request gets the reason, the table, the last message and the diff.
- Rejected: A shorter pull request text. It adds a second template and loses the diff and the table that the issue comment already builds.
- Which text does the pull request comment carry?: The text of the issue stop comment, from
implement_comment_stopped, so one renderer serves both comments. The amendment and scoped-check lines that_commentrenders today are added to that one body. (best practice) [sources: src/devops_cli/lang/en/messages.py:3237, src/devops_cli/roadmap/implement/implement_run.py:1525, src/devops_cli/roadmap/implement/implement_run.py:1858, openspec/changes/archive/2026-11-03-3032-a-trace-of-every-run-kept/design.md:12]- Chosen: Same text as the issue stop comment. One renderer, the precedent that feat(roadmap): a trace of every run, kept and shown in the PR comment and in explain #3032 set for the table, and no second set of messages to keep.
- Rejected: A shorter pull request text. It adds a second template and loses the diff and the table.
- How does a repeated stop avoid duplicate pull request comments?: The comment opens with
CONST_ROADMAP_IMPLEMENT_COMMENT_MARKERand a second marker line<!-- devops roadmap implement run: <run> -->. The run lists the comments once, finds the one with the marker and its own login, and replaces it withupdate_issue_comment; it posts only when none matches. The current_commentchecks the two marker lines; the stop comment should add the login check thatpr_evidence.pyuses. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1538, src/devops_cli/roadmap/implement/implement_run.py:1545, src/devops_cli/roadmap/implement/implement_run.py:1559, src/devops_cli/github/pr_evidence.py:117, openspec/specs/pull-request-evidence/spec.md:23, CONTRIBUTING.md:165]- Chosen: Update the one marker comment of the run id. It keeps one status comment for a run, as
pr_evidence.pydoes for the check results. - Rejected: Post a new comment on every stop. It adds duplicate comments, against the one-marker-comment rule of the pull-request-evidence spec.
- Rejected: Post no comment on a repeated stop. It hides the latest failure from reviewers.
- Chosen: Update the one marker comment of the run id. It keeps one status comment for a run, as
- What identifies a run in the marker line?: The run id is the value of
implement.job(ImplementRecordKey.JOB), ormanualwhen the record holds none._commentalready writes that marker line, so feat(roadmap): implement keeps phase marks and the spend of a killed Job #4070 delivered the run id and this item has no dependency on feat(roadmap): an enterprise-grade plan and implement pipeline (tracker) #3027. [sources: src/devops_cli/roadmap/stores/store.py:317, src/devops_cli/roadmap/implement/implement_run.py:1538, src/devops_cli/roadmap/implement/implement_run.py:1539, src/devops_cli/lang/en/messages.py:3338, openspec/changes/archive/2026-11-09-4070-implement-keeps-phase-marks-and-the/proposal.md:15] - Must a stop with no pull request write a pull request comment?: No. The comment is written only when
self.pullis set after the push, and a stop that publishes nothing has none._push_passed()returns at once whenself.pullis None and there is no new commit, and_publish()setsself.pullonly when it opens the draft. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1815, src/devops_cli/roadmap/implement/implement_run.py:1920, src/devops_cli/roadmap/implement/implement_run.py:1424]- Chosen: Write the comment only when
self.pullis set. A stop that publishes nothing has no pull request to comment on. - Rejected: Always write a pull request comment. It has no pull request number when the stop publishes nothing.
- Chosen: Write the comment only when
- Does this item update the pull request title and body on a stop?: No. fix(roadmap): update pull request metadata when archiving a change #3991 writes the delivery title, body and labels before the push, so a stopped run no longer leaves the staging form. This item writes only the status comment; it does not duplicate the metadata change. (best practice) [sources: openspec/changes/3991-update-pull-request-metadata-when-archiving/proposal.md:9, openspec/changes/3991-update-pull-request-metadata-when-archiving/proposal.md:11, src/devops_cli/roadmap/implement/implement_run.py:1482, docs/roadmap/implement.md:72]
- Chosen: Post the stop comment only. fix(roadmap): update pull request metadata when archiving a change #3991 already carries the title, body and label change, and the issue's expected behavior is the comment.
- Rejected: Also replace the title and body. It duplicates fix(roadmap): update pull request metadata when archiving a change #3991 and adds a second change to this pull request.
- Rejected: File a new deferred issue for the title and body. fix(roadmap): update pull request metadata when archiving a change #3991 is the open change for that part, so a new issue would duplicate it.
- Does the stop comment replace the amendments comment that
stopposts today?: Yes. A stop posts one comment: the stop text plus the amendment and scoped-check lines that_commentrenders today, so the pull request holds one comment at every stop and no amendment line is lost. (best practice) [sources: src/devops_cli/roadmap/implement/implement_run.py:1818, src/devops_cli/roadmap/implement/implement_run.py:1525, src/devops_cli/roadmap/implement/implement_run.py:1535, openspec/specs/roadmap-implement-job/spec.md:1011]- Chosen: One comment with the stop text and the amendment lines. It keeps one comment at a stop and keeps the amendment bullet that
_commentrenders today. - Rejected: Keep the two comments. A stop with an amendment would post two comments, so a test for a stop would not find one.
- Rejected: Drop the amendment lines. It hides the amendment that the run applied from the pull request.
- Chosen: One comment with the stop text and the amendment lines. It keeps one comment at a stop and keeps the amendment bullet that
- Which open tool covers the pull request comment need?: gidgethub 6.0.0, which the project's GitHub session already uses under ADR 0006, covers the transport: it lists, posts and updates pull request comments. It lacks the stop-phase logic of
_ItemRun, the stop comment text, and its merge with amendment and scoped-check lines.marocchino/sticky-pull-request-commentdoes the same upsert but runs in a GitHub Actions workflow, not inside the Python run. (best practice) [sources: docs/adr/0006-github-session-requests-go-through-gidgethub.md, src/devops_cli/github/client.py:428, src/devops_cli/github/pr_evidence.py:117, openspec/specs/pull-request-evidence/spec.md:23]- Chosen: gidgethub. The session already uses it, it is maintained, and it covers list, post and update.
- Rejected: marocchino/sticky-pull-request-comment. It runs in GitHub Actions, not inside the Python run.
- Rejected: Own comment transport. It duplicates calls that the session already provides.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 7, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.Reviewers and CI get no explanation on the PR, which blocks debugging, but the system still pushes commits and does not crash.Improves observability for human reviewers and reduces failed CI confusion, but does not change core functionality.The code already writes a comment to the issue in end_stopped; extending it to write a comment to self.pull is a small addition.Both deal with the pull request state after ImplementRun stops and _push_passed runs, but #3991 updates the PR title, body, and labels while the candidate adds a status comment naming the stopped step.dan-petty commentedon Nov 7, 2026
Answer from project standards: the fault is wider than a stop in a group. In implement_run.py, the
stopmethod posts to the pull request only whenself.pullis set andself.amendmentsis not empty. So a stop in the verify phase, the scoped checks, the push or the publish phase also leaves the pull request with no comment.Cover these phases in the acceptance criteria. A test for a stop in each phase must find one comment on the pull request. The comment names the step and the failure class. It holds a marker line for the run id, so a rerun updates it and posts no empty comment.
This item stays the owner of the comment on a stop. The issue "feat(roadmap): implement keeps phase marks and the spend of a killed Job" (part of #3027) adds the marker line. It also adds the update of the comment of a run. It does not post the stop comment.
dan-petty commentedon Nov 7, 2026
Evidence from pull request #4031 (issue #2163):
When group 2 failed in the runner pod,
ImplementRun.end_stopped()commented on issue #2163 and set marks in roadmap state.However, it did not update or comment on draft pull request #4031. PR #4031 remained open on GitHub in draft state with the initial placeholder body:
Closes #2163\n\nThe job is not finished. It replaces this body when it finishes.Reviewers saw a draft PR with no diagnosis or explanation of the failure until manual evaluation. Updating the pull request body or commenting on
self.pullinend_stopped()is necessary to communicate the failure diagnostic directly on the PR.devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at 1f03ee3 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/stores/store.py.devops-cli-service commentedon Nov 8, 2026
Refine cannot set this item to Ready at 5c9fb88 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.
devops-cli-service commentedon Nov 9, 2026
Alternatives check: partly
Reason: The need is a change inside ImplementRun's stop path: which phases comment, what the comment says, and how a run id marker is used. No outside tool covers that logic. gidgethub, which the project already uses for its GitHub session, covers only the comment transport (list and update). A GitHub Action such as marocchino/sticky-pull-request-comment does the same upsert, but it runs in CI workflows and not inside the Python run.
Tool: gidgethub (https://pypi.org/project/gidgethub)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-09. A person decides what this means for the item. The check changes no label and closes no issue.
dan-petty commentedon Nov 11, 2026
Scope from the iteration lane plan (2026-11-11)
#4713 makes this issue obsolete (child 14 of #4667). After #4713, no pull request exists when implement stops. The stop comment on the issue names the branch.
This issue closes as not planned, with a link to #4713, when #4713 merges. Do not start work on this issue.
2 remaining items
docs(openspec): plan #3997 write the stop comment to the pull request
fix(roadmap): write the status comment to the pull request on a stop (#…
docs(openspec): archive #3997 write the stop comment to the pull request
docs(openspec): plan #3997 write the stop comment to the pull request
fix(roadmap): write the status comment to the pull request on a stop (#…
docs(openspec): archive #3997 write the stop comment to the pull request
chore(main): release 0.138.0 (#5690)
devops-cli-service commentedon Nov 14, 2026
Released in v0.138.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.138.0
devops-cli-service commentedon Nov 14, 2026
Live since 2026-11-14 15:02 UTC