Repository navigation
[Bug]: With multiple opencode TUIs running, agent state/prompt/spinner/notifications are attributed to the wrong worktree card #24844
Description
Environment
- Orca desktop + CLI: 1.4.217 (Windows 10, 10.0.19045), local host
- Agents: opencode TUI, two instances running at the same time in different worktrees (plus a few idle ones in other projects)
- Observed: 2026-10-02, ~16:00–16:35 local
Summary
With two or more opencode TUI sessions running in different worktrees, Orca attributes the working state, the typed prompt, the card spinner and the "… now" activity line of the active session to another worktree's card. orca worktree ps reports the state/prompt of session A under session B's worktree, while B's terminal actually shows B's own long-finished turn. Sidebar marks/notifications therefore keep landing on projects where nothing is running.
Reproduction (captured live today)
Setup:
- Worktree A:
D:\Projects\VibeCoding\popizdelki(repo1b7e9cde…), terminal titledOC | Возможности MCP hapy. Session A is an opencode TUI actively processing turns (Plan mode,glm-5.3-flash). - Worktree B:
D:/Projects/Hybrid/panelapps_core/.agents/worktree/CON-12617-lookalike-host(repoac4a408b…), terminal titledOC | Изучение спеки в openspec. Session B is an opencode TUI whose last turn finished minutes earlier (its screen showsBuild · glm-5.3 · 3m 19sand an old answer about a LAL audience E2E).
Steps:
- Keep both opencode TUIs open in their worktree terminals.
- In session A (worktree A), send a new prompt (e.g.
Поставь, но что то я ничего не понял…). - While A is working, run
orca worktree ps --json.
Actual result — worktree ps lists under worktree B:
"repo": "panelapps_core",
"displayName": "feature/7.0/CON-12617-lookalike-host",
"agents": [{
"agentType": "opencode",
"state": "working",
"prompt": "Поставь, но что то я ничего не понял, я запустил новый тер…",
"lastAssistantMessage": null
}]…i.e. session A's fresh prompt and working state are attributed to worktree B, while:
orca terminal readof B's PTY shows B's own old, finished conversation (no input box text matching that prompt);orca terminal readof A's PTY shows session A's TUI actively rendering that very turn;orca worktree currentrun from session A's shell resolves worktree A correctly (cwd-based), contradictingps.
The sidebar mirrors the wrong attribution: the spinner and the "… now" activity line appear on B's card, A's card shows nothing. The user sees "work" happening in an unrelated project. The auto-title of B's terminal also flipped from OC | Изучение спеки в openspec to Terminal 2 during the same observation window, so the detection seems to flip-flop rather than being pinned to a pane.
Secondary observation from the same session: the sortOrder of all 20 registered worktrees (including inactive ones with zero live terminals) was re-stamped inside one ~19 s window at exactly 1000 ms increments, uncorrelated with any real activity — consistent with presence/activity state being recomputed from a shared, misattributed source rather than per pane.
Expected
Agent presence (working/done, prompt text, spinner, activity lines, notifications) is tracked per terminal pane and attributed to the worktree that owns that pane, regardless of how many opencode TUI instances are running.
Impact
- Sidebar marks, spinners and "finished"/activity notifications land on unrelated projects — the user cannot trust the sidebar to see where work is running.
orca worktree psoutput (prompt/state per worktree) is wrong, which misleads automation and orchestration built on the CLI.
Notes / possibly related
- fix(desktop): use host-owned agent presence (step 2 of 3) #24175 fix(desktop): use host-owned agent presence (step 2 of 3) — the list of views that "guess" agent presence (sidebar activity and sort order, workspace dots, notifications) matches this report; this issue looks like another symptom of the same subsystem, specifically the cross-worktree/pane misattribution with multiple opencode TUIs.
- fix(opencode): clear an opencode run row when its process exits #24292 fix(opencode): clear an opencode run row when its process exits — also touches stale opencode rows in
worktree ps. - The v1.4.218 release notes do not mention a fix for this.
Activity
nwparker commentedon Oct 3, 2026
Reproduced this with official OpenCode 1.18.30 on Windows 11 (build 26200) and two separate Git repositories. Stock Orca 1.4.220 showed A missing and B working with A's Russian prompt while B's real TUI had already finished its own answer.
The fix is ready for review in #24962. Two genuine after runs, including the complete current-main build, keep A working with A's prompt and B done with B's own prompt and answer. Actual TUI screens, public
orca worktree ps, and the execution host's canonical status store agree; the sessions have distinct IDs. All task-owned test processes have exited.The fix uses the session selected by each TUI and validates its pane and launch identity before accepting attribution. I checked the released loader and catalog adapter in
~/projects/opencode. Credit @Grezz for this report and @werlang for the related shared-server investigation in #22838 and #22847.Public CI is still required before merge. This proof covers Windows 11; the reported Windows 10 build and a rendered Windows sidebar have not been tested. The issue remains open until the replacement merges.
nwparker commentedon Oct 3, 2026
Fixed in merged PR #24962: #24962 (main commit 5e65871).
The reported cross-workspace ownership failure was reproduced with actual installed OpenCode on a private stock Windows app. The exact final correction was then repeated on Windows 11 Pro x64 with OpenCode 1.18.30: B finished before A was created; A submitted a new Russian prompt; Orca’s canonical status store and exact-source public
worktree pskept A working and B done, with separate sessions and the original prompts. All 27 assertions passed. macOS hidden-renderer before/after proof is attached to the PR. The final CI passed 49 checks with 16 intentional skips.The fix takes the displayed session from the actual TUI and checks the original pane’s successful launch identity before resolving shared-server ownership. Thank you @Grezz for the detailed report. This is fixed on main; the fresh Windows run used Windows 11, so it does not claim a Windows 10 or rendered Windows sidebar test.