Skip to content

fix(pty): arm PtyStartupIngress for non-agent panes to suppress OSC 10/11 reply echo on POSIX - #14307

Closed
tinhien11 wants to merge 3 commits into
stablyai:mainfrom
tinhien11:fix/non-agent-pane-osc-color-reply-leak
Closed

tinhien11 wants to merge 3 commits into
stablyai:mainfrom
tinhien11:fix/non-agent-pane-osc-color-reply-leak

Conversation

@tinhien11

Copy link
Copy Markdown

Summary

  • Non-agent terminal panes (plain shells with prompt themes like Oh My Posh, starship, powerlevel10k) leak OSC 10/11 color query reply echoes as visible text on POSIX (macOS + Linux/Ubuntu)
  • The fix for [Bug]: Raw OSC 10/11 color-query replies leak as text in Linux agent pane (opencode) #12112 only armed PtyStartupIngress for agent panes; this extends it to all panes by falling back to getTerminalViewColorQueryReplyColors() (the terminal view-attribute store) when getStartupTerminalColorQueryReplyColors() returns null for non-agent panes
  • This is the same pattern already used in orca-runtime.ts for the daemon/remote path: launchOpts.terminalColorQueryReplies ?? getTerminalViewColorQueryReplyColors()

Root cause

  1. Prompt theme (OMP) sends OSC 10;? / OSC 11;? during startup
  2. For non-agent panes, PtyStartupIngress is not armed, so the query reaches the renderer's xterm
  3. Renderer answers via sendInputImmediate — reply goes back to the PTY
  4. PTY is still in cooked mode (prompt theme hasn't entered raw mode yet)
  5. Readline echoes the reply as visible text: 10;rgb:ffff/ffff/ffff11;rgb:2828/2c2c/3434

Changes

  • src/main/ipc/pty.ts: Added ?? getTerminalViewColorQueryReplyColors() fallback at both local (line ~4822) and daemon (line ~6269) spawn paths
  • src/renderer/src/components/terminal-pane/issue-non-agent-pane-startup-color-reply-leak.repro.test.ts: New repro test verifying echo suppression with view-attribute colors on POSIX

Test plan

  • New repro test passes (3 tests: ingress suppresses echo, coalesced echo, baseline without ingress)
  • Existing pty-startup-ingress.test.ts — 42 tests pass
  • Existing pty-startup-ingress-live-query-reply.test.ts — 10 tests pass
  • Existing issue-12112-agent-pane-startup-color-reply-leak.repro.test.ts — 4 tests pass
  • Existing terminal-capability-replies.test.ts — 14 tests pass
  • oxlint clean (0 warnings, 0 errors)

Fixes #14306

…0/11 reply echo on POSIX

Non-agent panes (plain shells with prompt themes like Oh My Posh) also emit
OSC 10;? / 11;? during startup. Without PtyStartupIngress, the renderer
answers the query and the cooked-mode echo leaks as visible text:
"10;rgb:ffff/ffff/ffff11;rgb:2828/2c2c/3434".

The fix for stablyai#12112 only armed PtyStartupIngress for agent panes. This extends
it to all panes by falling back to getTerminalViewColorQueryReplyColors()
(the terminal view-attribute store) when getStartupTerminalColorQueryReplyColors()
returns null for non-agent panes — the same pattern already used in
orca-runtime.ts for the daemon/remote path.

Fixes stablyai#14306
@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

PTY startup paths now use terminal-view colors when request-specific startup colors are unavailable. Regression tests cover OSC 10/11 replies, cooked-mode echo suppression, coalesced shell prompt output, and renderer-only reply leakage. Spanish, Japanese, Korean, and Chinese locales now include caffeinate status and agent-awake settings translations.

Merge Risk: 🔵 Low · up to 6c038

The change is mergeable, with a minor Korean-language follow-up: three agent-related labels remain in English, causing a limited localization inconsistency without functional impact.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the bug, fix, linked issue, and tests, but omits multiple required template sections, including Visual Proof, Review, Checklist, and Author. Add the required template sections and content, including ELI5, Visual Proof or N/A with reason, Testing checklist, Review, Checklist, AI Disclosure, and Author.
Out of Scope Changes check ⚠️ Warning The Spanish, Japanese, Korean, and Chinese locale changes for CaffeinateStatusSegment are unrelated to the linked OSC 10/11 PTY fix. Remove the unrelated localization changes or move them to a separate PR with appropriate issue scope.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the PtyStartupIngress fix and OSC 10/11 echo suppression for non-agent POSIX panes.
Linked Issues check ✅ Passed The changes implement the required fallback in both local and daemon spawn paths and add regression coverage for POSIX echo suppression.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0efc38be-0009-4bec-87ed-b797efa9a5bd

📥 Commits

Reviewing files that changed from the base of the PR and between e7b8526 and 9d26a6b.

📒 Files selected for processing (2)
  • src/main/ipc/pty.ts
  • src/renderer/src/components/terminal-pane/issue-non-agent-pane-startup-color-reply-leak.repro.test.ts

…eply leak test

Address CodeRabbit review: guard against ingress dropping the whole
coalesced chunk by asserting the prompt text survives suppression.
@tinhien11

Copy link
Copy Markdown
Author

Addressed in 4b9df55: added expect(emitted.join('')).toContain('❭ ') to guard against ingress dropping the whole coalesced chunk — the prompt must remain visible, not just the reply text absent.

Add 13 missing i18n keys per locale (52 total) for the keep-awake corner
chip and settings panel. Previously these showed English fallback text
on Chinese, Japanese, Korean, and Spanish UIs.

CaffeinateStatusSegment (10 keys): on/auto/off/active/inactive labels,
ariaLabel, title, and mode descriptions.
agent-awake-copy (3 keys): modeTitle, modeDescriptionWindows,
modeDescriptionDefault.

ja uses "Agent" (Latin) per codebase convention enforced by
locale-phrase-fixes policy.

Closes stablyai#14490

@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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d46744fe-1598-492f-b581-2f5cb28d0117

📥 Commits

Reviewing files that changed from the base of the PR and between 4b9df55 and 6c038de.

📒 Files selected for processing (4)
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.

"e5995ce268": "agents 작업 중 컴퓨터를 깨어 있게 유지",
"95d3031db2": "agents가 작업하는 동안 이 컴퓨터와 디스플레이를 깨어 있게 유지합니다. 뚜껑을 닫을 때의 동작은 이 기기의 전원 설정을 따릅니다.",
"a42f6fbdd8": "agents가 작업하는 동안 이 컴퓨터와 디스플레이를 깨어 있게 유지합니다. Orca는 전원 정책에 따라 뚜껑이 닫혀 있을 때도 이 기기를 깨어 있게 유지하도록 요청합니다."
"a42f6fbdd8": "agents가 작업하는 동안 이 컴퓨터와 디스플레이를 깨어 있게 유지합니다. Orca는 전원 정책에 따라 뚜껑이 닫혀 있을 때도 이 기기를 깨어 있게 유지하도록 요청합니다.",

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- target locale entries ---'
sed -n '3505,3530p;9128,9145p' src/renderer/src/i18n/locales/ko.json
printf '%s\n' '--- English counterparts and nearby keys ---'
rg -n -C 2 '"a42f6fbdd8"|CaffeinateStatusSegment|agent.awake|agents' src/renderer/src/i18n/locales/en.json src/renderer/src/i18n/locales/ko.json
printf '%s\n' '--- product terminology in Korean locale ---'
rg -n '"[^"]*(에이전트|agents)[^"]*"' src/renderer/src/i18n/locales/ko.json | head -80

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
python3 - <<'PY'
import json
from pathlib import Path

en = json.loads(Path("src/renderer/src/i18n/locales/en.json").read_text())
ko = json.loads(Path("src/renderer/src/i18n/locales/ko.json").read_text())

def get(obj):
    for part in ("settings", "agent-awake-copy"):
        obj = obj[part]
    return obj

for key, source in get(en).items():
    translated = get(ko).get(key)
    if "agent" in source.lower() or "agents" in source.lower() or "agents" in str(translated).lower():
        print(f"{key}: en={source!r} | ko={translated!r}")
PY
nl -ba src/renderer/src/i18n/locales/ko.json | sed -n '9130,9145p'

Repository: stablyai/orca

Length of output: 324


🏁 Script executed:

#!/bin/bash
python3 - <<'PY'
import json
from pathlib import Path

def find_key(value, target, path=()):
    if isinstance(value, dict):
        for key, child in value.items():
            if key == target:
                yield path + (key,), child
            yield from find_key(child, target, path + (key,))
    elif isinstance(value, list):
        for i, child in enumerate(value):
            yield from find_key(child, target, path + (str(i),))

for locale in ("en", "ko"):
    data = json.loads(Path(f"src/renderer/src/i18n/locales/{locale}.json").read_text())
    matches = list(find_key(data, "agent-awake-copy"))
    print(f"{locale}: {len(matches)} match(es)")
    for path, block in matches:
        print("path:", ".".join(path))
        for key, value in block.items():
            print(f"  {key}: {value!r}")

lines = Path("src/renderer/src/i18n/locales/ko.json").read_text().splitlines()
for i, line in enumerate(lines, 1):
    if '"agent-awake-copy"' in line or '"e5995ce268"' in line or '"95d3031db2"' in line or '"a42f6fbdd8"' in line:
        print(f"{i}: {line}")
PY

Repository: stablyai/orca

Length of output: 1889


Translate all generic agent references in agent-awake-copy.

Change agents to 에이전트 in e5995ce268, and change agents가 to 에이전트가 in 95d3031db2 and a42f6fbdd8.

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.

OSC 10/11 color query reply echoes as visible text in non-agent panes on POSIX (macOS + Linux)

4 participants