Repository navigation
fix(agents): recognize OpenCode native OC | tab titles - #9102
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 7af82a5b387ff2a1b745b8ef8b8ce25bc5cb16be and f220479. 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughAdds native OpenCode terminal-title detection for 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
OpenCode source reviewCloned anomalyco/opencode and checked how titles are actually set. Source of truth: // home
renderer.setTerminalTitle("OpenCode")
// session with default auto title
renderer.setTerminalTitle("OpenCode")
// named session (truncated to 40 chars)
renderer.setTerminalTitle(`OC | ${title}`)
// plugin route
renderer.setTerminalTitle(`OC | ${route.data.id}`)That’s the full terminal-title surface — no other OSC brand formats, no alternate agent-id sequence. Bare Conclusion: No better approach in their codebase than recognizing start-anchored CI fix: dropped the renderer |
OpenCode's native OSC titles use `OC | <task>` without an `opencode` token, so title classifiers left tabs as Claude/unknown. Map the native marker (optional mux prefix) to OpenCode identity in both title classifiers, exclude it from isClaudeAgent, and cover lookalikes plus stale Claude launch reclaim. Builds on and supersedes #8590 (credit @gatsby74). Fixes #8478.
tsconfig.node includes src/shared tests; importing agent-status pulled
renderer modules outside the node project and failed typecheck. Assert
opencode identity via shared title classifiers only (OpenCode TUI sets
"OpenCode" and `OC | ${title}`).
Main's #9104 reads browserCertificateFailuresByPageId in buildMobileBrowserTab but left partial AppState test helpers without the field, breaking PR Checks merge commits. Default the map in fixtures and use optional chaining so partial state cannot throw.
7af82a5 to
f220479
Compare
|
This is still not working. My opencode sessions still displayed as Claude Code |
* fix(agents): recognize OpenCode native OC | tab titles OpenCode's native OSC titles use `OC | <task>` without an `opencode` token, so title classifiers left tabs as Claude/unknown. Map the native marker (optional mux prefix) to OpenCode identity in both title classifiers, exclude it from isClaudeAgent, and cover lookalikes plus stale Claude launch reclaim. Builds on and supersedes stablyai#8590 (credit @gatsby74). Fixes stablyai#8478. * fix(agents): drop renderer import from stablyai#8478 shared repro tsconfig.node includes src/shared tests; importing agent-status pulled renderer modules outside the node project and failed typecheck. Assert opencode identity via shared title classifiers only (OpenCode TUI sets "OpenCode" and `OC | ${title}`). * fix(runtime): fill browser cert failure map in mobile snapshot fixtures Main's stablyai#9104 reads browserCertificateFailuresByPageId in buildMobileBrowserTab but left partial AppState test helpers without the field, breaking PR Checks merge commits. Default the map in fixtures and use optional chaining so partial state cannot throw.
Summary
OpenCode sets OSC titles as
OC | <task>without the tokenopencode. Title classifiers only treated OpenCode as identity when that token appeared, so tabs painted the Claude (or unknown) glyph instead of OpenCode.This wires the existing OpenCode native-title predicate into both agent-label paths so
OC | …(optional single-token mux prefix) resolves to OpenCode before Claude prefixes, Gemini glyphs, or task-text name matches.isClaudeAgentalso rejects native OpenCode titles so braille inside the session text cannot rebrand the pane as Claude.Credit: Takes over / builds on #8590 by @gatsby74 (same core idea: start-anchored
OC |identity + early classifier priority + stale Claude launch reclaim). Improvements on main: consolidate with existingopencode-terminal-title.ts(avoid a parallel regex inagent-title-core), keep flexibleOC|sessionspacing already used for display preservation, exclude native OC from bothisClaudeAgentcopies, and add adversarial multi-agent coverage + flipped #8478 repro regression.Fixes #8478.
Supersedes #8590.
Description
isOpenCodeNativeTitle/isMeaningfulOpenCodeTerminalTitleto share one start-anchored matcher: optionalmux |prefix + case-sensitiveOC+ non-empty session text.getAgentLabelin bothagent-title-identity.tsandterminal-title-agent-type.ts.isClaudeAgentsoOC | ⠋ …is not Claude.agent-detection.Evidence
docs/bug-reproductions/8478.md/src/shared/repro-8478-opencode-native-title-icon.test.tsonnwparker/bug-repro-handoffs) proved pre-fix:resolveTerminalTitleAgentType('OC | Understand about the plugin') !== 'opencode'.OC | Understand about the plugin→ OpenCode glyph.ELI5
OpenCode shortens its terminal title to something like
OC | fix the bug. Orca only looked for the word “opencode”, so it thought the tab was Claude and showed the wrong logo. Now Orca understands the shortOC | …form and shows the OpenCode logo.User-regression-tradeoffs
OC |or theopencodetoken still follow the Claude spinner heuristic ([Bug] opencode is displayed as Claude Code #8940 family) — not solved here.OC | …(optional single-token mux prefix) matches. Lowercaseoc |, mid-title… | OC | …, multi-word prefixes, and bareOC |are rejected. Claude/Codex/Gemini/Cursor/Pi explicit titles unchanged in adversarial tests.Screenshots
Before: issue screenshot — Claude glyph on an OpenCode tab.
After: No new assets in this PR; icon path is unit-tested via
resolveTerminalTitleAgentType→agentTypeToIconAgent→opencode. Manual UI probe documented in #8590.Testing
oxlinton changed files (0 issues; pre-commit hook)pnpm lint/pnpm typecheck/pnpm test/pnpm build(not run end-to-end in this session; CI should cover)OC|session, lowercase/embedded rejection, Gemini-glyph-inside-OC, other-agent identity, stale Claude launch reclaim, [Bug]: OpenCode logo is not coming up well #8478 repro flipAI Review Report
Compared #8590 vs main and the #8478 repro kit.
Risks checked
⠋ Fix foo | OC | bar) — rejected by start anchor.OC | Compare Codex and Claude,OC | ✦ Gemini CLI) — native marker wins before Gemini glyphs and Claude prefixes.getAgentLabel/isClaudeAgentcopies drifting — both updated.opencode-terminal-title.ts— consolidated so display preservation and identity share one matcher (also keeps flexibleOC|sessionspacing fix(agents): recognize OpenCode native tab titles #8590’s rigidOC |would miss).Not fixed here: #8940 braille OpenCode frames without native marker.
Security Audit
OSC titles are untrusted input. Handling is a fixed non-backtracking regex → existing enum/label. No HTML render of title content, no command execution, path resolve, IPC/auth boundary, credentials, new deps, or secrets. No follow-up security work needed.
Notes