feat(specialist): add immediate specialist handoff - #607
Merged
Conversation
wen2zhou
marked this pull request as draft
August 2, 2026 06:06
When the user switches specialists mid-turn, hand the current turn to the switched specialist right away instead of waiting for the next turn. The switch approval is bound to the exact outer repl_execute completion via a per-control invocation identity, so an approved continuation can re-enter the control queue safely. - handoff: immediate switch hands off the in-flight turn; handoff skills are scoped to the switched specialist; empty handoff snapshots are stabilized. - permissions: specialist switch approval cards show resolved identity, capability scope, and current -> target direction (with a stale-warning fallback) instead of raw redacted JSON; deletes get a friendly detail block with a destructive primary action and fail-closed binding warning. - agents: specialist updates (including renames) are ordinary chat-reviewed mutations; only delete and switch keep approval cards. The revision guard and atomic single-profile commit are preserved, and renames now sync displayName into the Settings specialist list. - workspace: durable host.agents.switch pending intent is broadcast to the renderer so the handoff lifecycle projection stays in sync. - build: exclude .codex agent worktrees from vitest discovery.
wen2zhou
force-pushed
the
feat/specialist-handoff
branch
from
August 2, 2026 06:12
1ce5328 to
859ecab
Compare
wen2zhou
marked this pull request as ready for review
August 2, 2026 06:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Proposed change
repl_executecompletion via a per-control invocation identity, so an approved continuation can re-enter the control queue safely without deadlock.displayNameinto the Settings specialist list..codexagent worktrees from vitest discovery and ESLint scanning (same duplicate-source rationale as.claude/.worktree).Scope and non-goals
NotebookControlCompletionInterceptor), while concrete framework adapters (Codex, OpenCode) build on it.Acceptance criteria and validation
src/main/agents/handoff-lifecycle*.test.ts,src/main/agents/completion-handoff*.test.ts,src/main/agents/handoff-lifecycle.integration.test.tssrc/main/acp/codex-completion-handoff.integration.test.ts,src/main/agents/completion-gate.execute-control.integration.test.tssrc/renderer/src/pages/workspace/PermissionApprovalControls.specialist-switch.render.test.tsxsrc/renderer/src/pages/workspace/PermissionApprovalControls.specialist-delete.render.test.tsxsrc/renderer/src/stores/settings-store.test.ts,src/main/agents/agents-mutations.test.tssrc/renderer/src/pages/workspace/WorkspaceMessageScroller.render.test.tsxNotebookSession*types)src/main/notebook/runtime-service.export.test.ts, session lifecycle testsAll listed checks ran after the last material edit (conflict resolution + prettier formatting + eslint ignore config).
npm run typecheck— passednpm run lint— passed (0 errors; 22 pre-existing prettier warnings in untouched files)npm test(full suite) — 667 files / 9707 tests passed, 0 failedReview focus
refactor(notebook): extract session aggregatelanded on main after this branch was cut):controlInvocationIdandbeginControlInvocationwere migrated onto theNotebookSessionExecutionRequest/NotebookSessionMcpRpcConnectiontypes insession-aggregate.ts, andexecuteControlnow usessession.enqueueControlwhile keeping the interceptor semantics. Verify the two merge points insrc/main/notebook/runtime-service.ts(executeControland thesession.executecall inexecuteControlExclusive).executeControl; the control-queue tail must settle before the handoff completes.