Skip to content

fix(agents): preserve OpenCode identity for bare status titles - #9135

Closed
kin001 wants to merge 2 commits into
stablyai:mainfrom
kin001:fix/issue-8940-opencode-identity
Closed

kin001 wants to merge 2 commits into
stablyai:mainfrom
kin001:fix/issue-8940-opencode-identity

Conversation

@kin001

@kin001 kin001 commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve a proven single-pane agent owner when the sidebar receives a provider-neutral braille/task title.
  • Keep OpenCode rows stable across native OC | ..., synthetic, bare task, and idle title frames.
  • Keep explicit Claude detection, unknown-shell behavior, and split-pane isolation unchanged.

Fixes #8940.

ELI5

OpenCode can publish a spinner title that says what it is doing without saying "OpenCode." The sidebar used to treat that title shape as Claude activity and forget the pane's known owner. It now keeps the known single-pane owner while still using the title for working/idle state.

User Regression Tradeoffs

  • Bare spinner titles still do not create an agent identity when Orca has no owner evidence.
  • Explicitly named Claude titles still resolve as Claude.
  • Tab-scoped launch identity is not applied to split panes, so one pane cannot label a sibling.

Screenshots

No visual change.

Testing

  • pnpm lint - full lint reaches two pre-existing switch-exhaustiveness errors on upstream/main in native-chat-session-option-labels.ts:47 and skill-freshness-group.tsx:101; changed-file oxlint and oxfmt pass.
  • pnpm typecheck
  • pnpm test - the full Windows run completed with 2,879 files / 30,670 tests passing, then reported 44 files / 135 tests failing in unrelated Windows/POSIX path, symlink, shell, WSL, PTY, and source-newline suites. Focused identity coverage passes: 7 files / 113 tests.
  • pnpm build
  • Added regression coverage for the real title sequence, launch/hook/process owners, reset behavior, explicit Claude identity, unknown shells, and split-pane isolation.

Focused command:

pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts src/renderer/src/components/sidebar/useWorktreeAgentRows.test.ts src/renderer/src/lib/use-tab-agent.test.ts src/renderer/src/lib/use-tab-agent-pi-identity.test.ts src/shared/terminal-title-agent-type.test.ts src/shared/opencode-terminal-title.test.ts src/shared/repro-8478-opencode-native-title-icon.test.ts

AI Review Report

The change was independently reviewed after implementation for identity precedence, stale-owner clearing, split-pane leakage, cross-platform behavior, remote behavior, and regressions across supported agents.

  • Correctness: explicit hook/status rows remain authoritative. The title-derived fallback uses launch ownership only for a layout proven to contain one leaf, and only generic Claude-shaped activity claims are re-owned.
  • Cross-platform: no shortcuts, labels, paths, shell commands, native APIs, or Electron platform branches changed. The pure title/layout logic is identical on macOS, Linux, and Windows.
  • SSH/remote/local: no PTY transport or host assumptions changed. Remote hook/process tab identity is pinned by the same resolver tests; sidebar launch ownership remains scoped to a proven single pane.
  • Agents and integrations: global Claude spinner inference remains intact. Explicit Claude, OpenCode native titles, Pi/OMP compatibility, Codex launch identity, unknown terminals, and split siblings were checked.
  • Performance: one constant-time owner resolution is added per title-derived single pane; no new subscriptions, probes, filesystem access, or network calls are introduced.
  • UI quality: no layout or styling changed; only the existing agent icon/row identity becomes stable.

CodeRabbit found one owner-aware fallback call site that had not received the new owner argument. Commit 67c4f0714 corrected it and added direct regression coverage for owner-present, owner-absent, and explicit-Claude cases.

Security Audit

No input execution, command construction, filesystem path handling, IPC, authentication, secret, dependency, or network surface is introduced. Terminal titles remain untrusted display/status input and are only mapped to an existing enum; the change does not execute or persist title content beyond the existing row model.

Notes

  • This builds on fix(agents): recognize OpenCode native OC | tab titles #9102, which recognizes explicit native OC | ... titles; this PR covers later provider-neutral frames without weakening global Claude heuristics.
  • Residual limitation: a manually typed, hookless OpenCode session with no launch/process identity remains neutral rather than being guessed from a bare spinner.
  • X handle: not provided.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


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

Run ID: 5dd1874b-99d3-4632-a62c-c54284e0d8e7

📥 Commits

Reviewing files that changed from the base of the PR and between 1b331f2 and 40e2314.

📒 Files selected for processing (3)
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.test.ts
  • src/renderer/src/components/sidebar/worktree-title-derived-agent-rows.ts
  • src/renderer/src/lib/use-tab-agent.test.ts

@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

@nwparker

Copy link
Copy Markdown
Contributor

Closing as superseded by merged #12466. That PR fixes #8940 in the same title-resolution and sidebar-row paths by making OpenCode’s known owner outrank incidental Claude text, and includes regression coverage for provider-neutral/OpenCode status frames mentioning Claude. The current main tests keep OpenCode identity across those status frames, so this branch no longer carries unique work.

@nwparker nwparker closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] opencode is displayed as Claude Code

3 participants