Skip to content

fix(ai): preserve numeric status field in RUN_ERROR payloads#985

Draft
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/run-error-preserve-numeric-status
Draft

fix(ai): preserve numeric status field in RUN_ERROR payloads#985
jan-kubica wants to merge 1 commit into
TanStack:mainfrom
jan-kubica:fix/run-error-preserve-numeric-status

Conversation

@jan-kubica

Copy link
Copy Markdown
Contributor

toRunErrorPayload dropped the HTTP status for SDK error classes that report it only as a numeric status field with no code (e.g. Google's @google/genai ApiError), leaving RUN_ERROR events with code: undefined and making 401/403/404/429 indistinguishable from unknown failures. Fall back to a numeric status when no code is present; ignore a string status (reason phrase / symbolic status) so only the numeric HTTP code is forwarded.

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

toRunErrorPayload dropped the HTTP status for SDK error classes that report
it only as a numeric `status` field with no `code` (e.g. Google's
@google/genai ApiError), leaving RUN_ERROR events with code: undefined and
making 401/403/404/429 indistinguishable from unknown failures. Fall back to
a numeric `status` when no `code` is present; ignore a string `status`
(reason phrase / symbolic status) so only the numeric HTTP code is forwarded.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4414768-6f5d-4954-82da-8ada842627a8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant