fix(handlers): canonical error envelope (request_id) on 3 agent-facing branches#234
Merged
Merged
Conversation
…g branches
Three agent-facing error branches emitted a bespoke envelope missing
request_id (and one used a non-standard "msg" key), so an agent couldn't
correlate the failure to logs/support the way every respondError path lets it:
- onboarding.go ClaimPreview invalid_token (not-found): routed through
respondError — adds request_id, swaps the bespoke "msg" for the canonical
"message" key. The `error` keyword (what clients match on) is unchanged.
- env_policy.go Put owner_required 403: added request_id alongside the
existing role/allowed_roles/agent_action fields.
- resource.go respondPauseUpgradeRequired 402: added request_id alongside
the existing upgrade_url/agent_action.
No contract break — only additive (request_id) plus the msg→message rename on
a branch whose documented shape was just {ok,error}. All three changed lines
covered by existing tests (claim-preview not-found, env-policy non-owner,
pause-tier-wall); verified locally against real Postgres+Redis.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Three agent-facing error branches emitted a bespoke envelope missing
request_id(and one used a non-standard"msg"key), so an agent couldn't correlate the failure to logs/support the way everyrespondErrorpath allows.onboarding.goClaimPreviewinvalid_token(not-found){ok,error,msg}respondError→{ok,error,message,request_id}env_policy.goPutowner_required403{ok,error,role,allowed_roles,agent_action}request_idresource.gorespondPauseUpgradeRequired402{ok,error,message,upgrade_url,agent_action}request_idWhy it's safe
Additive only (
request_id), plus themsg→messagerename on a branch whose documented shape was just{ok,error}. The machine-readableerrorkeyword (what clients branch on) is unchanged on all three.🤖 Generated with Claude Code