Skip to content

[Bug]: Background task output leaks into assistant message text as raw <system_message> #11432

Description

@dkritarth

Metadata & Triage

  • Type: Bug (bug)
  • Area: apps/server, apps/web
  • Estimated Fix Size: size:M
  • Impact: Major degradation or frequent failure

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Steps to reproduce

  1. Run an agent turn where background commands or tasks run asynchronously (e.g., long-running test suites, typechecks, or background processes).
  2. Allow the background task to complete while the agent is active or between actions.
  3. Observe the chat timeline and assistant message bubble.

Expected behavior

  • Background command outputs and exit codes should be captured within the tool execution card / work log.
  • System notifications regarding task completion should be handled structurally without leaking internal protocol markers into the user-facing chat bubble.
  • Subsequent tool calls should continue to group cleanly in the activity log.

Actual behavior

  • The background task output breaks out of the tool/activity card and is dumped directly into the assistant's message bubble as raw plain text:
    <system_message> Background task fb2c9a16-96f0-4cca-a8dc-6502f8f67d95/task-1183 has completed. Task exit code: 0 Execution output:
    ... [hundreds of lines of raw stdout / stderr / stack traces]
    
  • This breaks the visual hierarchy and turn formatting: commands before it are collapsed into a summary card (Ran 52 commands...), the massive unformatted terminal output fills the chat bubble, and subsequent tool calls (e.g. view_file, git, gh) appear detached below the leaked text.

Screenshots

1. Break in timeline formatting where <system_message> and command stdout/stderr dump into message text:
System message leak

2. Raw stack traces continuing in the message body followed by detached tool call:
Stack trace and detached tool

3. Full UI context showing subsequent tool actions resuming below the leaked text block:
Full UI context

Root Cause Analysis

  1. When background tasks complete, the runtime or harness delivers a notification containing <system_message> Background task ... has completed. Task exit code: ... Execution output: ....
  2. Rather than being ingested as a structured tool result / task update or filtered out from the assistant text stream, this content ends up emitted as an agent_message_chunk / ContentDelta.
  3. Consequently, internal harness delimiters (<system_message>) and massive execution logs pollute the conversation view as assistant response text instead of being associated with the tool call or suppressed from the primary chat transcript.
  4. Tool grouping breaks as a result: tools executed before the leak stay grouped in the preceding card, while tools executed after the leak form a separate disconnected block below the message text.

Note on provider / model: This occurred while using Gemini 3.8 Flash (High) on the Antigravity provider. This could be specific to how the Antigravity harness/ACP integration delivers asynchronous task completion messages into the conversation stream, or a broader issue with how background task completion events are handled across providers.

Version or commit

Latest upstream main @ b1e223e2b (v0.0.41-nightly.20260912.1599)

Environment

Desktop / Web app, Antigravity provider, Gemini 3.8 Flash (High)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions