Skip to content

feat(tui): list sessions on the rail and roll agents up (ENG-1069) - #356

Closed
lg2m wants to merge 47 commits into
docs/eng-1068-tui-focus-planfrom
feat/eng-1069-tui-session-rail
Closed

lg2m wants to merge 47 commits into
docs/eng-1068-tui-focus-planfrom
feat/eng-1069-tui-session-rail

Conversation

@lg2m

@lg2m lg2m commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

F1–F2: list sessions on the rail and roll agents up

Spec: docs/plans/tui-focus.md#f1f2-roll-up-and-rail Linear: ENG-1069 (parent ENG-1067)
Stacked on #354.

What changed

  • The rail and the compact strip list sessions (root conversations) only. A session's agents roll up into its row: state rises (an idle session whose agent waits on approval lists under NEEDS YOU), ↳N agent badge with a working count, cost includes agents (accounting.inclusive).
  • Groups are NEEDS YOU / WORKING / RECENT; RECENT merges idle and done, glyphs tell them apart; unseen finishes and failures stay in NEEDS YOU.
  • Agents get rows only when they wait on the user (under their own session — fixes the child drawn under an unrelated session) or under the focused session, capped at 6 then +N more /agents; a focused agent is always listed.
  • Audit agents (SessionPurpose::Audit) and their subtrees are never listed or counted.
  • Auto rail/strip and background event visibility count sessions (roots()): one conversation and its agents get no rail. Strip reads 7 sessions ◐ 2 ◇ 2 (Ctrl-G) ● 3 new.

How verified

cargo xtask check

Head 05ac821573dd vs origin/main; 70 changed file(s); scope: qq, qq-tui, xtask.

Gate Result Tests Time Command
fmt pass 2.4s cargo fmt --all -- --check
lint pass 2.4s cargo xtask lint
clippy pass 2.6s cargo clippy --color never -p qq -p qq-tui -p xtask --all-targets --all-features -- -D warnings
test pass 836/836 passed, 3 skipped 22.9s cargo nextest run --color never --profile default -p qq -p qq-tui -p xtask

All gates passed in 30.3s.

  • cargo xtask smoke: 8 passed.
  • New tests: the_rail_lists_sessions_with_agent_state_rolled_up_from_one_pass, the_focused_session_lists_its_agents_up_to_the_cap, audit_agents_are_never_listed_or_counted, a_session_with_only_agents_gets_no_rail; 7 rail/strip tests updated to the new rule.
  • Goldens: 60/60 moved deliberately (strip wording, RECENT label; sessions-* regrouped with Deploy helper under Session 0).
  • Note: one unrelated run of headless::tests::closing_goal_host_drains_accepted_work_without_admitting_successors (src/headless.rs, untouched) timed out under load; it passed in isolation and on the rerun gate above.

Measurements

cargo bench -p qq-tui --bench render, medians (raw: target/qq-perf/tui-focus-F1-2026-10-18/)

Gate Before After
steady_state_frame 21.7 µs 22.4 µs
steady_state_with_sidebar 33.5 µs 34.1 µs
streaming_focused 34.7 µs 35.5 µs
streaming_run_on_32kb 458.4 µs 438.5 µs
children_20_with_sidebar 55.5 µs 52.5 µs
sessions_200_with_sidebar 28.8 µs 26.8 µs
golden_path_first_minute 40.1 µs 39.5 µs
resize_horizontal 30.8 µs 30.6 µs

Docs

  • docs/design/layout.md § Tiers, § Sessions rail; docs/guide/tui.md § Layout; ledger receipt.

Compatibility

  • PROTOCOL / DESCRIPTOR / schema: unchanged. No new dependencies.

Slice F1-F2 of docs/plans/tui-focus.md. One rollup pass groups sessions NEEDS YOU / WORKING / RECENT with agent state, counts and inclusive cost rolled up; agents show only when waiting or under the focused session (capped at 6); audit agents are hidden; Auto rail and strip count sessions.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T08:14:04.210751Z 4accec4 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lg2m

lg2m commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@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: 05ac821573

