TUI /agents: sub-agent shutdown exits app instead of restoring parent thread

Resolved 💬 1 comment Opened Feb 11, 2026 by ignatremizov Closed Apr 3, 2026

What issue are you seeing?

In the CLI TUI, if I switch to a sub-agent via /agents and that sub-agent finishes (emits ShutdownComplete), the app exits instead of returning focus to the parent agent.

This kills the parent flow visibility even though the parent thread should remain active.

From code path inspection:

  • ChatWidget::on_shutdown_complete() always requests immediate app exit.
  • /agents thread switching does not persist a "return to parent" mapping.
  • So sub-agent shutdown while focused is treated as global quit.

What steps can reproduce the bug?

  1. Start a parent agent workflow in TUI.
  2. Use /agents and switch focus to a spawned sub-agent thread.
  3. Let the sub-agent finish/close.
  4. Observe TUI exits the process instead of restoring parent thread focus.

What is the expected behavior?

  • Sub-agent shutdown should close only that thread view.
  • TUI should restore focus to the parent (or previous active) thread.
  • App should only exit on explicit user-initiated quit.

Additional information

Related but not identical:

  • #2604 (Subagent Support)
  • #9607 (main agent completion signaling)
  • #11025 (stale closed agents in picker)

Potential fix direction:

  • Gate app exit on ShutdownComplete behind explicit quit intent.
  • On active-thread shutdown in /agents context, auto-switch back to recorded parent/previous thread.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