Skip to content

feat: nest subagent sessions inside parent tile#22

Merged
amahpour merged 10 commits intomainfrom
19-nest-subagent-sessions-inside-parent-session-tile
Mar 30, 2026
Merged

feat: nest subagent sessions inside parent tile#22
amahpour merged 10 commits intomainfrom
19-nest-subagent-sessions-inside-parent-session-tile

Conversation

@amahpour
Copy link
Copy Markdown
Owner

@amahpour amahpour commented Mar 30, 2026

Summary

  • Subagents now appear nested within their parent session card instead of as separate dashboard tiles
  • Only in-flight subagents show on the tile — completed/stale ones disappear automatically
  • Transcript view renders Agent tool calls as "Spawned Agent" blocks with expandable full conversation

Screenshots

Dashboard tile with nested subagents

Subagent tile view

Transcript view with Spawned Agent block

Subagent transcript view

Changes

Backend (db.py, hooks.py, api.py, ws.py, watcher.py):

  • parent_session_id and agent_type columns on sessions table
  • SubagentStart/SubagentStop hooks create linked subagent sessions
  • API and WebSocket responses nest subagents inside parent sessions
  • File watcher detects subagent transcript paths and sets parent link

Frontend (dashboard.js, app.js, terminal.js, style.css):

  • Dashboard tiles show collapsible active subagent rows (status, type, duration)
  • WebSocket updates for subagents route to parent card — never create separate tiles
  • Transcript view renders Agent tool calls as "Spawned Agent" blocks with type badge, prompt, result, and expandable full conversation
  • Expand state persists across real-time re-renders

Tests: 9 new tests across test_db.py, test_hooks.py, test_api.py (264 total, all passing)

Closes #19
Follow-up: #21 (real-time streaming of subagent transcripts)

Test plan

  • Start a Claude Code session and spawn subagents — verify they appear nested in the parent tile, not as separate cards
  • Verify completed/stale subagents disappear from tile but remain in transcript
  • Open transcript view — verify "Spawned Agent" blocks render with type badge and expandable conversation
  • Click "View full subagent conversation" — verify transcript loads inline

🤖 Generated with Claude Code

@amahpour amahpour linked an issue Mar 30, 2026 that may be closed by this pull request
amahpour and others added 4 commits March 30, 2026 09:24
Subagents now appear nested within their parent session card instead of
as separate dashboard tiles. Completed subagents are hidden from the tile
(live command center view) but remain visible as expandable "Spawned Agent"
blocks in the transcript history.

Backend:
- Add parent_session_id and agent_type columns to sessions table
- SubagentStart/Stop hooks create linked subagent sessions with parent ref
- API nests subagents array inside parent session responses
- WebSocket initial_state and broadcasts include nested subagents
- File watcher detects subagent transcript paths and sets parent link

Frontend:
- Dashboard tiles show collapsible active subagent rows with status/type/duration
- WebSocket updates for subagents route to parent card (never create tiles)
- Expand state persists across real-time re-renders
- Transcript view renders Agent tool calls as "Spawned Agent" blocks with
  type badge, prompt, result summary, and expandable full conversation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amahpour amahpour force-pushed the 19-nest-subagent-sessions-inside-parent-session-tile branch from d14802a to b478d12 Compare March 30, 2026 16:25
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Coverage

Unit Test Coverage
FileStmtsMissCoverMissing
__init__.py00100% 
db.py151298%133–134
hooks.py169298%222, 225
main.py370100% 
pr_lookup.py113298%53–54
sessions.py00100% 
terminal.py980100% 
watcher.py3921995%26–29, 338, 366, 418, 479, 549–550, 584–592
routes
   __init__.py00100% 
   api.py1510100% 
   ws.py110991%51, 68–69, 107–108, 110, 129, 145–146
TOTAL12213497% 

Tests Skipped Failures Errors Time
278 0 💤 0 ❌ 0 🔥 16.841s ⏱️

amahpour and others added 6 commits March 30, 2026 09:29
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The agent tool result's `content` field can be an object, not just a
string. Coerce to String() before calling substring to prevent
TypeError that silently broke the entire transcript rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the watcher processes new JSONL entries for a session, it now
updates last_activity_at. If the session was marked stale but new
entries are arriving (user resumed the session), it resets status
to idle.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The tile now only shows subagents with status "working". When none
are running, shows a subtle "N subagents completed" label. When some
are running with others done, shows "N running (M done)". This keeps
the command center focused on what's in flight right now.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the "N subagents completed" label entirely. The tile is a
live command center — if nothing is running, show nothing. Completed
subagent history lives in the transcript view only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the watcher creates a subagent session from a transcript file,
set status to "working" so it appears on the tile. Previously it
defaulted to "idle" which the tile filter excluded, making subagents
invisible when hooks go to a different port.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amahpour amahpour merged commit c962c63 into main Mar 30, 2026
6 checks passed
@amahpour amahpour deleted the 19-nest-subagent-sessions-inside-parent-session-tile branch March 30, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nest subagent sessions inside parent session tile

1 participant