Commit 6cef45b
fix(handlers): canonical error envelope (request_id) on 3 agent-facing branches (#234)
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>1 parent 53e312b commit 6cef45b
3 files changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
| 816 | + | |
816 | 817 | | |
817 | 818 | | |
818 | 819 | | |
| |||
0 commit comments