Skip to content

fix: handle Claude Agent SDK 0.3.x system messages to stop runtime-warning flood#2872

Open
imabdulazeez wants to merge 2 commits into
pingdotgg:mainfrom
imabdulazeez:fix/claude-sdk-0.3-subtypes
Open

fix: handle Claude Agent SDK 0.3.x system messages to stop runtime-warning flood#2872
imabdulazeez wants to merge 2 commits into
pingdotgg:mainfrom
imabdulazeez:fix/claude-sdk-0.3-subtypes

Conversation

@imabdulazeez
Copy link
Copy Markdown
Contributor

@imabdulazeez imabdulazeez commented May 30, 2026

What Changed

Teach the Claude adapter about the system message subtypes added in the
@anthropic-ai/claude-agent-sdk 0.3.x bump, so they stop falling through to the
generic "Unhandled subtype" runtime warning:

  • thinking_tokens → no-op. This is the one the SDK streams continuously while a
    model is in its extended-thinking phase, and is responsible for the nonstop
    warnings on every prompt.
  • permission_denied → emits a new dedicated tool.denied provider-runtime event.
  • mirror_error → mapped to runtime.error.

Adds the tool.denied runtime event (contract + ingestion) so a denied tool shows
up as a distinct, error-toned work-log entry (tool name + reason) instead of a
generic "Runtime warning".

Why

The 0.3.x SDK introduced new system message subtypes. ClaudeAdapter's
handleSystemMessage switch only knows the older set, so anything new hits the
default branch and emits a runtime.warning. thinking_tokens is emitted
repeatedly throughout a model's thinking, so every prompt floods the work log with
"Runtime warning" entries — exactly what's reported in #2870.

Handling the three new subtypes explicitly removes the noise while keeping the
default branch as a catch-all so genuinely-unknown future messages are still
surfaced. permission_denied and mirror_error are real signals, so they're routed
to meaningful events rather than silently dropped.

Fixes #2870

UI Changes

No visual/component changes. Behavioral only: the work log no longer fills with
repeated "Runtime warning" entries on every prompt (the "before" is the screenshot
in #2870), and a denied tool now renders as a distinct error-tone entry.

Checklist

Note

Handle Claude Agent SDK 0.3.x system messages to stop runtime-warning flood

  • Adds thinking_tokens, permission_denied, and mirror_error subtypes to the system message handler in ClaudeAdapter.ts: thinking_tokens is silently ignored, permission_denied emits a new tool.denied runtime event, and mirror_error emits a runtime error instead of an unhandled warning.
  • Introduces the tool.denied event type in providerRuntime.ts with a payload carrying toolName, toolUseId, reason, and agentId.
  • Maps tool.denied events to an error activity in ProviderRuntimeIngestion.ts, surfacing the tool name and denial reason in the activity summary.

Macroscope summarized 423af15.

- no-op thinking_tokens to stop flooding work log
- map permission_denied to runtime warning with tool + reason
- map mirror_error to runtime.error
- new ToolDeniedPayload schema and ProviderRuntimeToolDeniedEvent in contracts
- permission_denied system subtype emits tool.denied instead of runtime warning
- ingestion maps tool.denied to a distinct error-tone work-log entry
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Important

Review skipped

Auto reviews are disabled on this repository. 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aaefb673-894e-40da-9221-70d71bacd0ee

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 and usage tips.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels May 30, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 30, 2026

Approvability

Verdict: Needs human review

Unable to check for correctness in 423af15.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: I keep getting runtime warnings since yesterday

1 participant