Repository navigation
Description
Problem
Two writers edit a marked comment in place and find the comment by its marker only, not by its author:
post()insrc/devops_cli/roadmap/steps/comment.pymatches the first comment that holds the marker and the key. Thewatchrow calls it with no key for the conflict comment (fix(ci): Job-time alarm, conflict and review comments post once #6199), and the stage, implement, review, open and fix-checks steps call it too.post_pr_review_comment()insrc/devops_cli/ai/review/runner.pymatches the first comment that holds the marker of the head (fix(ci): Job-time alarm, conflict and review comments post once #6199).
The token of the tool can edit the comments of other accounts. So a person who copies the marker into a comment gets that comment overwritten. publish_pr_evidence() in src/devops_cli/github/pr_evidence.py already matches only a comment whose author is the login of the session.
Expected behavior
An in-place edit matches only a comment that the account running the tool wrote: its author is the login of the process's GitHub session. A comment of another author that holds the marker is not edited, and the writer posts a new comment.
Source: #6219
Proposed design
Problem statement
Restrict both in-place comment writers to comments written by the tool account. post() and post_pr_review_comment() currently match a marked comment by its marker alone. A person who copies the marker can lose that comment. The fix compares the comment author with the session login and posts a new comment when no match exists.
Acceptance criteria
Requirement: Shared writer filters by session author
The shared post() writer SHALL edit an existing marked comment only when the comment author login equals the GitHub session login.
Scenario: Another author's marked comment is left unchanged
- WHEN
post()finds a comment with the marker and key whose author login is not the session login. - THEN
post()creates a new comment and does not callupdate_commentfor the other author's comment.
Requirement: Shared writer updates its own comment
The shared post() writer SHALL update the marked comment when its author login equals the GitHub session login and its body differs.
Scenario: Own marked comment is edited in place
- WHEN
post()finds a comment with the marker, the key and the session login, and its body differs from the new body. - THEN
post()callsupdate_commentwith that comment id and creates no new comment.
Requirement: Shared writer checks store comments
The shared post() writer SHALL apply the author check to comments from RoadmapStore and from GitHubClient.
Scenario: Store comment of another author is not edited
- WHEN
Targetuses a store whose comment list includes a marked comment of another author. - THEN
post()creates a new comment through the store and leaves the stored comment unchanged.
Requirement: Review writer filters by session author
post_pr_review_comment() SHALL edit the review comment for the head only when its author login equals the GitHub session login.
Scenario: Another author's head marker is left unchanged
- WHEN the pull request has a comment with the head marker whose author login is not the session login, and no comment of the session login holds that marker.
- THEN
post_pr_review_comment()creates a new review comment and does not callupdate_issue_commentfor the other author's comment.
Requirement: Review writer updates its own head comment
post_pr_review_comment() SHALL update the head review comment when its author login equals the GitHub session login and its body differs.
Scenario: Own head review comment is edited
- WHEN the pull request has a head-marker comment of the session login with a different body.
- THEN
post_pr_review_comment()callsupdate_issue_commentwith that comment id and creates no new comment.
Requirement: Writer ignores comment with no author
Each in-place writer SHALL treat a marked comment with no author login as not written by the session.
Scenario: A marked comment with no author is not edited
- WHEN a marked comment has no author login.
- THEN the writer posts a new comment and leaves the marked comment unchanged.
Existing Tool Considered
No alternatives check has run. The GitHub REST API issue-comments endpoint, through the existing devops_cli.github.client.GitHubClient and devops_cli.github.session, covers the need. It returns the author of each comment, and publish_pr_evidence() already compares that author with the session login. It lacks no author field; the two writers must add the same comparison. No new library is needed.
Key questions
- Which author must an in-place edit match?: The login of the process's GitHub session. The code must not use a hardcoded account name. [sources: src/devops_cli/github/pr_evidence.py, src/devops_cli/github/session.py]
- Where should the shared marked-comment writer apply the author check?: Inside
post()insrc/devops_cli/roadmap/steps/comment.py, before it accepts a comment as the match. (best practice) [sources: src/devops_cli/roadmap/steps/comment.py]- Chosen: Filter inside shared
post(). One place covers every caller, including the keylesswatchconflict comment. - Rejected: Filter in each caller. Many callers use
post(), and a new caller can omit the check. - Rejected: Filter in
Target.list_comments(). Reads must still see other authors' comments; only the edit match changes.
- Chosen: Filter inside shared
- How should the review comment writer get the session login?: Use the authenticated login from
get_github_session(), and compare it with the comment author. (best practice) [sources: src/devops_cli/ai/review/runner.py, src/devops_cli/github/session.py, src/devops_cli/github/pr_evidence.py]- Chosen: Reuse the session login. The session already holds the token and the login, so no new setting or secret is needed.
- Rejected: Pass the login from each caller.
post_pr_review_comment()has one caller path, and a parameter adds no value. - Rejected: Use a fixed bot login from config. A fixed login duplicates the session identity and can drift.
- What should a writer do when no marked comment of the session author exists?: Post a new comment, and leave every marked comment of another author unchanged. (best practice) [sources: src/devops_cli/roadmap/steps/comment.py, src/devops_cli/ai/review/runner.py]
- Chosen: Post a new comment. The writer still records its update, and another author's comment stays intact.
- Rejected: Skip the write. The caller needs its marked comment, so skipping loses the update.
- Rejected: Edit the first marker comment. That is the current bug: the tool token can overwrite another person's comment.
- How should the shared writer treat comments from
RoadmapStoreand fromGitHubClient?: Apply the same author check to both comment sources, and require the store comment to carry its author. (best practice) [sources: src/devops_cli/roadmap/steps/comment.py]- Chosen: Check the author on both store and client comments.
Targetreads either source, so one source must not bypass the fix. - Rejected: Check only client comments. The store path can still edit another author's comment.
- Rejected: Filter the store list before
post()sees it. That hides comments from reads and splits the rule across layers.
- Chosen: Check the author on both store and client comments.
- How should a writer treat a marked comment with no author login?: Treat it as not written by the session, so it is never edited. (best practice) [sources: src/devops_cli/roadmap/steps/comment.py, src/devops_cli/ai/review/runner.py]
- Chosen: Treat a missing author as no match. The writer cannot show that the session wrote the comment.
- Rejected: Treat a missing author as a match. That keeps the overwrite risk for a malformed comment.
- Rejected: Raise an error. A new comment still records the update without stopping the step.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 17, 2026
The bug lets the tool overwrite a user's comment, which is user data loss triggered by a specific condition.Both touch steps/comment.py post() and the roadmap comment-writing area, but the candidate adds an author match to prevent overwriting others' comments while #6200 refactors the writer into a marker registry.devops-cli-service commentedon Nov 17, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
fix(roadmap): Safely handle missing session login in comment upserts (#…
fix(roadmap): Pass author check and renew image security ignores (#6222)
devops-cli-service commentedon Nov 18, 2026
Released in v0.174.2: https://github.com/dan-petty/devops-cli/releases/tag/v0.174.2
devops-cli-service commentedon Nov 18, 2026
Live since 2026-11-18 01:44 UTC