Repository navigation
Commit dbf8713
authored
fix: quota denial message no longer tells the agent to retry (#144)
## Summary
When `/v1/assess` returns 429 `quota_exceeded` and `failOpen` /
`fail_open` is off, the gate denies with `api_error` and the
quota-specific `contact_merchant` instructions ("Do not retry: the same
503 will be returned until the merchant resolves the issue"). The reason
carried no message, so the body fell back to the `api_error` default,
"AgentScore is unreachable. This is transient: retry in a few seconds."
An agent reading both got two opposite instructions in one response.
The quota denial now carries its own message, `QUOTA_EXCEEDED_MESSAGE`:
"AgentScore identity verification is unavailable for this merchant.
Retrying will not help." Every place that builds the quota denial sets
it (the typed and the untyped 429 paths). Found in a docs audit while
checking the errors reference against the SDK's emitted bodies.
## Type of change
- [x] Bug fix (no breaking change)
- [ ] New feature (no breaking change)
- [ ] Breaking change (existing callers must update)
- [ ] Docs, tests, or internal maintenance only
## Public API
Adds the exported constant `QUOTA_EXCEEDED_MESSAGE` beside
`QUOTA_EXCEEDED_INSTRUCTIONS`. The 503 body's `error.message` on the
quota path changes text; its shape and status do not. No release is cut
for this alone; the next release carries it.
## Test plan
The quota tests now assert the message. Positive control: with the
message removed from the deny sites, those tests fail; restored, they
pass. Full lint, type check and test suite pass locally.
## Checklist
- [x] Tests cover the new behavior, and the suite passes locally
- [x] Lint, format, and type checks pass
- [x] Docs and README examples updated if the public surface changed (no
README text covers this message)
- [x] No secrets, credentials, or personal data in the diff or the tests1 parent 1797587 commit dbf8713
4 files changed
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
| 867 | + | |
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
| |||
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | | - | |
| 886 | + | |
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
628 | | - | |
| 628 | + | |
629 | 629 | | |
| 630 | + | |
630 | 631 | | |
631 | 632 | | |
632 | 633 | | |
| |||
0 commit comments