Skip to content

fix(renderer): answer OSC color queries from active terminal theme - #6502

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
siddqamar:fix/6091-codex-input-bg
Jun 27, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
siddqamar:fix/6091-codex-input-bg

Conversation

@siddqamar

Copy link
Copy Markdown
Contributor

Summary

Codex TUI color detection now receives Orca's active terminal foreground/background colors for OSC 10/11 queries. This prevents Codex from falling back to an incorrect/default dark background for the input area when Orca is using a light terminal theme on Windows.

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Ran:

  • .\node_modules\.bin\vitest.cmd run src/renderer/src/components/terminal-pane/terminal-capability-replies.test.ts
  • .\node_modules\.bin\oxlint.cmd src/renderer/src/components/terminal-pane/terminal-capability-replies.ts src/renderer/src/components/terminal-pane/terminal-capability-replies.test.ts

AI Review Report

Reviewed the terminal color-query path used by TUIs such as Codex. The fix keeps the change scoped to Orca's existing terminal capability reply handler, answers only OSC 10/11 foreground/background queries, and preserves replay suppression so restored scrollback cannot leak terminal replies into a fresh shell.

Cross-platform review: this does not add platform-specific shortcuts, labels, paths, shell assumptions, or Electron platform branches. The behavior is renderer/xterm based and applies consistently across macOS, Linux, Windows, local terminals, and SSH/remote panes.

Security Audit

Reviewed input handling around terminal escape sequences. The handler only responds to exact OSC color queries (?) and only sends theme-derived color replies back through the existing PTY input path. It does not introduce command execution, filesystem/path handling, dependency changes, auth/secrets handling, or new IPC surfaces.

Notes

This is targeted at the Codex input background issue reported on Windows light theme, but the fix is provider-neutral for TUIs that query terminal foreground/background colors through OSC 10/11. Fixes #6091.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

TerminalCapabilityRepliesDeps now requires terminal.options and parser.registerOscHandler. New helpers detect OSC color-query payloads and convert CSS hex and rgb()/rgba() color strings into OSC rgb:RR/GG/BB format. installTerminalCapabilityReplyHandlers adds OSC handlers for IDs 10 and 11 that reply to foreground/background theme color queries and skip replayed input. Tests cover query handling, non-query behavior, replay suppression, and end-to-end PTY replies.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly states the main change: answering OSC color queries from the active terminal theme.
Description check ✅ Passed The description includes the required sections and sufficiently covers the change, testing, review, security, screenshots, and notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-capability-replies.ts (1)

142-168: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document why replayed OSC color queries are consumed.

The isReplaying() early returns are non-obvious behavior, just like the DA1 branch above. Please add a short Why: comment here too so this doesn't get “simplified” later and reintroduce reply leakage into a fresh shell.

As per coding guidelines, “When writing or modifying code driven by a design doc or non-obvious constraint, add a comment explaining why the code behaves the way it does.”

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3a0c191e-1e27-4546-b0b8-42d73434eb8f

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce184c and 2ea2485.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/terminal-capability-replies.test.ts
  • src/renderer/src/components/terminal-pane/terminal-capability-replies.ts

@Jinwoo-H Jinwoo-H left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the targeted fix. I added coverage for the renderer OSC 10/11 path:

  • accepts active theme foreground/background replies, including rgba/rgb forms
  • keeps replay suppression for restored terminal bytes
  • verifies in Electron that injected OSC color queries write replies back to the active PTY

Local validation passed: typecheck, lint, focused unit test, and focused Electron E2E.

@Jinwoo-H
Jinwoo-H merged commit 867c57b into stablyai:main Jun 27, 2026
siddqamar and others added 2 commits June 27, 2026 20:35
- reply to OSC 10/11 foreground/background queries using the resolved xterm theme

- suppress replayed OSC color replies to avoid leaking escape output into fresh shells

- cover theme-derived color replies and replay suppression with focused tests
@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for reporting. looking into it

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#6502)

* fix(renderer): answer OSC color queries from active terminal theme

- reply to OSC 10/11 foreground/background queries using the resolved xterm theme

- suppress replayed OSC color replies to avoid leaking escape output into fresh shells

- cover theme-derived color replies and replay suppression with focused tests

* test(renderer): cover terminal OSC color query replies

Co-authored-by: Orca <[email protected]>

---------

Co-authored-by: Jinwoo-H <[email protected]>
Co-authored-by: Orca <[email protected]>
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.

[Bug]: Codex TUI input area renders with black background only in Orca terminal on Windows light theme

4 participants