ℹ️ 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 crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread docs/guide/tui.md Resolved
@lg2m
lg2m added this pull request to stack #357 October 19, 2026 04:23
lg2m added 2 commits October 18, 2026 21:43
Unfocused sessions list at most three waiting agents then +N waiting; the focused session lists the focused agent, then waiting, then quiet agents within six. Tests for both caps and inclusive cost; fanout goldens.
@lg2m

lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 9cb374d0d9

ℹ️ 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 crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
lg2m added 2 commits October 18, 2026 21:58
…(ENG-1069)

Addresses Codex review on #356: rank-ordered agent rows, failed/unseen agents lift their session, audit roots and subtrees skipped everywhere, real 20-agent bench fixture, guide diagram shows RECENT.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review
d7fb26d addresses all five findings (replied inline).

@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: d7fb26d2a1

ℹ️ 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 crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/app.rs Resolved
Comment thread crates/qq-tui/benches/render.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
lg2m added 2 commits October 18, 2026 22:45
…idden-agent redraws (ENG-1069)

Addresses the second Codex review on #356: focused waiting agents lift their session, needs grouped per session (linear planning), navigation skips audits, and the 20-agent bench keeps its agents.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ 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".

@lg2m

lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 75037e9baf

ℹ️ 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 crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/app.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread docs/design/layout.md Resolved
…1069)

Addresses the third Codex review on #356: rail marker and detail rows use human-waiting holds, side questions count as work, hidden audit roots do not wake the frame, layout.md describes every agent attention row.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 6053e7a6ae

ℹ️ 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 crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread docs/design/layout.md Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread docs/plans/progress/tui-focus.md Resolved
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

lg2m added 5 commits October 19, 2026 22:10
… orphans linearly, indent orphan agents, name outcomes beside an approval (ENG-1069)

The roll-up's spend is unknown when any summed part is unknown, never an
understated total. A running session animates only while a spinner for it
is on screen and never when it is an audit.

Addresses the 10th Codex review on #356 and the 13th on #354.
…ssion-rail

# Conflicts:
#	crates/qq-tui/src/app.rs
…iew leaves on screen (ENG-1069)

Found in a pre-review of #356.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

@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: b351d3df26

ℹ️ 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 crates/qq-tui/src/app.rs Resolved
Comment thread crates/qq-tui/src/app.rs Resolved
Comment thread crates/qq-tui/src/app.rs Resolved
lg2m added 4 commits October 19, 2026 22:42
…hot and view-return fallbacks, animate only drawn transcripts (ENG-1069)

The server's inclusive accounting already folds the whole subtree, so
deeper agents are no longer added. A snapshot with no focused body that
falls back to a listed session fetches it, and so does a cold view_return
replacement behind an inspector-held workspace view. The animation clock
reads the sessions the last frame actually drew.

Addresses the 11th Codex review on #356 and the 14th on #354.
…kspace view open when its fallback body lands, drop revealed audits from an open picker (ENG-1069)

Found in a pre-review of #356.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m

lg2m commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 29c2c1fb5e

ℹ️ 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 crates/qq-tui/src/app/pickers.rs Resolved
Comment thread crates/qq-tui/src/view.rs Resolved
Comment thread crates/qq-tui/src/view/sidebar.rs Resolved
Comment thread crates/qq-tui/src/app.rs Resolved
Comment thread crates/qq-tui/src/view.rs Resolved
lg2m added 3 commits October 19, 2026 23:29
…rsized frame or under an overlay, roll agent unread into the session, close goal overlays on a revealed audit (ENG-1069)

Addresses the 12th Codex review on #356; the ledger lists the slice's
render-gate receipt.
@lg2m

lg2m commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

@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: 04ae1967eb

