Repository navigation
fix(tabs): trust native OpenCode titles without hook signals - #11382
Conversation
Greptile SummaryThis PR closes the remaining integration gap for native OpenCode tab identity. When a tab carries a stale Claude
Confidence Score: 5/5Safe to merge — the change is limited to title-classification logic in a pure function and is thoroughly covered by 96 tests, including a new dedicated test file for every edge case introduced. The two functional changes are tightly scoped: the nativeOpenCodeTitle short-circuit fires only for the exact OC | … format via an already-tested regex, and the sleepingSessionAgent suppression of titleAgent is deliberately consistent with the upgraded durable ownership semantics. No hook lifecycle, PTY management, shell detection, or IPC paths are touched. The one test whose expectation flipped correctly tracks the intentional behavior change. Files Needing Attention: No files require special attention. The sleeping-session test expectation flip is the most semantically significant change and is already well-documented by the renamed test description.
|
| Filename | Overview |
|---|---|
| src/renderer/src/lib/use-tab-agent.ts | Core logic change: adds nativeOpenCodeTitle flag that lets native OC |
| src/renderer/src/lib/use-tab-agent-opencode-native-title.test.ts | New test file with 8 focused scenarios covering the native OpenCode title path: live local, inactive split, SSH/tmux, stale persisted tab, sleeping-session durable ownership, completed-hook precedence, and lookalike rejection. |
| src/renderer/src/lib/use-tab-agent-sleeping-session.test.ts | One test expectation flipped from 'claude' to 'gemini' to reflect the new behavior where a sleeping session suppresses title-based identity reclaims. |
| src/renderer/src/lib/use-tab-agent.test.ts | One fixture changed from hasObservedAgentSignal: true to false to correctly validate the new no-signal reclaim path for native OpenCode titles. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[resolveTabAgentFromSignals] --> B{liveFocusedIdentity?}
B -- yes --> Z[return liveFocusedIdentity]
B -- no --> C{processAgent?}
C -- yes --> Z2[return processAgent]
C -- no --> D[Compute titleAgent]
D --> D1{processProvesShell OR sleepingSessionAgent OR nativeOCTitle AND idleFocusedIdentity?}
D1 -- yes --> D2[titleAgent = null]
D1 -- no --> D3{titleReclaimsReusedPane?}
D3 -- yes --> D4[titleAgent = explicitTitleAgent]
D3 -- no --> D5{priorIdentity?}
D5 -- yes --> D6[titleAgent = null]
D5 -- no --> D7[titleAgent = explicitTitleAgent]
D2 & D4 & D6 & D7 --> E{titleAgent?}
E -- yes --> Z3[return titleAgent]
E -- no --> F{idleFocusedIdentity?}
F -- yes --> Z4[return idleFocusedIdentity]
F -- no --> G{sleepingSessionAgent?}
G -- yes --> Z5[return sleepingSessionAgent]
G -- no --> H{activeLaunchAgent?}
H -- yes --> Z6[return activeLaunchAgent]
H -- no --> I[return sibling identity]
Reviews (2): Last reviewed commit: "fix(tabs): preserve completed hook autho..." | Re-trigger Greptile
📝 WalkthroughWalkthroughOpenCode-native title detection is now included in tab-agent identity resolution. The resolver can identify 🚥 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 |
05393a0 to
76c8e64
Compare
…i#11382) * fix(tabs): trust native OpenCode titles * test(tabs): cover native OpenCode identity authority * fix(tabs): preserve sleeping provider identity * fix(tabs): preserve completed hook authority --------- Co-authored-by: OrcaWin <[email protected]>
Summary
This closes the remaining integration gap after #9102.
Fixes #11329
Screenshots
No visual layout change. The visible result is that the existing OpenCode icon replaces the incorrect Claude icon for affected tabs.
Testing
Focused checks:
AI Review Report
Reviewed the title, launch metadata, hook, process, sleeping-session, split-pane, and remote precedence chain. Greptile rated the change 5/5 and CodeRabbit generated no actionable code comments. Cross-platform review confirmed the change is title-classification only and does not alter shortcuts, paths, shells, or Electron platform branches on macOS, Linux, or Windows.
Security Audit
No command execution, path handling, IPC, auth, secrets, dependencies, or persisted data changed. The native title matcher already existed; this PR only uses its exact high-confidence result in the identity resolver.
Notes
The exact native OpenCode marker is the only new no-hook override. Ordinary conflicting titles still wait for observed activity, preserving the existing launch-window anti-flicker behavior.