Skip to content

Send review notes to any running agent of a worktree - #5654

Merged
brennanb2025 merged 5 commits into
stablyai:mainfrom
devajmeireles:feat/notes-send-any-running-agent
Jun 18, 2026
Merged

brennanb2025 merged 5 commits into
stablyai:mainfrom
devajmeireles:feat/notes-send-any-running-agent

Conversation

@devajmeireles

@devajmeireles devajmeireles commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When you review a worktree's diff and write notes, the "Send notes" menu used to reach only the focused terminal pane. So if two or three agents were running in that worktree, the notes went to whichever one happened to be focused, and there was no way to pick a different one.

This change lists every running agent of the worktree in the menu, and the note goes to the one you click. It also shows agents that Orca launched but that haven't reported their first hook event yet, so a freshly opened agent is selectable right away instead of only after you talk to it. That early listing waits for a recognized agent title, which is the same signal the runtime checks before it accepts a send, so a still-booting pane shows up only once the send will actually land instead of failing with "not a recognized agent session" when clicked.

Screenshots

The menu now lists each running agent of the worktree (here, two Claude sessions) above the "New agent" launchers:

CleanShot 2026-06-17 at 21 30 59

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

pnpm typecheck passes on all three projects. The new tests and the tests for every touched module pass. I could not get a clean full pnpm lint / pnpm test / pnpm build on this machine: oxlint runs out of memory locally, and the full suite has pre-existing platform tests (WSL detection on macOS) that fail in this environment and are unrelated to this change. I did run oxlint per changed file and the localization catalog check, both clean. CI should cover the rest.

AI Review Report

I reviewed this with a multi-agent pass and a focused diff reviewer. What I had them check: SSH/remote correctness, telemetry parity with the existing sidebar send, marking notes delivered exactly once, and how working or stale agents are treated.

What came out of it:

  • The send goes through the runtime path that resolves the worktree's owner host, so a non-focused pane on a remote worktree is driven on the right host. The renderer's agent list is only used to build the menu and gate eligibility; it never delivers the notes itself.
  • The reviewer caught an orphaned object key I left behind while refactoring the per-tab dedupe. I fixed it before committing.
  • Working and stale agents stay disabled, with the reason on hover, reusing the existing rules rather than new ones.

Cross-platform: this is renderer-only. It adds no keyboard shortcuts, no path handling, and no shell behavior, so macOS, Linux, and Windows are unaffected by anything new here. Remote and SSH worktrees keep working because delivery is routed by the worktree's owner host, not the focused runtime.

Security Audit

Notes are delivered as text through the existing terminal.send RPC, with Enter. Before submitting, the runtime confirms the target is a running agent and waits for the TUI to be idle, so notes cannot be pressed into a plain shell or a non-agent process. The renderer-side eligibility check is advisory only; the runtime on the owner host has the final say.

No command execution, no new path handling, no secrets, and no new dependencies. The change reuses the existing terminal RPC surface rather than adding IPC. Nothing outstanding.

Notes

Known limitation: an agent you start by hand (typing the CLI in a plain terminal, with no launch marker) and haven't interacted with yet shows up only after its first hook event. Agents Orca launched appear right away.


Open in Stage

…otes menu

The "Send notes" menu only reached the focused terminal pane, so a worktree
running several agents could receive review notes on just one of them. The menu
now lists every running agent of the worktree and routes the send to the one
you pick.

- Enumerate worktree agents in the dropdown (ReviewNotesSendMenuContent) instead
  of the single "Active agent session" item, falling back to that item when no
  agent has reported status yet.
- Generalize sendNotesToActiveAgentSession with an explicit note target so a
  specific pane can be addressed; routing still resolves the worktree's owner
  host, keeping SSH/remote sends correct.
- Surface agents before their first hook event via TerminalTab.launchAgent,
  gated on a recognized agent title so a still-booting pane is only offered once
  the runtime would accept the send (avoids "not a recognized agent session").
- Share agentKindForAgentType for telemetry parity; extract
  resolveRuntimePaneTitleForLeaf and reuse it for the focused-pane hint.
…e targets

- notes-send-agent-targets: status-backed + launch-agent enumeration, title gate,
  per-tab dedup, and missing-pty/non-terminal-leaf skips.
- runtime-pane-title-leaf-id: pane-title-to-leaf resolution across leaf and split
  layouts, including the sparse background-title case.
- active-agent-note-send: explicit note target routes to a non-focused pane and
  reports no-active-terminal when the target is absent from the runtime list.
- ReviewNotesSendMenuContent: enumerates agents, sends to the chosen one with the
  right target, disables working agents, and falls back to the active session.
@ghost

ghost commented Jun 18, 2026 •

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 18, 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

Run ID: 3c8fab88-dc4f-4498-83f9-b3db0b7f52de

📥 Commits

Reviewing files that changed from the base of the PR and between d43090f and 1d8136f.

📒 Files selected for processing (2)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx

📝 Walkthrough

Walkthrough

The PR extends notes-sending to target any running agent session, not just the focused terminal. A new resolveRuntimePaneTitleForLeaf helper centralises pane-title lookup across split and single-pane layouts and replaces inlined logic in getFocusedRuntimePaneTitle. A new agentKindForAgentType function in agent-status.ts consolidates agent-kind resolution, removing a duplicate helper from the UI slice. RunningAgentTargetState is exported and extended to require ptyIdsByTabId, allowing deriveRunningAgentSendTargets to validate that layout PTY references are present in the live PTY map. A new deriveNotesSendAgentTargets function builds the list of eligible send targets by combining live agent status entries with launch-agent tabs (filtered by PTY presence and recognised pane/tab title). sendNotesToActiveAgentSession gains an optional noteTarget parameter to route sends to an explicit tab/leaf. ReviewNotesSendMenuContent is refactored to compute targets via useMemo, route all sends through a shared toast wrapper, emit telemetry on targeted sends, and render per-agent AgentTargetMenuItem rows with a fallback single-item path. CompactAgentRow is extracted into a dedicated module with send-target state rendering and tooltip support. Sidebar components (WorktreeList, WorktreeCardAgents) thread ptyIdsByTabId into target derivation and wire send-target state into the compact agent row UI. Minor test formatting adjustments are made to session-scanner.test.ts.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary change: enabling notes to be sent to any running agent in a worktree, not just the focused terminal.
Description check ✅ Passed The description includes most required sections: Summary clearly explains the user-visible change with concrete context, Screenshots provide visual evidence of the new menu listing agents, Testing documents what was run (typecheck passed, tests added) with caveats about environment constraints, and comprehensive AI Review and Security Audit sections detail checks performed. However, Build status is not explicitly confirmed.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@AmethystLiang

AmethystLiang commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

@brennanb2025 will review this PR!

The tricky part is what if there are many open sessions, can the UI handle it well :-D

@devajmeireles

Copy link
Copy Markdown
Contributor Author

@brennanb2025 will review this PR!

The tricky part is what if there are many open sessions, can the UI handle it well :-D

Make sense! However, regarding the general idea of ​​workflow, I believe that in day-to-day work, a developer tends to have a maximum of 3, because one might be working on a task while another is doing an analysis related to that worktree.

@brennanb2025

Copy link
Copy Markdown
Contributor

Brennan validation follow-up

Verdict: land

I ran the brennan-yolo-lite follow-up for the clean review-notes send menu direction: named existing agent sessions plus New agent options only, with no visible Active agent session / focused / current fallback.

What changed after review

  • Removed the visible Active agent session fallback from the review-notes send menu.
  • Kept named existing agent session rows as the only existing-session targets.
  • Kept New agent fallback launchers available.
  • Kept disabled/non-sendable existing targets disabled.
  • Preserved explicit { tabId, leafId } note-target sends through the existing runtime-validated send path.
  • Kept compact sidebar send-target rows aligned with the same target behavior.

Delegated review flow

  • Design review/fix subagent completed clean after tightening the design to remove fallback-specific active-terminal probe/render plumbing from ReviewNotesSendMenuContent.
  • Implementation subagent removed the fallback render/probe path and updated tests.
  • Completeness verification subagent found no omissions.
  • Code review round 1: one reviewer clean, one reviewer found a stale NotesSendMenu.test.tsx assertion.
  • Fixed the stale test assertion.
  • Code review round 2: both reviewers clean.

Validation

Electron was launched from the exact PR worktree on CDP port 9335; window.api.app.getIdentity() confirmed:

  • branch: feat/notes-send-any-running-agent
  • worktree: send-review-notes-to-any-running-agent-of-a-work
  • root: /Users/thebr/orca/workspaces/orca/send-review-notes-to-any-running-agent-of-a-work

Test target: /Users/thebr/source/repos/Stably/demo-project.

