Skip to content

fix(server): stop surfacing Claude 'task_updated' messages as work-log errors#3741

Open
t3dotgg wants to merge 1 commit into
mainfrom
t3code/claude-binding-error
Open

fix(server): stop surfacing Claude 'task_updated' messages as work-log errors#3741
t3dotgg wants to merge 1 commit into
mainfrom
t3code/claude-binding-error

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Jul 6, 2026

Copy link
Copy Markdown
Member

What Changed

Added a task_updated case to the Claude adapter's system-message switch so the message is absorbed instead of falling into the unknown-message default, which rendered it as a red-X "Claude system message 'task_updated'" error row in the work log.

image

Why

The Claude Agent SDK emits system/task_updated as a task-state sync patch — per the SDK's own typings, "clients merge into their local task map." It's not a loggable event, and every status patch observed in practice is redundant with task_notification (which the adapter already maps to task.completed). So users saw a scary error on every background-task status change for a message that carries no user-facing information. The raw payload is still captured in the provider log file for debugging.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

🤖 Generated with Claude Code


Note

Low Risk
Single early-return in the Claude system-message switch with no behavior change for mapped events; debugging payloads remain in the provider log.

Overview
Stops Claude system/task_updated messages from showing up as scary work-log rows by handling them explicitly in handleSystemMessage and returning early (same pattern as thinking_tokens).

Previously they hit the unknown subtype path and surfaced as runtime warnings styled like errors. These SDK messages are only local task-map sync patches; user-visible terminal updates already come through task_notification. Native NDJSON provider logging is unchanged because messages are still logged before system handling.

Reviewed by Cursor Bugbot for commit e62609b. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Ignore Claude task_updated messages in makeClaudeAdapter to prevent work-log errors

Claude sends task_updated messages for task-state sync, but the adapter had no handler for them, causing them to surface as work-log errors. A new switch case in ClaudeAdapter.ts silently returns on task_updated without emitting any runtime event. Terminal task statuses continue to arrive via task_notification as before.

Macroscope summarized e62609b.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of Claude system updates so a task_updated event no longer triggers an unexpected warning.
    • Client task state now stays in sync more cleanly without producing any extra user-visible events.

…g errors

The Claude Agent SDK emits system/task_updated as a task-state sync
patch (per its typings, clients merge it into their local task map).
The adapter's system-message switch had no case for it, so it fell
into the unknown-message default and showed up in the work log as a
red-X 'Claude system message' row on every background task status
change. Terminal statuses already arrive via task_notification, so
absorb the message silently; the raw payload remains in the provider
log file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

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: d6b18718-9c78-4d9c-b9ba-c30849e33ffa

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:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/claude-binding-error

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 6, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Simple fix adding a no-op case handler for 'task_updated' messages, following the existing pattern for 'thinking_tokens'. Prevents known messages from being erroneously logged as errors. Minimal scope with no runtime behavior impact.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/server/src/provider/Layers/ClaudeAdapter.ts (1)

2744-2748: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression test for task_updated silent handling.

Since the bug being fixed was exactly this subtype falling into the default branch and emitting a runtime.warning (surfaced as an error row), a test asserting no runtime event/warning is emitted for task_updated would guard against regression. The existing task_progress test at ClaudeAdapter.test.ts:1682-1700 is a good template to adapt.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/server/src/provider/Layers/ClaudeAdapter.ts` around lines 2744 - 2748,
Add a regression test for ClaudeAdapter’s `task_updated` handling so it does not
fall through to the `default` branch or emit a `runtime.warning`. Mirror the
existing `task_progress` case in `ClaudeAdapter.test.ts` and assert that
`task_updated` is handled silently with no runtime event or warning surfaced.
Use the `task_updated` switch branch in `ClaudeAdapter` and the relevant
runtime/warning assertions in the test suite to anchor the new case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/server/src/provider/Layers/ClaudeAdapter.ts`:
- Around line 2744-2748: Add a regression test for ClaudeAdapter’s
`task_updated` handling so it does not fall through to the `default` branch or
emit a `runtime.warning`. Mirror the existing `task_progress` case in
`ClaudeAdapter.test.ts` and assert that `task_updated` is handled silently with
no runtime event or warning surfaced. Use the `task_updated` switch branch in
`ClaudeAdapter` and the relevant runtime/warning assertions in the test suite to
anchor the new case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ca86c5b4-8fae-4d67-8211-11b6ff093fef

📥 Commits

Reviewing files that changed from the base of the PR and between 32e7844 and e62609b.

📒 Files selected for processing (1)
  • apps/server/src/provider/Layers/ClaudeAdapter.ts

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

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant