[Bug]: Background task output leaks into assistant message text as raw <system_message>
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
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
- Run an agent turn where background commands or tasks run asynchronously (e.g., long-running test suites, typechecks, or background processes).
- Allow the background task to complete while the agent is active or between actions.
- 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:

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

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

Root Cause Analysis
- When background tasks complete, the runtime or harness delivers a notification containing
<system_message> Background task ... has completed. Task exit code: ... Execution output: .... - 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. - 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. - 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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing background-task completion notifications from the apps/server runtime or Antigravity/ACP integration into agent_message_chunk or ContentDelta, then follow how apps/web renders the resulting timeline. Reproduce with an asynchronous background task and verify that completion output stays in the tool execution card or work log, internal markers do not appear in assistant text, and later tool calls remain grouped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- full-stack
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100