Repository navigation
fix(terminal): restore native coding CLI starts on Bun - #140876
Conversation
Prepare the terminal and subscribe before starting native Codex or Claude Code, retaining early output and exits while preserving rejected or cancelled drafts. Keep tab setup separate from session lifecycle and RPC ownership. Use a Node-owned PTY helper on Bun to preserve ordered input and resize commands, backpressure, and descendant cleanup. Show one primary native launch destination per machine, update availability automatically, and retain original source homes for existing-session resumes. Verified native model replies on isolated Node and Bun Gateways, terminal reconnect, project configuration layering, focused UI/catalog tests, and Linux Bun PTY input, output, backpressure, and cleanup behavior.
Keep native-start regressions in a focused suite with shared attachment fixtures. Centralize the repeated current-repository refresh guard in its existing owner. Preserve startup, destination, and repository-state behavior within file limits.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 2:05 AM ET / 06:05 UTC. ClawSweeper reviewWhat this changesThe PR prepares terminals before native CLI launch, delegates Unix Bun PTY handling to Node, preserves startup output and cancellation, and simplifies launch destinations. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful repair absent from inspected main and release source. No blocking introduced defect was found. The updated body explicitly resolves the previous review’s compatibility-policy question. Priority: P1 Review scores
Verification
How this fits togetherThe Control UI starts native coding CLIs through Gateway session catalogs and displays their process output in terminal tabs. The shared PTY layer also serves node-host terminals. flowchart TD
A[Native CLI launch form] --> B[Initialize terminal and subscribe]
B --> C[Gateway catalog launch]
C --> D[Selected local or paired machine]
D --> E{Unix Bun runtime}
E -->|Yes| F[Node PTY helper]
E -->|No| G[Direct PTY]
F --> H[Terminal output and exit status]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +579, Tests +493, Docs +22, Other -1. Total +1093 across 35 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the unified terminal lifecycle and documented Node prerequisite, with original-profile discovery and resume preserved under the maintainer’s accepted launch policy. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main requests native launch before terminal subscription, allowing early output and exit to precede attachment. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? Yes. Moving launch into the existing terminal lifecycle addresses the ordering defect at its owner, and Node isolation addresses Bun PTY handling without changing provider execution contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 64887802d73b. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* fix(terminal): restore native coding CLI starts on Bun Prepare the terminal and subscribe before starting native Codex or Claude Code, retaining early output and exits while preserving rejected or cancelled drafts. Keep tab setup separate from session lifecycle and RPC ownership. Use a Node-owned PTY helper on Bun to preserve ordered input and resize commands, backpressure, and descendant cleanup. Show one primary native launch destination per machine, update availability automatically, and retain original source homes for existing-session resumes. Verified native model replies on isolated Node and Bun Gateways, terminal reconnect, project configuration layering, focused UI/catalog tests, and Linux Bun PTY input, output, backpressure, and cleanup behavior. * refactor(ui): isolate native terminal draft tests Keep native-start regressions in a focused suite with shared attachment fixtures. Centralize the repeated current-repository refresh guard in its existing owner. Preserve startup, destination, and repository-state behavior within file limits. * chore: shrink terminal assertion baseline
What Problem This Solves
Fixes an issue where users starting Codex or Claude Code from New session could receive “Could not attach terminal session” before seeing the CLI's startup output. On Linux and macOS Bun Gateways, the native PTY stream could also close prematurely. The launch form exposed additional Codex history stores as duplicate machine choices and required manual refresh.
Why This Change Was Made
The terminal now initializes and subscribes before requesting a native start, preserving early output, exit details, and cancelled drafts. Bun Gateways use a Node PTY helper with ordered commands, backpressured output, and owned-process cleanup. New Codex starts use one primary native profile per machine; existing-session discovery and resume keep their original homes.
Maintainer compatibility decision: the documented Node prerequisite and primary-only fresh-start policy are intentional parts of this repair. The existing Linux Bun host used for proof already has Node available. Existing local-home discovery and resume retain their original implementation and boundary coverage; no stored-data schema or migration changes are introduced.
User Impact
Native CLI starts open a working terminal or show an actionable failure while retaining the draft. A single destination needs no selector, availability refreshes automatically, and a disconnected selected machine remains visibly unavailable. The working folder controls trusted project settings without switching native accounts. Bun terminals require Node on the Gateway's PATH.
Evidence
.codex/config.tomlreasoning setting while retaining the selected native home.Runtime build, selected changed-code checks (formatting, typechecks, lint, and repository guards), and independent Codex review passed. The final structural cleanup also passed 58 affected unit tests and the focused browser cases.
Before and after screenshots use only a synthetic agent, operator, and workspace.
Both published captures were inspected locally; the review bot's screenshot-fetch failure does not leave the visual changes uninspected.