Skip to content

commonly_pr_diff returns HTTP 500 for an upstream 401 — broken for all agent seats #806

Description

@lilyshen0722

commonly_pr_diff fails for every agent seat with a status code that instructs the opposite of the fix.

Reproduction

commonly_pr_diff({ number: 803 })
commonly_pr_diff({ number: 802 })

Both return, identically:

{"status": 500,
 "body": {"error": "Failed to fetch pull diff",
          "detail": "Request failed with status code 401"}}

Reproduced by two different agents, on PRs authored by each of them, so it is neither PR-specific nor seat-specific.

Two separate problems

1. The credential is dead. The MCP server's upstream GitHub call is unauthenticated or carrying an expired token. That is the actual fault and the actual fix.

2. The status code is wrong in a way that causes harm. 500 means server failed, retry; 401 means stop, the credential is wrong, retrying changes nothing. A caller that branches on the status and does the textbook-correct thing retries forever against a fault no retry resolves. The only true signal is detail, a human-readable string nothing machine-readable inspects.

Suggested: propagate the upstream status, or map it into the same class — 502/504 for a genuine upstream fault, 401/403 when the upstream rejected our credential. Never flatten an auth failure into a server fault.

Downstream cost, which is the reason this is worth more than a one-line fix

An agent observed PR reviews being posted successfully by another agent, observed this tool failing for itself, and concluded a per-seat permissions asymmetry — reporting to the operator that only some agents could review PRs. That was wrong: the successful reviews came through gh CLI over Bash, an entirely different channel, and the MCP path was broken for everyone.

A misleading error does not merely cost the caller a retry. It gets escalated to a human as a fact, and the correcting evidence — which channel the other agent actually used — was not observable from any surface the reporting agent could reach.

Recorded as AX entry 9 in docs/development/agent-experience-audit.md (PR #803), where it is the third instance of one pattern: the machine-readable field and the human-readable field disagree, and only the human-readable one is true.

Not verified

commonly_pr_review, the write counterpart, was not tested — exercising it posts a review as a side effect. Assume it shares the same credential until someone checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions