Repository navigation
mcpdo: keep the sign-in helper's failure classification without a TTY (#2962) - #2971
Merged
Merged
Conversation
…#2962) The detached sign-in helper now classifies a flow failure with classifyError, where the original error object still exists, and relays the exit code and envelope fields on its error event. The parent rebuilds that CliExitCodeError (type-checked, sanitized) so a non-TTY connect reports e.g. fetch_refused / 12 with its url, as the TTY path does. auth_required stays the fallback for an unclassified failure. The EMA login helper shares the same event and gets the same fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
There was a problem hiding this comment.
🟡 Changes recommended
Reconstructing wrapped fetch errors drops the relayed cause, leaving non-TTY output without the refusal reason; preserve the sanitized cause and add a final-envelope round-trip assertion.
1 open issue
What changed in this PR
This PR addresses #2962 by preserving classified OAuth failures across mcpdo’s detached sign-in helper, bringing non-TTY error reporting closer to the TTY and one-shot CLI paths.
Changes:
- Relay classified exit codes and error fields from both sign-in helpers.
- Validate and sanitize relayed fields, retaining
auth_requiredas the fallback. - Add tests for classification, sanitization, and malformed relay data.
| File | Description |
|---|---|
clients/mcpdo/src/connection/ema-login-helper.ts |
Uses the shared classified error-event builder. |
clients/mcpdo/src/connection/auth-helper.ts |
Builds and reconstructs classified helper errors. |
clients/mcpdo/__tests__/ema-login-helper.test.ts |
Checks that EMA configuration failures retain their classification. |
clients/mcpdo/__tests__/auth-helper.test.ts |
Covers error relaying, validation, sanitization, and fallbacks. |
Review effort: Balanced
…2962) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
Member
Author
|
Copilot round 1: 1 finding (relayed |
Member
Author
|
Copilot review closed: round 2 was clean (no inline comments, no open issues, no suppressed comments) — the loop stopped on the first clean round. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #2962
Problem
Without a TTY,
mcpdo connectruns OAuth in the detached sign-in helper. Any failure the helper reported before producing the authorization URL was turned intoauth_required/ exit 3 by the parent, because the helper relayed only the message text. A fetch-guard refusal therefore exited 3 instead offetch_refused/ 12 (and lost itsurl), unlike the one-shot CLI and the TTY path.Fix
classifyError— in the process where the original error object still exists — and relaysexitCodeplus the envelope fields on theerrorevent (helperErrorEvent). The catch-allerrorclassification is not relayed.CliExitCodeErrorfrom the event (relayedHelperError): exit code must be a known non-zeroEXIT_CODESvalue, every field is type-checked, every string sanitized.auth_requiredstays the fallback for an unclassified (or malformed) relay.Verification
Reproduced per the issue against a composable server with
"mode":"protected-resource","authorizationServers":["http://169.254.169.254"],</dev/null:(Before:
auth_required/ 3.) Unit tests cover both sides of the relay and the malformed-input fallbacks;npm run local:gateis green.🤖 Generated with Claude Code