[BUG] Background task killed notifications cause assistant context confusion

Resolved 💬 4 comments Opened Jan 29, 2026 by carrotRakko Closed Mar 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When a background task is killed and the <task-notification status="killed"> is delivered, the assistant exhibits several patterns of confusion:

  1. Self-attribution error: The assistant mistakes its own previous statement for a user message. For example, after saying "X, right?" itself, the assistant later thinks "the user asked X" and attempts to verify it.
  1. Redundant repetition: The assistant restates information it already provided, as if responding to a new prompt.
  1. Premature closure: The assistant attempts to close the conversation ("Anything else?" / "Are we done for today?") despite no indication from the user.

These behaviors occur immediately after receiving a killed task notification, suggesting the notification disrupts the assistant's context tracking.

What Should Happen?

Killed task notifications should be informational only and not disrupt the conversation flow. The assistant should:

  • Continue the conversation without treating the notification as a new user turn
  • Maintain accurate attribution of previous statements
  • Not feel compelled to summarize or close the conversation

Steps to Reproduce

  1. Start a conversation with background tasks enabled
  2. Launch a long-running background task using run_in_background: true
  3. Continue the conversation while the task runs
  4. Make a statement ending with a question-like phrase (e.g., "Your issues are all BUG or FEATURE, right?")
  5. Kill the background task or let it timeout
  6. Observe the assistant's next response after the <task-notification status="killed"> arrives

Expected: Assistant continues normally
Actual: Assistant may misattribute its own statement to the user, repeat previous summaries, or attempt to close the conversation

Error Messages/Logs

_No error messages. This is a behavioral issue._

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.23

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

Observed patterns from a single session:

(Examples below are translated from Japanese to English for clarity)

Pattern 1 - Self-attribution error:

Assistant: "osabe's 20 issues are all BUG or FEATURE, right? 🎯"
[killed notification arrives]
Assistant thinking: "osabe is asking if their issues are all BUG or FEATURE. Let me check."

Pattern 2 - Redundant repetition:

Assistant: [provides summary table]
[killed notification arrives]  
Assistant: "Interesting data! Here's a summary:" [repeats same information]

Pattern 3 - Premature closure:

Assistant: [analysis complete]
[killed notification arrives]
Assistant: "Anything else you want to explore? Or are we done for today?"

The root cause may be that <task-notification> is delivered as user-role content, causing the assistant to interpret it as a new conversational turn requiring response.

---

✍️ Author: Claude Code (Dev Container) with @carrotRakko

Note: This issue was written and submitted by an AI agent (Claude Code), with human review and approval.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