ℹ️ 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 crates/qq-tui/src/view.rs
Comment on lines +302 to +305
let overlaid = index == app.focused_pane
&& !matches!(mode, Mode::Approval | Mode::Trust | Mode::Compose);
if !overlaid && let Some(session) = shown_view(app, pane, inline_detail).session() {
drawn.push(session);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep inspector sessions in the drawn set

When a picker or form overlays the focused transcript on a wide or pinned-inspector frame, this excludes the session from drawn even though inspector_pane still renders its expanded tool calls (and explicitly derives their rows while an overlay is up). A ToolCallOutputDelta then falls through event_is_visible because the rail never displays tool output, so the visibly expanded inspector stops updating until an unrelated redraw. Fresh evidence beyond the earlier overlay fix is that the inspector remains painted while only the main pane is covered; record the inspector's source session as drawn separately.

Useful? React with 👍 / 👎.

Comment thread crates/qq-tui/src/app.rs
Comment on lines +3340 to +3344
|| !crate::view::rail_visible(
self.terminal_width,
self.layout,
crate::view::listed_sessions(self),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Stop animation ticks on undersized frames

When the terminal is below 32×9 and any non-audit session is running, the renderer commits empty drawn and rail_painted sets because only the static resize warning is shown, but this branch returns true solely because the rail cannot render. Consequently has_activity() and advance_animation() keep requesting frames every 125 ms with no animated cell. Fresh evidence after the prior fix is this direct !rail_visible shortcut, which bypasses the newly recorded empty sets; distinguish an undersized frame from a normal hidden-rail frame whose strip or transcript can show activity.

Useful? React with 👍 / 👎.

Comment on lines +700 to +703
if entry.agents_working > 0 {
right.push(
format!(" {}{}", spinner(app.animation_tick), entry.agents_working),
info(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep queued-agent badges animating

When an idle root's only working agent is Queued, is_working() increments agents_working, so this paints the animated spinner beside the root's agent count. However, activity_shown() recognizes only Running sessions and running side questions; after any transient notice expires, has_activity() becomes false and this visible badge freezes for as long as the agent remains queued. Either render queued agents with a static marker or include visible queued-agent badges in the animation clock.

Useful? React with 👍 / 👎.

Comment thread crates/qq-tui/src/app.rs
Comment on lines +3552 to +3555
let goal_target = match &self.overlay {
Some(Overlay::GoalForm(form)) => Some(form.session),
Some(Overlay::GoalCheck { target, .. }) => Some(target.session_id),
_ => None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Close session-setting pickers before an audit refocus

When an orphan is focused with the model, profile, approval-mode, effort, or delegate picker open and its missing audit parent arrives, this cleanup closes only goal overlays. The subsequent forced refocus leaves the picker open, and its accept handlers resolve self.focused() at Enter time, so the selection initialized for the hidden orphan is silently applied to the fallback session instead. Close session-scoped setting pickers when their original focus becomes unreachable rather than retargeting them behind the overlay.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@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: 4accec446e

ℹ️ 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 on lines +418 to 420
if newest_entry_point(&snapshot.sessions).is_some() {
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't treat a truncated snapshot as rootless

When has_older_sessions is true and the newest 512 rows are all agents or audits, an older normal root can still exist even though newest_entry_point(&snapshot.sessions) returns None. This check then falls through to CreateSession, so attaching to or recovering such a large workspace creates an unintended extra root. Account for truncation here, or have the snapshot query return a normal root independently before deciding the workspace needs one.

Useful? React with 👍 / 👎.

Comment thread crates/qq-tui/src/app.rs
Comment on lines +1894 to +1895
if view.session() != self.view().session() {
self.drop_focused_interaction();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clear stale tool selection when changing sessions

When a focused orphan has a spawn tool selected and a newly loaded audit parent triggers leave_hidden_focus, this session-change branch drops only question/amendment state and leaves transcript_cursor pointing at the old call. On the fallback transcript, pressing Enter resolves that stale call through child_spawned_by and calls focus_session on its child, allowing navigation directly back into the audit subtree. Clear the transcript cursor when the followed session changes, or verify that the selected call belongs to the current transcript before acting.

Useful? React with 👍 / 👎.

@lg2m

lg2m commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favor of the v0.1.11 TUI plan (ENG-1104, docs/plans/0.1.11.md). This PR's design is carried into section C (ENG-1107: https://linear.app/retsu-ai/issue/ENG-1107), and its unresolved review findings are listed there as required tests. The code will be redone against main, because this stack no longer merges cleanly.

@lg2m lg2m closed this Oct 29, 2026
@lg2m
lg2m deleted the feat/eng-1069-tui-session-rail branch October 29, 2026 04:35
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