Skip to content

fix(async-tasks): task completion injection should use synthetic:true to avoid appearing as user message #196

@randomm

Description

@randomm

Bug

The async task completion notification is injected as a regular user message part, making it appear in the TUI as if the user sent a massive wall of text (the subagent's full output).

Root Cause

In prompt.ts line 167, the injected part lacks synthetic: true:

// Current (wrong):
input = { ...input, parts: [...input.parts, { type: "text", text: injectionText }] }

// Fix:
input = { ...input, parts: [...input.parts, { type: "text", text: injectionText, synthetic: true }] }

Expected Behavior

Before the upstream sync, this notification never appeared in the UI at all — if users wanted to see the subagent output they browsed to the subagent session. The notification is useful context for the LLM but should NOT look like a user message in the TUI.

Fix

Add synthetic: true to the injected text part. The synthetic flag is already used throughout prompt.ts for system-injected content that should not render as user input.

Quality Gates

  • Typecheck passes
  • Tasks tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions