Skip to content

fix(notes): match mirrored targets to runtime terminals - #16231

Closed
Fartown wants to merge 1 commit into
stablyai:mainfrom
Fartown:fix/paired-runtime-review-notes
Closed

Fartown wants to merge 1 commit into
stablyai:mainfrom
Fartown:fix/paired-runtime-review-notes

Conversation

@Fartown

@Fartown Fartown commented Aug 24, 2026 •

Copy link
Copy Markdown

ELI5

In a paired Orca session, the renderer gives a mirrored terminal tab a local web-terminal-* ID, while the runtime still lists that same terminal by its raw host ID. Review-note sending compared those two spellings directly, so it incorrectly reported that the selected terminal was unavailable. This change translates the renderer ID back to the runtime ID at the lookup boundary.

What Changed

  • Normalize the selected renderer tab ID with the existing toHostSessionTabId() codec before matching terminal.list results.
  • Keep exact worktree routing, leaf matching, live runtime handle lookup, and guarded paste/Enter authorization unchanged.
  • Update the explicit-target regression test to model a mirrored renderer ID against a raw runtime terminal ID.

Why

Paired-runtime Markdown review notes currently fail with "The selected terminal is no longer available" even when the agent terminal is connected and writable. The renderer stores mirrored tabs as web-terminal-*, but terminal.list publishes the raw host tab ID.

Normalizing only at the renderer-to-runtime inventory boundary fixes the identity mismatch without rewriting renderer store keys or changing the wire protocol.

Linked Issue

Fixes #16225

Visual Proof

N/A — no visual layout, styling, or copy changed. This is an identity lookup fix at the renderer/runtime boundary; the paired identity behavior is covered by the explicit-send regression test.

Testing

  • I manually tested these changes in a live paired desktop session — not run locally; the exact paired-ID case is covered by the regression test below.
  • Automated tests added/updated, or explained why not below
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts src/renderer/src/lib/active-agent-note-send-target-detection.test.ts src/renderer/src/lib/active-agent-note-send-focused-session.test.ts — 34/34 passed
  • pnpm lint — passed
  • pnpm typecheck — passed
  • pnpm build — passed
  • Full Vitest run completed 57,662 tests with one unrelated load-sensitive timeout in src/relay/subprocess.test.ts; that file passed immediately standalone (31/31). Remote CI will provide the clean-suite signal.

Platforms and environments reviewed:

  • macOS: local automated validation and full build completed.
  • Linux/Windows: no platform-specific code changed; cross-platform relay/build outputs passed.
  • Local/SSH/folder workspaces: non-mirrored IDs are identity-preserving through the codec.
  • Paired runtime/mixed versions: client-only normalization; no RPC schema, opcode, or host publication change.
  • Mobile: N/A; no mobile surface or protocol changed.

AI Disclosure

Implemented and reviewed with OpenAI Codex (GPT-5.6).

Review

  • Security: exact worktree target, tab/leaf match, live handle lookup, and guarded-send checks remain intact.
  • Cross-platform: pure string identity conversion; no OS-specific paths, APIs, or shortcuts.
  • Remote/SSH/local: toHostSessionTabId() leaves non-mirrored IDs unchanged.
  • Agents/integrations: provider-neutral; all agents continue through the existing guarded-send path.
  • Performance: one bounded prefix/decode operation per probe/send.
  • UI quality: no layout, styling, or copy changes.
  • Backwards compatibility: no wire or content contract change; new clients remain compatible with existing hosts.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • X handle: Not provided.
  • StablyAI contributor status: Not provided.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, and pnpm build pass; the local full-test exception is documented above and remote CI will verify the suite

@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 434a4055-300e-44c2-b7e2-d84d15fbd298

📥 Commits

Reviewing files that changed from the base of the PR and between afd76a4 and f1374f7.

📒 Files selected for processing (2)
  • src/renderer/src/lib/active-agent-note-send-explicit-target.test.ts
  • src/renderer/src/lib/active-agent-note-target.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The renderer now converts mirrored note target tab IDs to host session tab IDs before matching active runtime terminals. The explicit-target test now uses separate host and mirrored tab IDs while retaining the leaf ID match.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: matching mirrored note targets to runtime terminals.
Description check ✅ Passed The description follows the template and documents the change, rationale, issue, testing, compatibility review, and checklist status.

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.

@moltar

moltar commented Aug 31, 2026

Copy link
Copy Markdown

Second confirmation for this fix, from a different setup. A macOS desktop client on v1.4.193 with a headless orca serve runtime on v1.4.190. Notes added on a diff or on a file never reach an agent in a remote worktree, so the mismatch is not limited to Markdown notes on a paired desktop. I posted the ids I captured in #16225.

The normalization reads correct to me. Other remote paths already run the renderer tab id through the same codec before they talk to the runtime, so the lookup here was the odd one out.

Is anything blocking a review? The bug makes review notes unusable against a remote runtime, and the only workaround is to paste the note text into the agent terminal by hand.

@kaisoz

kaisoz commented Sep 3, 2026

Copy link
Copy Markdown

I also experiment this bug which is very annoying. Maybe @AmethystLiang or @Jinwoo-H can have a look at it? 😊

@nwparker

nwparker commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The mirrored-tab normalization in this PR is already on current main. The runtime note-target lookup converts the renderer tab ID with toHostSessionTabId before matching the runtime tab and requested leaf, and a dedicated mirrored-tab note-send regression covers the same behavior. Closing this PR as superseded by the implementation already on main. This also addresses the normalization failure described in #16225.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Paired-runtime Markdown review notes fail because mirrored tab IDs are not normalized

4 participants