Skip to content

fix(minimal): a refused sign-in request shows the error and error_description that GitHub sent - #3608

Merged
norrietaylor merged 1 commit into
mainfrom
agent/3584-a-refused-sign-in-request-shows-the-error-and-er
Nov 19, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
agent/3584-a-refused-sign-in-request-shows-the-error-and-er

Conversation

@minimal-foundry

Copy link
Copy Markdown
Contributor

Follow-up

Fixes #3584

Task marker
### D3576 — A refused sign-in request shows the error and error_description that GitHub sent
  kind: task
  size: S
  est: 30 code, 50 tests
  executor: agent
  origin: bug
  epic: 1501
  layers:
    - auth:
      - crates/minimal/src/cmd/auth.rs: post_form parses the body of a non-success reply for error and error_description, puts them in the message, and adds a retry hint for a transient error. It then zeroizes the text.
      test: cargo test -p minimal device_code_refusal_shows_github_error
  proof: A 400 reply from /login/device/code that carries error=slow_down gives a message with slow_down, its description and a hint to run min auth login --device again.

Proof

A 400 reply from /login/device/code with error=slow_down now makes min auth login --device fail with: "GitHub refused the sign-in request to (400 Bad Request). GitHub said: slow_down: <error_description>" and a second line "This refusal is temporary. Wait a minute, then run min auth login --device again." The test device_code_refusal_shows_github_error pins this exact text.

Notes from the agent: post_form takes a new retry argument. The device code request passes min auth login --device. The browser token exchange passes None, because its caller already ends with "Run min auth login to try again." Transient errors are slow_down and temporarily_unavailable. A reply with no OAuth error keeps the old message. I added a second unit test, refusal_without_a_transient_error_has_no_retry_hint, in the same file. All 31 cmd::auth lib tests pass, and clippy -p minimal --all-targets and fmt are clean. poll_device_token is unchanged: it already passes a 4xx OAuth error to device_flow, which prints it.

Tests

line exit tail
cargo test -p minimal device_code_refusal_shows_github_error 0 running 1 test test cmd::auth::tests::device_code_refusal_shows_github_error ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1025 filtered out; finished in 0.04s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 41 filtered out; finished in 0.00s r

Verify

min task run agent-verify exited 100, so this PR is a draft.

 {
                "parent_span_id": "6cc1b26a4d43a92a",
                "rpc": "minimald-v1-GetSessionRecord",
                "span_id": "3226e0eb877febf0",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "3226e0eb877febf0",
                "queued_behind": "0",
                "span_id": "70d27c8e847b2379",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "rpc",
            fields: {
                "parent_span_id": "6cc1b26a4d43a92a",
                "rpc": "minimald-v1-DestroySession",
                "span_id": "1e1ac779b2a1d800",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "GetRecord",
                "parent_span_id": "1e1ac779b2a1d800",
                "queued_behind": "0",
                "span_id": "eb803743c55c97f3",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "DeleteSession",
                "parent_span_id": "1e1ac779b2a1d800",
                "queued_behind": "0",
                "span_id": "b5b72ee9470d9796",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "session.message",
            fields: {
                "kind": "Destroy",
                "parent_span_id": "b5b72ee9470d9796",
                "span_id": "ee965a56d11de79b",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
        LoggedSpan {
            name: "sessions.manager.message",
            fields: {
                "kind": "HandOverName",
                "parent_span_id": "b5b72ee9470d9796",
                "queued_behind": "0",
                "span_id": "ba373eb348def683",
                "trace_id": "0af7651916cd43dd8448eb211c803111",
            },
            parent: None,
            closed: true,
        },
    ]
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  Cancelling due to test failure: 
────────────
     Summary [  89.449s] 1196 tests run: 1195 passed, 1 failed, 2 skipped
        FAIL [  13.184s] (1196/1196) minimal::otel_cli exec_run_attach_and_task_run_share_the_commands_trace
error: test run failed

A non-success reply to a sign-in request now names the OAuth error and
error_description that GitHub sent. A transient error on the device code
request adds the command to run again. The reply text is zeroized after
it is parsed.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b4458310-1154-4eab-92d0-a0ca01f5e0a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@norrietaylor

Copy link
Copy Markdown
Member

Un-drafted: the agent-verify exit 100 is the same minimald trace-span test failure seen on #3590, outside this diff (only crates/minimal/src/cmd/auth.rs changes). The lanes are green.

@norrietaylor

Copy link
Copy Markdown
Member

/review

@norrietaylor

Copy link
Copy Markdown
Member

/arch-review

@minimal-foundry

minimal-foundry Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Approved: no findings at 98daeceda38f.

Nothing to do.

Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it.

Clobber: none seen.

@minimal-foundry minimal-foundry Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 19, 2026

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS · the full ruling

The design is silent on the text that min prints when GitHub refuses a sign-in request. Gatehouse §6.1.2 and the un-enrolled bullet of §6.10 state the flows and the keychain item, not this message. The change stays in crates/minimal/src/cmd/auth.rs. The reply text is still zeroized after the parse, and only error and error_description go into the message. No condition applies.

Ruled at 98daece against gominimal/arch@327e1b57d16b by claude-opus-5-5.

@minimal-arch minimal-arch Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS · the full ruling

The change conforms to the design. A refused sign-in request now shows only the error and error_description fields that GitHub sent. The code zeroizes the rest of the reply. Design principle 7 (architecture.md line 337) requires that no secret reaches the output, and these fields carry none. The retry hint names min auth login --device, a command in the design grammar. The failed agent-verify test is in otel_cli, outside this change, so investigate it before you mark the PR ready.

Ruled at 98daece against gominimal/arch@327e1b57d16b by claude-opus-5-5.

@norrietaylor norrietaylor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate passed at 98daece: minimal-review APPROVE, arch-review APPROVED, lanes green, no open threads.

@norrietaylor
norrietaylor added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 5740b35 Nov 19, 2026
40 checks passed
@norrietaylor
norrietaylor deleted the agent/3584-a-refused-sign-in-request-shows-the-error-and-er branch November 19, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3576 — A refused sign-in request shows the error and error_description that GitHub sent

1 participant