Repository navigation
Conversation
📝 WalkthroughWalkthroughAdded 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9b1020ce-9bf8-48be-9a61-2b2c2513e144
📒 Files selected for processing (6)
src/renderer/src/lib/use-tab-agent.test.tssrc/shared/agent-detection.tssrc/shared/agent-title-core.tssrc/shared/agent-title-identity.tssrc/shared/terminal-title-agent-type.test.tssrc/shared/terminal-title-agent-type.ts
|
Taking over / superseding this PR with #9102 (same fix direction, rebased on current main). Credit @gatsby74 — core approach kept: start-anchored native Deltas on top of this PR:
Please close this PR if you’re good with the takeover — happy to adjust if you prefer co-authoring on #9102 instead. |
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.
* 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 #8590 (credit @gatsby74). Fixes #8478. * fix(agents): drop renderer import from #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 #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.
* 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
OC | …terminal-title format as OpenCode identityFixes #8478.
Screenshots
Before: issue screenshot shows the Claude glyph on an OpenCode tab.
After: manually verified in the macOS dev build by emitting OpenCode's native
OC | Understand about the pluginOSC title into a terminal with no launch or process identity; the tab rendered the existing OpenCode glyph.Testing
pnpm lintpnpm typecheckpnpm test(29,168 passed, 40 skipped)pnpm buildAI Review Report
Reviewed the title-classification and tab-agent precedence paths. CodeRabbit flagged an unanchored false-positive case and native-title precedence when task text names another agent; both were fixed with a start-anchored matcher, negative coverage, and early native-marker resolution in both title classifiers. The matcher is limited to OpenCode's exact uppercase
OC | …native marker with an optional single-token multiplexer prefix, so ordinary task text and other agents retain their existing classification. The change performs one bounded regex check per terminal-title classification and does not add polling or hot-path allocation beyond the existing title parse.Cross-platform review covered macOS, Linux, and Windows. The change is platform-neutral and does not touch shortcuts, shortcut labels, paths, shell quoting, or Electron platform branches. SSH/remote behavior was checked explicitly: multiplexer-prefixed titles are covered, and title evidence remains available where local foreground-process probing is intentionally disabled. Existing Claude, Codex, Pi/OMP, Cursor, Gemini, and custom-agent precedence is unchanged. UI review confirmed that this reuses the existing OpenCode glyph without layout, color, spacing, or theme changes.
Security Audit
Terminal OSC titles are untrusted input. The new handling only applies a fixed, non-backtracking regular expression and maps a match to an existing enum value. It does not render title content as HTML, execute commands, resolve paths, cross IPC/auth boundaries, access credentials, add dependencies, or expose secrets. No follow-up security work is needed.
Notes
Validated on macOS with OpenCode 1.17.19 and a direct native-title probe. The parsing fix is shared by local, SSH, WSL, and mirrored title consumers.