Skip to content

[BUG] Background task killed notifications cause assistant context confusion #21700

Closed as not planned

Description

@carrotRakko

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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.

  2. Redundant repetition: The assistant restates information it already provided, as if responding to a new prompt.

  3. 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.

Activity

  1. github-actions commented on Jan 29, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [Bug] Hallucination: False User Confirmation from Task Notification and Compaction Events - why are <task-notification>s user content?? #20920
    2. [Bug] Task notifications causing incorrect forward progress tracking #21563
    3. [Bug] Agent completion message incorrectly interpreted as user directive #18689

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. carrotRakko commented on Jan 29, 2026

    @carrotRakko
    Author

    Thank you for the suggestions. I've reviewed all three and believe this issue is distinct:

    #20920: Reports hallucinated user confirmations ("yep") caused by compaction processing task-notifications. My issue occurs without compaction - it's purely task-notification triggered context confusion within a single session.

    #21563: Reports a TypeError related to forward progress tracking. My issue has no errors - it's a behavioral issue where the assistant misattributes its own statements.

    #18689 → #18544: Reports that Claude wastes tokens by responding to completion notifications. My issue is more severe - the assistant doesn't just respond unnecessarily, it loses track of conversation context:

    • Mistakes its own previous statement for a user message
    • Repeats information it already provided
    • Attempts to close conversations unprompted

    The key distinction: #18544 is about token efficiency (Claude responds when it shouldn't), while this issue is about context integrity (Claude forgets who said what).


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

  3. github-actions commented on Mar 1, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  4. github-actions commented on Mar 9, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  5. locked as resolved and limited conversation to collaborators on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions