Repository navigation
fix(terminal): contain plain-shell startup color replies - #16123
brennanb2025 wants to merge 3 commits into
Conversation
Co-authored-by: tin <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe change removes agent-based gating from startup OSC color reply normalization. It adds PTY and line-editor sources to echo projections, supports zsh line-editor variants, and tracks projections until all matches are consumed. It preserves armed POSIX query authority during Merge Risk: 🔵 Low · up to Plain terminal panes can now answer startup color queries using validated, pane-local data within a bounded handoff window. The change is mergeable with owner awareness because the PTY creation path does not clearly document or validate which callers are trusted to request this behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Linked Issues checkExplanation The changes address startup color reply handling, POSIX authority retention, and PTY or line-editor echo suppression for issue Full details: Out of Scope Changes checkExplanation The production changes and regression tests remain focused on plain-shell startup color replies, POSIX startup authority, echo containment, and related test support. No unrelated code changes are evident. Full details: Description checkExplanation The description is detailed and covers the problem, user impact, implementation, linked issue, visual proof, and verification results. It does not reproduce every template heading or checklist item, but the required information is mostly present.
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Heads-up: this PR and #16542 are rewriting the same functionFlagging before either merges, because whichever lands second will silently undo the other. Both change
The two are complementary in intent and conflicting in text. Specifically:
Suggested order: land this one first (it is a narrow correction to two existing shapes, plus tests), then rebase #16123 on top. #16123's restructuring absorbs a corrected pair cleanly; the reverse means re-deriving the corrections inside a changed shape of the function. One thing worth carrying across either way: #16123's zsh shapes are BEL-initial, same as the readline needle here. This PR adds a minimum-length floor and requires a non-empty DSR parameter list, because Context for why this matters more than usual here: Full detail in #16542. |
#16542 has merged — this will need a rebase, and there's one thing worth carrying acrossSorry for the collision. #16542 ( What changed under you Both shapes this branch preserves were wrong against a real tty:
Both were captured from a live pty rather than read off the spec, and there's now a The bit worth carrying across Your two ZLE shapes are BEL-initial, same as the readline needle. #16542 added a minimum-length floor plus a non-empty-parameter requirement on the DSR grammar, because the containment grammar admits If Also relevant to your I tried to verify the ConPTY branch on a real Windows host — node-pty with Your zsh work covers a gap #16542 explicitly left open, so this is a rebase request, not a suggestion to drop anything. Happy to do the rebase myself if that's easier. |
# Conflicts: # src/shared/pty-startup-reply-echo-shapes.ts
session.test.ts crossed the 800-line cap once this branch's startup-authority case merged with main's additions. Split rather than raise the limit.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Closing as superseded: a merged PR already covers this change. #23925 (59ef748): the PTY owner answers OSC 10/11 for every PTY (not only agents) for its whole life and strips the query, which removes the plain-shell reply leak this PR (Stale-PR cleanup 2026-10-20, approved by Brennan. Reopen if something here is still missing on main.) |
ELI5
Fancy shell prompts (Oh My Posh, starship, powerlevel10k) start by asking the terminal "what colours
are you using?" The terminal is supposed to answer privately, out of sight. In plain (non-agent)
Orca terminals nobody answered properly, so the raw reply leaked onto your screen — every new
terminal opened with junk sitting next to your prompt:
Orca already knew how to intercept that question and answer it quietly, but only did so for agent
panes. Now plain panes get the same treatment, and the leftover echo the shell's own line editor
produces is swallowed too.
User-facing before / after
When it bites
macOS and Linux users whose shell prompt theme asks the terminal for its colour scheme at startup —
Oh My Posh, starship and powerlevel10k all do. It showed up at the very first prompt of every plain
terminal, which is the first thing you see.
Summary
Supersedes #14307
Verification
10;rgb/11;rgbfailure; restoring it passed.pnpm vitest run --config config/vitest.config.ts src/shared/pty-startup-ingress.test.ts src/main/daemon/session.test.ts src/main/ipc/pty-dispatcher-handshake-osc-answers.test.ts— 106 passed.pnpm typecheck— passed.FIXTURE%prompt with no color reply text.openclawfocused POSIX ingress and daemon suites — 97 passed.pnpm testcompleted with 13 unrelated failures: 12 deterministic failures persisted with the touched startup policy restored toorigin/main, and one performance budget test measured 185 ms against a 150 ms threshold.Visual proof
Fixes #14306
STA-4145