Skip to content

feat(btw): add switchable side conversation UI - #1019

Open
MoerAI wants to merge 20 commits into
code-yeongyu:mainfrom
MoerAI:feat/btw-codex-side-ui
Open

feat(btw): add switchable side conversation UI#1019
MoerAI wants to merge 20 commits into
code-yeongyu:mainfrom
MoerAI:feat/btw-codex-side-ui

Conversation

@MoerAI

@MoerAI MoerAI commented Aug 20, 2026

Copy link
Copy Markdown

Summary

Supersedes closed #880 and keeps its branch-local BTW history/context work,
while replacing the one-shot widget and read-only viewer with the Codex-style
side UI the feature was intended to provide.

  • /btw and /side open one focused, multi-turn side overlay in the TUI.
  • The parent keeps streaming while the side is visible or hidden.
  • Ctrl+/ switches parent and side across legacy and Kitty keyboard protocols.
  • The configured clear key (Ctrl+C by default) closes the side; the configured
    interrupt key (Escape by default) cancels only the current side answer.
  • Side turns stay no-tools provider requests and persist only as branch-local
    btw-history custom entries, never parent user/assistant messages.
  • Long questions wrap, transcript paging clamps, non-empty drafts keep their
    own PageUp/PageDown navigation, tall editors preserve scroll chrome, and the
    primary hints remain visible at 80 columns.
  • ExtensionUIContext.custom now closes its own captured overlay handle rather
    than whichever overlay happens to be topmost.

Why

The previous attempt accumulated review fixes around history, sanitization, key
labels, provenance, and turn-atomic pruning, but its user surface was still a
single below-editor answer widget. This finishes the interaction without
introducing a persisted side session, adoption metadata, caches, or navigation
races.

Observed behavior

In an isolated real Senpi TUI with a localhost mock provider:

  1. A held parent turn showed PARENT-WORKING.
  2. /btw what is the main task doing? opened BTW side · main working and
    streamed SIDE-FIRST.
  3. Ctrl+/ revealed the still-running parent and restored the same side.
  4. A follow-up streamed SIDE-FOLLOWUP.
  5. /btw nested should stay side text remained side input, not a nested
    command.
  6. Ctrl+C closed only the side; the parent later completed as
    PARENT-WORKING PARENT-DONE.

Provider inspection showed zero tools on all three side requests, inherited
parent context, and prior side history on follow-ups. Exactly one session JSONL
was created; side turns were custom entries only. The real auth digest was
unchanged.

QA receipt:
local-ignore/qa-evidence/20260820-pr-880-btw-ui/README.md

Verification

  • Focused BTW gate: 6 files, 52 tests passed
  • npm run check
  • npm run build
  • PR changelog gate: passed, 1 production path covered
  • mock-loop.mjs --self-test
  • tui-smoke.mjs --self-test: 5/5
  • cli-smoke.mjs --self-test: 8/8
  • Post-rebase TUI smoke: 5/5

The full coding-agent suite has unrelated existing process/MCP failures:
976 files and 8280 tests passed; 43 files and 179 tests failed. The changed
domain, root check, production build, changelog gate, and real TUI QA are clean.

Risk

The only cross-cutting change is scoped custom-overlay teardown in interactive
mode. A focused regression stacks a newer overlay above the completing custom
call and proves that only the owned handle closes.


Summary by cubic

Adds a switchable side conversation overlay for /btw and /side in the TUI, replacing the one‑shot widget and read‑only viewer. The side is multi‑turn and runs in parallel with the parent; non‑TUI still performs a one‑shot answer.

  • Commands and keys: Ctrl+/ toggles parent/side (legacy and Kitty), the configured clear key closes (default Ctrl+C), and the configured interrupt key cancels only the current side answer (default Escape).
  • Session and history: side requests use no tools and never touch the main conversation; completed exchanges persist as branch‑local btw-history custom entries. Side context includes recent side pairs with correct roles, pruned to the budget.
  • UI behavior: long questions wrap; transcript paging clamps; non‑empty drafts keep PageUp/PageDown; tall editors cap to terminal height; the 80‑col footer shows switch/close/cancel/scroll hints. All displayed text and notifications are sanitized.
  • Lifecycle and status: side can hide/show; it aborts or closes exactly once on session switch/fork/tree navigation/shutdown/extension removal. Parent working/idle status is shown; a status line appears while hidden.
  • Host fix: interactive custom overlays now close their own overlay handle instead of the topmost, preventing unrelated overlays from being dismissed. Risk is scoped to interactive-mode overlay completion.
  • Review focus: core changes in btw/index.ts, btw/side-controller.ts, btw/side-panel.ts, btw/non-tui.ts; host change in modes/interactive/interactive-mode.ts. Tests cover controller, panel, history, query, and overlay ownership.

Written for commit bf959fa. Summary will update on new commits.

Review in cubic

@MoerAI

MoerAI commented Aug 20, 2026

Copy link
Copy Markdown
Author

Ready for maintainer review. The focused 52-test BTW gate, root check, production build, changelog gate, isolated TUI QA, provider/session isolation checks, and post-rebase TUI smoke are green. Branch protection requires an approval/merge from a repository maintainer; this contributor account cannot enable auto-merge.

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

ℹ️ 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 +54 to +55
pi.registerShortcut(Key.ctrl("_"), toggleShortcut);
pi.registerShortcut(Key.ctrl("/"), toggleShortcut);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Route the side-switch shortcut through KEYBINDINGS

The switch is fixed to Ctrl+/ (plus its legacy encoding) here and again in BtwSidePanel, so users cannot rebind it. If a reserved action such as app.clear is configured to Ctrl+/, ExtensionRunner drops this parent shortcut as a conflict while the panel still hides on that key, leaving the advertised switch key unable to restore the side. Add a keybinding action/default and resolve it through KeybindingsManager in both locations.

AGENTS.md reference: packages/coding-agent/AGENTS.md:L62-L62

Useful? React with 👍 / 👎.

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