Skip to content

fix(terminal): relay default foreground and background color queries - #1414

Closed
harryisfish wants to merge 1 commit into
mobile-shell:masterfrom
harryisfish:fix/osc-default-color-queries
Closed

harryisfish wants to merge 1 commit into
mobile-shell:masterfrom
harryisfish:fix/osc-default-color-queries

Conversation

@harryisfish

Copy link
Copy Markdown

Why

OSC 10/11 default-color queries are currently ignored. Applications such as OpenAI Codex use these replies to choose their theme; without them, Codex removes the input background and renders its startup animation with a reduced palette. Native SSH renders those elements correctly.

Relay exact read-only queries to the local terminal and return its replies through the existing user input channel. No colors are guessed or set.

Scope

Record separate foreground/background query generations in the framebuffer, synchronize their absolute values through an optional protobuf extension, and emit OSC 10/11 only in the actual client display. ANSI state serialization does not emit queries.

Blast Radius

Both client and server need this patch. Older peers ignore the extension and retain their current behavior. Multiple requests of the same kind within a display update are coalesced; pending requests can arrive after reconnect. This does not implement color setters or general OSC passthrough.

Verification

  • macOS build with Nettle succeeds.
  • A real loopback mosh-server/mosh-client pair with a PTY terminal responder fails to relay either query on stock 1.4.0; the patched pair relays both and returns both RGB replies to the remote process.
  • Focused state checks pass for BEL/ST terminators, initial snapshots, repeated diffs, redraws, reset, and unrelated OSC sequences.
  • Independent code review found no blockers. Codex visual parity in a real terminal has not yet been verified.

Related: #1145, #1351, #1333.

Forward OSC 10/11 read-only queries through synchronized query generations.
Return terminal replies through the existing user input channel so TUIs
can detect the local terminal palette without hardcoded colors.
@achernya

achernya commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

We are not accepting LLM contributions at this time

@achernya achernya closed this Oct 5, 2026
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.

2 participants