Skip to content

fix(roadmap): check the 401 of devops roadmap return #3707

Done

Description

@devops-cli-service

Split from #3503.

Split from #3503. The evidence comments on #3049, #3076, #2754 and #2740 ask a person to run devops roadmap return --comment `` --confirm. They state that the command fails with 401 in an agent session. Nobody verified this 401. If it holds, a person cannot deliver the evidence from an agent session. #3503 copies the evidence of a closed plan pull request with the Service's own store call, so the 401 does not block that copy. A reproduction needs a live agent session with the App token, which the refine investigation cannot run. A fix of the token scope or of the error is a separate change. Acceptance criteria: A run of devops roadmap return --comment `` --confirm in an agent session states its result, and the record quotes the output. When the run fails with 401, the record names the cause. When the run fails with 401, the fix makes the command write the comment and set Status New from an agent session. A test: a token without the scope that the comment write needs gives a message that names the scope.

Proposed design

Problem statement

The evidence comments on #3049, #3076, #2754 and #2740 ask a person to run devops roadmap return --comment ... --confirm, and say that it fails with 401 in an agent session. No run verifies that claim. The repository shows that a 401 is gh reporting a login that GitHub does not accept, and the command already names that cause. A missing permission is a 403 that gh words Resource not accessible by integration. is_gh_refused_by_token recognizes that 403, but the comment write does not call it, so the command names no permission. This change pins the 401 message and makes a refused comment write name issues: write. The live reproduction and the token-scope fix are deferred to their own issue.

Acceptance criteria

Requirement: A refused login names its fix

devops roadmap return SHALL report a comment write that GitHub refuses with HTTP 401 as a refused login, and name the way to replace the login.

Scenario: The session login is refused

  • WHEN The gh api comment write exits nonzero and writes HTTP 401 to stderr.
  • THEN The command prints an error that holds 401, gh auth login and GH_TOKEN, and the command exits 1.

Requirement: A refused App comment names issues write

The comment write MUST report a token that GitHub refuses with HTTP 403 and Resource not accessible by integration as a missing issues: write permission.

Scenario: The token has no issues write

  • WHEN The gh api comment write exits nonzero and writes gh: Resource not accessible by integration (HTTP 403) to stderr.
  • THEN The store raises GitHubScopeError whose message holds issues: write and HTTP 403, and the command exits 1.

Requirement: A refused comment leaves Status unchanged

The command MUST NOT write the Status label when the comment write is refused.

Scenario: The comment write is refused

  • WHEN The evidence comment write raises GitHubScopeError before the Status write.
  • THEN The store writes no Status label, the item keeps its current Status, and the command exits 1.

Existing Tool Considered

