Skip to content

fix(systemone): surface provider 4xx/5xx error bodies (bounded) - #335

Merged
ajianaz merged 1 commit into
developfrom
fix/systemone-error-bodies
Oct 8, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/systemone-error-bodies

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

systemone_decide now surfaces the provider's 4xx/5xx error body instead of always reporting "no error body".

Why

The ureq agent in SystemOneTool::new lacked http_status_as_error(false) (cf. gitea.rs, #233), so Error::StatusCode (code only) was mapped to Ok((code, Null)) and the body was lost. Closes #328.

Changes

  • .http_status_as_error(false) on the agent; non-2xx now come back as Ok(resp).
  • fetch: non-2xx body read with a hard 4 KiB byte cap, parsed as JSON if possible else kept as text; the old StatusCode arm is now only a defensive transport-error path (no key in text). Stale comment fixed.
  • error_detail: surfaced text capped at 500 chars. 401/429/529 messages unchanged; API key never included.
  • CHANGELOG: one [Unreleased] bullet.

Testing

  • Mock test now also asserts slow down is surfaced; new tests for a 500 JSON body (and no key leak), non-JSON and empty bodies, and a 100 KB body staying bounded.
  • Reverting only the source config line makes 3 of these tests fail; they pass with the fix.
  • fmt, clippy -D warnings, workspace tests, both no-default-features checks, cora review --staged clean.

🤖 Generated with Claude Code

Configure the ureq agent with http_status_as_error(false) so non-2xx
responses arrive as Ok(resp) and the error body is read (4 KiB read cap,
500-char surfaced cap) instead of being discarded as 'no error body'.

Closes #328

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 32441a7 into develop Oct 8, 2026
17 checks passed
@ajianaz ajianaz mentioned this pull request Oct 8, 2026
@ajianaz
ajianaz deleted the fix/systemone-error-bodies branch October 9, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

systemone: 4xx/5xx response bodies are discarded (provider detail never reaches the caller)

1 participant