feat: cross-runner handoff (/handoff claude|codex) for Linear issues#1348
Open
hcaumo wants to merge 15 commits into
Open
feat: cross-runner handoff (/handoff claude|codex) for Linear issues#1348hcaumo wants to merge 15 commits into
hcaumo wants to merge 15 commits into
Conversation
Linear @mentions create a new agent session, so a handoff requested via @cyrus /handoff codex arrives on the session-creation path rather than the follow-up prompted path. Parse the command from the creating comment and force the requested runner for the new session (reusing the existing worktree). Adds creation-path runner-selection tests.
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.
Summary
Adds cross-runner handoff to Cyrus: a Linear issue started with one runner (Claude or Codex) can be handed to the other so it continues from the existing work, files, branch, and PR state — in the same worktree, never running both runners at once.
Initial-runner tags (
[agent=claude]/[agent=codex]) are unchanged.How it works
HandoffService(packages/edge-worker/src/HandoffService.ts) — command parsing (parseHandoffCommand), worktree/git/PR snapshot (buildSnapshot), target-prompt formatting (buildHandoffPrompt), a stop-poller (waitForStopped), andgetActiveRunnerType.runnerTypeOverridethreaded throughRunnerConfigBuilder.buildIssueConfig→EdgeWorker.buildAgentRunnerConfig→resumeAgentSession. When set, it forces the target runner, bypassing label/description selection and the sticky-session binding. Defaults toundefined, so existing single-runner behavior is byte-for-byte unchanged.handleHandoffCommand): stops the active runner (sequentially, with a ~30s timeout → "handoff blocked" comment), snapshots the worktree state, clears the old runner binding, and starts the target in the samesession.workspace.@Cyrus /handoff codexarrives on the session-creation webhook. The creating comment is parsed and the requested runner is forced for the new session (the issue's worktree is reused, so the target picks up prior files/commits/PR).GitService;getLastAssistantBody/clearRunnerSessionBindingsadded toAgentSessionManager.Testing
runnerTypeOverride, same-worktree reuse, blocked handoff, failure handling, and creation-path handoff selection. Fullcyrus-edge-workersuite: 765 passing;pnpm typecheckclean.@Cyrus /handoff codexon a Claude-started issue stopped Claude and started a Codex runner in the same worktree, continuing the work.Acceptance criteria
[agent=claude]/[agent=codex]still start exactly one runner (regression-guarded)./handoff codexafter Claude starts Codex in the same worktree;/handoff claudeafter Codex starts Claude.Changelog updated under
## [Unreleased].