Skip to content

feat(tui): navigate subagents and show session lineage#116

Merged
samzong merged 1 commit into
mainfrom
feat/tui-subagent-navigation
Jul 25, 2026
Merged

feat(tui): navigate subagents and show session lineage#116
samzong merged 1 commit into
mainfrom
feat/tui-subagent-navigation

Conversation

@samzong

@samzong samzong commented Jul 25, 2026

Copy link
Copy Markdown
Owner

What's changed?

Surface session topology in the TUI viewer, building on the portable topology index (#115).

  • Subagent navigation — press a in the viewer to open a subagent picker (spawn children); Enter drills into a subagent, with a back-stack so q/Esc pops back to the parent (nesting supported). The header hints ▾ N subs and adds a subs to the help line when subagents exist.
  • Lineage in the viewer — the header shows the thread role and parent links, resolving whether each portable parent (source, source_id) is indexed locally ((ext) when not).
  • Viewer actions target the viewed session — share / export / preview / handoff / resume / open now act on the session in view rather than the search selection. Fixes a latent bug where drilling would otherwise act on the wrong session.
  • Hide subagents from the browse list, reachably — a subagent is hidden only when its spawn parent is present in the same scoped result set, so it stays reachable through the parent's picker. Orphaned subagents, and children whose parent falls outside the active time/project scope or the result limit, stay visible. Search is exempt: a query always surfaces a content-matching subagent even when its parent does not match. CLI recall search / session list defaults are unchanged.
  • Drop the F/V/H match-source indicator from the result list.

Why

Topology data (thread role, parent links) landed in the index and CLI in #115 but had no TUI surface. This makes subagent lineage navigable in the viewer and keeps the browse list focused on primary sessions, while guaranteeing that no session — subagent-only content matches, or children whose parent is out of scope — ever becomes unreachable, and leaving the stable CLI contract untouched.

Verification

  • cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, and the core test suite (354 passing) are green.
  • Tests cover: browse hides a subagent only when its parent is in the same set; a subagent stays visible when its parent is out of the active scope; subagent-only content stays searchable; subagent drill-down + back-stack; picker scroll windowing.

Considered and deferred

  • Skill drill-down (Usage dashboard → sessions) still shows subagents that used a skill; this is targeted evidence, intentionally exempt from the list's subagent hiding.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba569721df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/db/search.rs Outdated
@samzong
samzong force-pushed the feat/tui-subagent-navigation branch from ba56972 to d4710c3 Compare July 25, 2026 04:10
@samzong

samzong commented Jul 25, 2026

Copy link
Copy Markdown
Owner Author

Fixed the P1: search no longer hides subagents, so a query always surfaces a subagent whose content matches even when its parent does not match. The reachable-subagent hiding now applies only to the browse list (parent is always present there). Removed the now-unused SearchFilters.exclude_subagents flag and added a regression test (search_surfaces_subagent_content_when_parent_does_not_match) that fails under the old behavior.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4710c35ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/db/session_store.rs Outdated
Surface session topology in the TUI viewer:

- Viewer header shows thread role and parent lineage, resolving whether
  each portable parent is indexed locally.
- Press `a` to open a subagent picker (spawn children); Enter drills into
  a subagent with a back-stack so `q`/`Esc` pops back to the parent.
- Viewing-mode actions (share/export/preview/handoff/resume/open) target
  the viewed session rather than the search selection.
- Hide a subagent from the browse list only when its spawn parent is
  present in the same scoped result set, so it stays reachable through the
  parent's picker. Orphaned subagents, and children whose parent falls
  outside the active scope or result limit, stay visible. Search is exempt
  so a query always surfaces a content-matching subagent even when its
  parent does not match. CLI `recall search` / `session list` unchanged.
- Drop the F/V/H match-source indicator from the list.

## Considered and deferred

- Skill drill-down (Usage dashboard to sessions) still shows subagents
  that used the skill; this is targeted evidence, intentionally exempt
  from the list's subagent hiding.

Signed-off-by: samzong <samzong.lu@gmail.com>

- src/db/session_store.rs retain_visible_subagents [BOT-NIT]: the reachability query joins parent-links twice over the fetched id set; verified acceptable — the browse fetch is LIMIT-bounded and both joins hit indexed columns (parent-links PK, sessions UNIQUE(source, source_id)).
- src/tui/app.rs back_out_of_viewing [BOT-TASTE]: if the parent transcript fails to reload on pop, the viewer silently stays on the child; only reachable if the parent row is deleted mid-view, so left as a no-op rather than adding recovery UI.
@samzong
samzong force-pushed the feat/tui-subagent-navigation branch from d4710c3 to 0dbf7f0 Compare July 25, 2026 04:24
@samzong

samzong commented Jul 25, 2026

Copy link
Copy Markdown
Owner Author

Fixed the P1 on the browse scope: subagent hiding is now reachability-based — a subagent is dropped only when its spawn parent is present in the same scoped result set (retain_visible_subagents). A child whose parent falls outside the active time/project scope or the result limit now stays visible, so nothing becomes unreachable. Added a regression test (recent_sessions_keeps_subagent_when_parent_is_out_of_scope) reproducing the parent-yesterday/child-today case. The earlier search-path P1 is already addressed (search is exempt).

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0dbf7f0e3c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@samzong
samzong merged commit e0111cd into main Jul 25, 2026
1 check passed
@samzong
samzong deleted the feat/tui-subagent-navigation branch July 25, 2026 04:31
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.

1 participant