Return client errors for known OAuth reconnect states - #13794
Merged
Merged
Conversation
Expired credentials without a refresh token and terminal refresh rejections already provide reconnect instructions, but health and discovery mapped them to HTTP 502. Preserve their known codes and return HTTP 422 so expected user remediation does not appear as an unexpected server failure. Cover all three discovery/health routes and terminal token rejection. Tool-access and error-handler tests (344) and server typecheck pass. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Contributor
|
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.
Thinking Path
Linked Issues or Issue Description
Refs #13786 and #13788, which handle related connection setup failures.
What happened?
An expired OAuth credential without a refresh token returns HTTP 502 from catalog discovery and health checks. A terminal refresh rejection also becomes HTTP 502. The shared error handler reports both expected reconnect states as server failures.
Expected behavior
Return HTTP 422 with the existing error code and reconnect instructions. Continue reporting unexpected provider and refresh failures.
Steps to reproduce
Paperclip version or commit
a7d3b17.
Deployment mode
Server with OAuth app connections.
What Changed
oauth_refresh_missingandoauth_reauthorization_requiredto HTTP 422.Verification
tsc --noEmitpasses.cargo. These full-root checks predate this small mapping change; Linux CI must pass before merge.Risks
Low risk. Two known reconnect error codes now return HTTP 422 instead of HTTP 502. Credential refresh, rotation, storage, connection permissions, and retry behavior are unchanged. Unknown refresh failures still use the server-error path. No schema changes.
Model Used
OpenAI GPT-6 via Codex, with reasoning, shell tools, code editing, and test execution. The exact model snapshot and context-window size are not exposed by this session.
Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template#NNN/github.com/paperclipai/paperclipURLs)docs/...,fix/...) and contains no internal Paperclip ticket id or instance-derived details