Diff-to-test matrix:

  • Review-notes send menu lists named existing sessions plus New agent options only: passed.
  • No visible Active agent session, focused, or current fallback: passed.
  • Disabled/non-sendable targets stay disabled: passed.
  • Eligible existing agent can receive notes: passed. I selected a real running Codex target; Source Control comments became [], and the Codex PTY buffer contained the formatted review note.
  • Backing runtime check: passed. The target PTY foreground process was codex, and runtime terminal.isRunningAgent allowed the send.

Commands run

  • pnpm run typecheck passed.
  • pnpm run lint passed with only the existing .npmrc ${GITHUB_TOKEN} warning and unrelated SourceControl.tsx exhaustive-deps warning.
  • git diff --check passed.
  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/editor/NotesSendMenu.test.tsx src/renderer/src/components/editor/ReviewNotesSendMenuContent.test.tsx src/renderer/src/components/sidebar/WorktreeCardAgents.send-target.test.tsx src/renderer/src/lib/notes-send-agent-targets.test.ts src/renderer/src/lib/running-agent-targets.test.ts src/renderer/src/store/slices/ui.test.ts passed: 6 files, 171 tests.

Final local sanity before push:

  • git diff --check passed.
  • Same focused Vitest command passed: 6 files, 171 tests.

Evidence and cleanup

Screenshot evidence was captured locally under ignored validation-screenshots/:

  • validation-screenshots/review-notes-send-menu-targets.png
  • validation-screenshots/review-notes-send-menu-real-codex-open.png
  • validation-screenshots/review-notes-real-codex-sent.png

Console/log inspection found 0 console errors. Cleanup completed: demo diff comments cleared, validation PTYs stopped, Playwright closed, and only the Electron process started for validation was stopped; port 9335 was no longer listening.

Residual caveat: the real Codex PTY launched and was idle, but its renderer agent-status hook did not populate automatically in the temp profile. I manually seeded renderer status for that confirmed real Codex PTY so the changed menu could enumerate it; the actual send still used Orca runtime validation and delivered to the real Codex process.

brennanb2025 and others added 2 commits June 18, 2026 11:48
…unning-agent

# Conflicts:
#	src/renderer/src/components/sidebar/WorktreeCardAgents.tsx
@brennanb2025
brennanb2025 merged commit 1c60366 into stablyai:main Jun 18, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor

Thanks for this! Appreciate the PR!

carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-text-zoom.test.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (78 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	mobile/app/h/[hostId]/session/[worktreeId].tsx
#	mobile/src/terminal/TerminalWebView.tsx
#	mobile/src/terminal/terminal-webview-html.ts
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (220 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/renderer/src/i18n/locales/en.json
#	src/renderer/src/i18n/locales/es.json
#	src/renderer/src/i18n/locales/ja.json
#	src/renderer/src/i18n/locales/ko.json
#	src/renderer/src/i18n/locales/zh.json
carlosbaraza added a commit to carlosbaraza/orca that referenced this pull request Jun 18, 2026
* upstream/main: (341 commits)
  Show and Filter Automation-Created Workspaces (stablyai#5697)
  Fix premature project header truncation
  Send review notes to any running agent of a worktree (stablyai#5654)
  Fix workspace sidebar appearance setting (stablyai#5725)
  Highlight the open file in the Source Control sidebar (stablyai#5667)
  release: v1.4.80-rc.1
  Fix premature Codex completion notifications (stablyai#5682)
  Improve Codex startup prompt reliability (stablyai#5686)
  Keep hibernated agent completions visible (stablyai#5689)
  Move Prompt Cache Timer setting to Agents pane, simplify expired state (stablyai#5691)
  release: v1.4.80-rc.0
  Skip GitHub CLI preflight checks if no GitHub projects exist
  fix: restore font family keyboard navigation in settings
  Update README downloads badge
  fix(landing): make GitHub CLI setup nudge dismissible and provider-aware (stablyai#5688)
  Fix nested workspace card indentation (stablyai#5684)
  Fix flaky e2e tests (stablyai#5680)
  Replace plus icon with play button on quick command entry (stablyai#5674)
  Use managed Pi and OMP extensions (stablyai#5681)
  Narrow computer-use e2e trigger (stablyai#5685)
  ...

# Conflicts:
#	src/main/text-generation/commit-message-text-generation.test.ts
#	src/main/text-generation/commit-message-text-generation.ts
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 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.

3 participants