Skip to content

feat(tui): add side conversation switching - #3760

Open
me2seeks wants to merge 1 commit into
apache:mainfrom
me2seeks:feat/3746-tui-side-toggle
Open

feat(tui): add side conversation switching#3760
me2seeks wants to merge 1 commit into
apache:mainfrom
me2seeks:feat/3746-tui-side-toggle

Conversation

@me2seeks

@me2seeks me2seeks commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Completes TUI side conversations with retained switching and Host-backed parent status.

  • Adds terminal-compatible Ctrl+/ switching for legacy and Kitty keyboard protocols.
  • Preserves independent unsent drafts for the parent and side views.
  • Keeps running Turns alive when switching views.
  • Projects the parent Session’s authoritative Host state while the side is visible.
  • Uses English-only status copy, including:
    • Side from main thread · Ctrl+/ to switch · Ctrl+C to close
    • Ctrl+/ for side
    • actionable and terminal main … variants
  • Closes and recoverably removes the retained side when navigating outside the pair.
  • Stops an active side Turn before removal when the pair is discarded.
  • Keeps model, permission, thinking, and orchestration settings as creation-time copies that evolve independently afterward.

Fixes #3746

Verification

  • npm run lint
  • npm run format:check
  • npm run typecheck
  • npm --workspace maka-agent run build
  • npm --workspace maka-agent run test:dist — 463 passed
  • npm run check:asf-headers
  • npx knip --workspace packages/cli — reports only the existing dev-cli.ts and five existing exported-type findings; no changed file is reported

Relevant behavior evidence:

✔ Ctrl+/ toggles side views, preserves drafts, and projects parent status in English
✔ Ctrl+/ detaches from a running side Turn without stopping it
✔ /session outside the pair discards its retained side conversation
✔ observes actionable and terminal parent status from the Host projection
✔ renders side conversation status in English for every UI locale

Review focus

#3759 has merged, and this branch is rebased onto current main. The Files changed view now contains only the switching slice.

The background observer reuses the existing Runtime Host continuity channel. It does not introduce a second lifecycle authority or persist TUI projection state. Historical terminal Turns are suppressed so main finished only describes a parent Turn observed running while the side was open.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented terminal key normalization, switching, draft isolation, Host status projection, cleanup integration, tests, and first-principles, adversarial, and simplification reviews.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@me2seeks
me2seeks force-pushed the feat/3746-tui-side-toggle branch from bb79332 to 1870897 Compare August 25, 2026 06:07
@me2seeks
me2seeks force-pushed the feat/3746-tui-side-toggle branch from 1870897 to 36d4e4b Compare August 25, 2026 16:06
@me2seeks
me2seeks marked this pull request as ready for review August 25, 2026 16:17

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NO-GO at 36d4e4b8a8a1e102588fb94d799c8522043a298e: 1 P1 and 1 P3.

Findings

  1. [P1][normal user path] Restore the retained parent draft when Ctrl+C closes an empty side Composer.

    Reproduction: open /side, press Ctrl+/ to return to the parent, type an unsent parent draft, press Ctrl+/ back to the still-empty side, then press Ctrl+C. The second toggle stores the text in pair.parentDraft and clears the editor (packages/cli/src/pi-tui-runner.ts:1741-1742). Ctrl+C deliberately takes the side-close path (:3535-3546), but closeSideConversation() adopts the parent and then discards the pair without restoring pair.parentDraft (:1842-1851). The parent therefore reappears with the side's empty editor state, permanently losing the user's only copy of the unsent text. Restore the parent draft after the parent switch succeeds and before clearing the pair, and add this exact close-path regression. The current draft test stops after toggling back into the side, so it cannot catch the loss.

  2. [P3][reasonable failure/reconnect path] Do not render observer transport exhaustion as the factual main closed state.

    RuntimeHostSessionChannel.onFailed means bounded subscription recovery was exhausted, not that the parent Session was archived. Nevertheless, runtime-host-session-driver.ts:729-733 maps it to closed, and pi-tui-runner.ts:1689-1699 does the same when opening the observer fails. A live but unreachable parent is therefore indistinguishable from a genuinely archived parent. Preserve the previous/unknown state or introduce an explicit unavailable state, with tests for both initial-open failure and retry exhaustion.

Evidence and gates

  • Reviewed head/base: 36d4e4b8a8a1e102588fb94d799c8522043a298e / e28ce6f515471d59b9063dd8a951db82e58f8fea.
  • The Host-backed observer, legacy and Kitty Ctrl+/ normalization, independent running Turns, stop-before-remove ordering, recoverable cleanup, navigation outside the pair, and creation-time settings copies otherwise follow the intended production paths.
  • The exact-head hosted test check completed successfully.
  • Current main was 19b47632be61b9116ae25d67e286f6a7878d6645; the synthetic merge was clean (tree 6cda61a10e030463a1b886c660bfaadc54b013e0), completed the full build:test, and passed 288/288 focused transcript/TUI/Host-driver/conversation-copy tests. This includes the new main conversation-copy changes from #3806.

The P1 must be fixed before approval. Because this is a feature, the merge decision remains with maintainers after the blocker is closed and the new exact head is re-reviewed.

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.

feat(tui): add Codex-style side conversations

2 participants