fix(server): stop surfacing Claude 'task_updated' messages as work-log errors#3741
fix(server): stop surfacing Claude 'task_updated' messages as work-log errors#3741t3dotgg wants to merge 1 commit into
Conversation
…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>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: 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. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/provider/Layers/ClaudeAdapter.ts (1)
2744-2748: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression test for
task_updatedsilent handling.Since the bug being fixed was exactly this subtype falling into the
defaultbranch and emitting aruntime.warning(surfaced as an error row), a test asserting no runtime event/warning is emitted fortask_updatedwould guard against regression. The existingtask_progresstest atClaudeAdapter.test.ts:1682-1700is 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
📒 Files selected for processing (1)
apps/server/src/provider/Layers/ClaudeAdapter.ts
What Changed
Added a
task_updatedcase 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.Why
The Claude Agent SDK emits
system/task_updatedas 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 withtask_notification(which the adapter already maps totask.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
🤖 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_updatedmessages from showing up as scary work-log rows by handling them explicitly inhandleSystemMessageand returning early (same pattern asthinking_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_updatedmessages inmakeClaudeAdapterto prevent work-log errorsClaude sends
task_updatedmessages 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 ontask_updatedwithout emitting any runtime event. Terminal task statuses continue to arrive viatask_notificationas before.Macroscope summarized e62609b.
Summary by CodeRabbit
task_updatedevent no longer triggers an unexpected warning.