Skip to content

[Bug] Task tool shows no visual feedback - sessionId not available at tool_start #109

@randomm

Description

@randomm

Problem

When PM dispatches a task to a subagent, the UX is broken:

  1. No visual feedback during task — User sees blank screen for 10+ seconds, then static text for minutes
  2. No subagent tool output — Child session's tools don't render
  3. Task completion doesn't auto-wake PM — User has to manually prompt ("any luck?") to see results

Root Cause

Issue 1 & 2: sessionId timing

In task.ts, ctx.metadata({ sessionId }) is called AFTER session creation (line 222-228).
But in index.ts, we look for chunk.metadata?.sessionId during tool_start.
The tool_start event fires BEFORE ctx.metadata() is called, so sessionId is undefined.

Issue 3: Auto-wakeup not triggering UI update

Session.enableAutoWakeup() is called (line 317 in task.ts), but the CLI doesn't seem to respond to it.

Timeline

tool_start fires → metadata.sessionId = undefined → taskToChildSession not set
   ↓
ctx.metadata() called → sessionId now available → but we don't update the map
   ↓
child session tools fire → taskToChildSession lookup fails → tools not rendered
   ↓
task completes → auto-wakeup triggered → CLI doesn't update display
   ↓
user has to type "any luck?" to see results

Requirements

  • Task dispatch shows immediately (agent name, description)
  • Child session tools render nested under the task
  • Task completion auto-updates the display (no manual prompt needed)
  • No 10+ second blank screen

Files

  • packages/opencode/src/tool/task.ts — Where metadata is set
  • packages/opencode/src/cli/lite/index.ts — Where we try to read it
  • packages/opencode/src/cli/lite/liveblock.ts — Task rendering

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions