Leaked OSC 11 background-color reply appears in the TUI input line at launch (Orca terminal, macOS)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Leaked OSC 11 background-color reply appears in the TUI input line at launch (Orca terminal, macOS)
Environment
- jcode:
v0.76.0 (bbef1f6a8) - OS: macOS 15, Apple Silicon
- Terminal: Orca.app's built-in Electron terminal (Orca 1.4.183)
- TERM as seen by jcode: Orca-managed PTY inside the app
What happens
When launching jcode in Orca's terminal, the tail of the terminal's OSC 11
response is parsed as keystrokes and shows up in the input line:
11;rgb:3030/3434/4646
3030/3434/4646 is #303446, Orca's terminal background. It appears right
after whatever I type first, so the first prompt of every session starts with
this junk in the composer (and can be accidentally submitted).
Repro
- Launch
jcodein Orca's terminal pane. - As soon as the TUI is up, the input line contains
11;rgb:3030/3434/4646(or
it gets prepended to the first thing typed). - Reproduces on most launches in Orca; I have not seen it in other terminals.
Analysis
At startup jcode queries the terminal background color for theme detection
(ESC ] 11 ; ?, the jcode-theme-detect path; the binary also contains
osc11-silent-terminals caching and a
"Skipping terminal background query for a terminal without OSC query support"
message). The terminal replies ESC ] 11 ; rgb:.... ST.
In Orca's Electron terminal the reply arrives after jcode has already given up
waiting for it and switched into raw TUI input mode, so the leftover bytes
(the part after ESC ]) are fed to the key handler and typed into the composer.
Two things stand out:
- The late-reply path doesn't seem to be consumed/discarded anywhere, so a slow
answering terminal leaks visible text. A race-free approach would be to keep
a small window where an unsolicited-looking OSC 11 reply is still swallowed,
or to filterESC ] 11 ; rgb:...(plus both ST/BEL terminators) in the input
parser after the query window closes. - The
osc11-silent-terminalscache only helps for terminals that never answer.
Orca does answer, just after the timeout, so the cache never engages and
the leak repeats every launch.
Same class of issue has hit other multiplexers/terminal wrappers (e.g. replies
to OSC 11 echoing as literal text after the requester stopped reading).
Expected
The reply to jcode's own startup query should never surface as user input,
regardless of how late the terminal answers.
Workaround
None found; no flag to skip the background query was visible in jcode --help.
Made with Orca 🐋
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the jcode-theme-detect path, the osc11-silent-terminals cache, and the input parser described in the report. Reproduce the launch in Orca, trace the late OSC 11 response after the query timeout, and verify that both ST and BEL-terminated replies no longer appear as user input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100