Repository navigation
Native chat tabs can hand off work from their right-click menu - #34504
Conversation
|
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1b42d740-8d80-457b-a659-6ec7ac8d80c8
Files ignored due to path filters: 1-
src/shared/rpc-contract/rpc-params-catalog.generated.tsis excluded by!**/*.generated.*
Files selected for processing: 38-
src/main/native-chat/agent-session-context-snapshots.test.tssrc/main/native-chat/agent-session-context-snapshots.tssrc/main/native-chat/agent-session-saved-prompt-text.tssrc/main/native-chat/agent-session-wire/structured-agent-session-continuation-context.tssrc/main/native-chat/agent-session-wire/structured-agent-session-host.tssrc/main/runtime/rpc/methods/structured-agent-session-at-rest.test.tssrc/main/runtime/rpc/methods/structured-agent-session-options-read.tssrc/main/runtime/rpc/methods/structured-agent-session-schemas.tssrc/main/runtime/rpc/methods/structured-agent-session.test.tssrc/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.test.tsxsrc/renderer/src/components/agent-session-continuation/AgentSessionContinuationDialog.tsxsrc/renderer/src/components/agent/AgentCombobox.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/structured-chat-menu-lifetime.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-context-menu.tsxsrc/renderer/src/components/native-chat/use-native-chat-hand-off.tsxsrc/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.test.tsxsrc/renderer/src/components/native-chat/use-structured-native-chat-pane-commands.tsxsrc/renderer/src/components/terminal-pane/AgentSessionContinuationMenuItem.tsxsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/agent-session-continuation.tssrc/renderer/src/lib/agent-session-fork-context.test.tssrc/renderer/src/lib/agent-session-fork-context.tssrc/renderer/src/runtime/structured-agent-session-client.tssrc/shared/agent-session-context-budget.tssrc/shared/agent-session-runtime-capabilities.tssrc/shared/agent-session-wire.tssrc/shared/rpc-contract/structured-agent-session-identifiers.tssrc/shared/rpc-contract/structured-agent-session-params.tssrc/shared/telemetry-property-schemas.tstests/e2e/cross-version-wire/structured-agent-session-host-fixture.tstests/e2e/cross-version-wire/structured-agent-session-surface-calls.tstests/e2e/cross-version-wire/structured-agent-session-surface-manifest.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
-
|
Standalone native chats had no hand-off action in their context menu. This adds “Hand Off to Another Agent” and opens the existing chooser in the same workspace, using saved chat context from the owning host. Older hosts retain the labelled loaded-message fallback. The full split/integration review retained the settled source design and fixed three issues: readable saved chats with damaged execution metadata now remain usable as hand-off sources without gaining execution permission; duplicate RPC exports are corrected; and each mounted chat reuses the existing tab index instead of scanning tabs on unrelated updates. A stale third argument in the ported clear-history test was also removed to match main’s current API; its 19 tests pass. No confirmed finding remains open. Verification: final-head PR checks and WSL checks passed (29 passed, 20 skipped, no pending or failed checks). The first Debian hosted runner froze during setup; its existing automatic retry passed, with no source change. Targeted host/store/RPC tests include a regression that fails before the saved-read repair and passes afterward. The real hook/store contract passes at 57 and 570 consumers, with zero unrelated tab scans/renders and correct live title/name updates; its three focused suites pass 21 tests. Renderer/host, snapshot-ordering, prompt and mixed-version tests also cover the source design. Branch-only screenshot check passed on the menu and prepared chooser, followed by Cancel. No agent was started and Start was not clicked. The transient preparation state completed too quickly to capture; its disabled controls are covered by renderer tests. The isolated copy stopped gracefully, with no owned leftovers or port listeners and unchanged real-config hashes. Screenshots are from df7cddb. Since then, 3917ecc changes saved-read admission/exports and 327a90e changes indexed title lookup, each in tests-row flows with the regression coverage above. Their rendered menu/dialog and launch behavior are unchanged, so the screenshots carry through For Brennan’s review |


ELI5
A native chat opened as its own tab has no right-click action for handing its work to another agent. This adds “Hand Off to Another Agent” to that menu, using the existing chooser to start a fresh session in the same workspace.
What Changed
The menu prepares context from the chat’s host journal in one capability-negotiated read. That read returns a bounded starter and a complete saved-chat snapshot file on the same host. It preserves the saved questions and answers and respects clear/rewind boundaries. The file has one deterministic location per session under OS temp and is replaced on the next hand-off; there is no sweeper. Each preparation attempt owns its dialog, so cancelling or changing chats cannot produce a late chooser.
Older hosts keep an explicitly labelled fallback to messages already loaded in the chat, without pagination. Terminal panes retain their existing hand-off row. The chooser shows preparation immediately with disabled controls and keeps the workspace path visible from the first frame.
Main’s current chat/CLI agent picker and launch cancellation behavior remain in use. The new read is workspace-authorized and does not extend the phone allowlist. The host method registry is recounted against main: 42 existing methods become 43; the complete cross-version surface becomes 46. The protocol version and minimum peer versions remain unchanged.
Why
This is split out of #31782 so the right-click entry can land on main without waiting for the usage-limit/account-switch stack. The journal is the authoritative saved chat, and the complete file lets the destination recover earlier details beyond the starter’s budget. Reusing the existing chooser and launcher keeps hand-off consistent with other entry points.
Intended compatibility differences: capable hosts supply saved context plus a same-host file; older hosts supply only labelled loaded messages. The snapshot is the saved chat at preparation time, including existing truncation markers, and later preparation replaces the same session’s file. OS temp owns retention.
The only small pieces carried from the stack are an optional in-memory
sourceKind: 'chat'discriminator with its recent-chat fallback wording, and thenative_chatlaunch telemetry value. This PR adds no account-switch or usage-limit UI. Usage-limit entry wiring and source-agent exclusion remain with #31782.Linked Issue
Tracked in #31782.
Visual Proof
Branch-only screenshots at df7cddb, captured through the real standalone chat menu and existing chooser in an isolated background copy. No agent was started. The later saved-read/export and indexed-lookup fixes preserve these rendered flows; their tests cover the changed behavior.
Testing
Named vitest runs through the local test gate cover snapshot publication ordering, saved context after clear/rewind/restart, retained prompt answers and editor prefill, host RPC registration, menu availability, fallback, timeout/cancellation ownership, dialog completion ownership, picker behavior, existing pane flows and both cross-version contracts. The split builder recorded 13 suites / 175 tests at its committed head and 11 existing pane suites / 120 tests.
Review repairs added a production-backed regression for readable saved chats with damaged execution metadata: saved content transfers while source execution remains refused and unchanged. Targeted host/store/RPC verification covered 83 distinct tests; the final at-rest run passed 19/19. The real hand-off hook/store performance contract runs at 57 and 570 consumers, asserts unrelated updates do no tab scans or renders, and verifies the correct title/name still updates. Its three named suites passed 21 tests. A stale third argument in the copied clear-history test was removed to match main’s two-argument API; its 19 tests pass. These counts overlap and are not additive.
No standalone typecheck, lint, build or full test run was performed on this Mac. Normal commit hooks passed. Final-head CI passed: static/typecheck, all five Node test shards, relay, cross-version compatibility, Linux/Windows packaging, changed layout/e2e checks and WSL distro tests. The Debian hosted runner froze on its first attempt; the existing automatic retry passed without a source change.
Review
Full review of the split against its source change and current main, including host authorization, mixed versions, current picker/launcher, attempt ownership, consumers, references and performance. The prior settled source design is retained. Three bounded findings were fixed: readable saved-conversation admission, duplicate public exports caught by CI, and repeated per-chat tab scans. Final CI and the loop's status comment record readiness.
Agent skill upstream boundary
Notes
The snapshot is private temp data on the source host, and WSL paths retain the existing conversion. Folder workspaces use the existing workspace launch route. Remote hosts negotiate the read capability; phones receive no added permission. Cross-platform behavior beyond the named tests is not newly claimed by this split.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — covered by CI