No alternatives check has run on this issue. gh (https://github.com/cli/cli) is the open, maintained CLI that performs the evidence comment and the Status label write, and the store calls it for both (src/devops_cli/roadmap/stores/github_store.py). gh prints Resource not accessible by integration (HTTP 403) when the token lacks the permission, but it does not name the missing permission, and it reports a refused login as HTTP 401 with no cause. The change therefore extends the project's own error mapping: it reuses is_gh_refused_by_token (src/devops_cli/github/error_classifier.py) and adds one permission argument to the store's comment write. Written cost: about 6k to 12k tokens to build, keep and fix that mapping, and under one hour elapsed.

Key questions

  • Does devops roadmap return write the evidence comment and the Status label through gh?: Yes. GitHubRoadmapStore reads and writes the roadmap through gh, so the evidence comment and the Status label are gh calls. [sources: src/devops_cli/roadmap/stores/github_store.py]
  • Which GitHub App permission does an issue comment need?: issues: write. ADR 0015 lists Issues read and write among the roadmap jobs' permissions, and the token request asks for issues: write on every installation token. [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, openspec/specs/github-app-identity/spec.md, src/devops_cli/config/constants.py]
  • Is the 401 of the evidence comments a missing permission?: No. GitHubUnauthenticatedError covers HTTP 401: the process has no GitHub identity, or GitHub refused its token. A missing permission is the 403 that is_gh_refused_by_token recognizes. The comment write does not call that detector. [sources: docs/ERRORS.md, src/devops_cli/exceptions/git.py, src/devops_cli/github/error_classifier.py]
  • What should the command report when the comment write returns 401?: Keep the refused-login message. It names the failed gh command and says that gh has no login that GitHub accepts. Then it names gh auth login and GH_TOKEN. (best practice) [sources: src/devops_cli/github/error_classifier.py, docs/ERRORS.md, src/devops_cli/roadmap/stores/github_store.py]
    • Chosen: Keep the refused-login message. It names the failed write and the cause, and it matches the 401 class that the project records.
    • Rejected: Add issues: write to the 401 message. A 401 is a refused token, so the hint would send a person to a permission that is not the cause.
    • Rejected: Print GitHub's own body. The project classifies a failed gh command from its exit status and stderr, never from the message body of GitHub.
  • How does the command learn that a refused comment write needs issues: write?: The store's comment write calls is_gh_refused_by_token on gh's stderr. When it returns true, the store raises GitHubScopeError that names issues: write and the fix. The endpoint owns the permission, so the store passes it, not the classifier. (best practice) [sources: src/devops_cli/github/error_classifier.py, src/devops_cli/exceptions/git.py, src/devops_cli/roadmap/stores/github_store.py]
    • Chosen: Name the permission in the store's comment write. The store knows the endpoint, already owns the action text, and the detector already exists.
    • Rejected: Add a branch to _GH_CLASSES. The classifier sees only the output of gh, which does not name the permission of the endpoint.
    • Rejected: Leave the generic failure. It names the action and the status but not issues: write, which the body's test requires.
  • Should the command retry with another token or mint a new installation token on 401?: No. The command reports the refused login and stops. A retry sends the same credential to the same endpoint, and ADR 0015 already refreshes an installation token before it expires. (best practice) [sources: docs/adr/0015-roadmap-jobs-act-as-a-github-app-on-the-personal-account.md, src/devops_cli/github/app_token.py, docs/ERRORS.md]
    • Chosen: Report and stop. It keeps the failure explicit and leaves the login to the person who owns the session.
    • Rejected: Retry with the Service's token. It hides the refused login and mixes two identities in one write.
    • Rejected: Mint a new installation token. The session already refreshes its token before it expires, so a new token of the same identity does not change a refused login.
  • Does the body's last acceptance criterion ask for a test on the 401?: No. It asks for a test on a token that lacks the scope that the comment write needs. That token gives the 403 that names the permission, not a 401. (best practice) [sources: src/devops_cli/github/error_classifier.py, docs/ERRORS.md]
    • Chosen: Keep the test on the 403 refusal. It is the one part that runs offline, and it matches the status that GitHub uses for a missing permission.
    • Rejected: Drop the test. It would leave the only offline acceptance criterion of the issue unmet.
    • Rejected: Assert on a 401. A 401 carries no permission, so the assertion could only pass with a wrong message.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/medium
    on Nov 5, 2026
  2. devops-cli-service commented on Nov 5, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/roadmap. The (roadmap) scope of the title gives the scope.
    • Priority: P2-Medium. The 401 blocks a person from delivering evidence in an agent session, but the failure is unverified and needs a live reproduction first.
    • Value: Medium. It unblocks a specific agent-session workflow for delivering roadmap evidence, but the scope is one command in one context.
    • Effort: Medium. It needs a live reproduction, a token scope or error fix, and a test for the missing-scope message.
    • Related: fix(roadmap): a rejected plan leaves its evidence on the issue #3503, which asks for a different change. Both work on the devops roadmap return flow; #3503 copies evidence to the issue, while this candidate fixes the 401 that blocks the command in an agent session.
  3. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 72c52c6 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.

    • Who supplies a login that GitHub accepts when the 401 appears in an agent session? (a person decides)
  4. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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

    @devops-cli-service
    ContributorAuthor

    Live since 2026-11-28 17:56 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/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions