Repository navigation
Conversation
…n tmuxCompat Teams snapshot the leader terminal handle at launch, but handles are remintable while teams are long-lived — once the stored handle goes stale, every teammate operation (starting with the pane split that materializes the team) fails with terminal_handle_stale and Claude Code agent-teams becomes unusable for the rest of the session. Apply the same validate-then-remint treatment PR stablyai#7514 gave the general orchestration path: keep the leader's remint-stable pane key in team state, and on a stale-handle failure re-resolve the current handle through the pane key and retry once, persisting the fresh handle. Fixes stablyai#11739 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds stable pane keys and terminal-handle resolution to Claude Agent Teams. Stale or gone handles are resolved and retried once across terminal operations. Shared pane and window resolution utilities replace dispatcher-local logic. Launch and environment preparation now propagate pane keys. Tests cover reminting, persistence, concurrency, unchanged-handle resolution, unavailable resolution, and retry failures. Merge Risk: 🔵 Low · up to The change restores long-lived team sessions by reminting stale terminal handles and retrying operations once. A bounded merge-readiness risk remains because edge-case pane resolution could direct input, output, focus, or split operations to the wrong terminal; the PR is mergeable with explicit owner awareness and follow-up to enforce exact pane identity. 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Full details: Description checkResolution Add the missing ELI5, What Changed, Why, Linked Issue, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Use Full details: Linked Issues checkExplanation The changes satisfy issue 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. Comment |
|
…r launch paths Review follow-ups: compare the remint result against the handle actually attempted (not the shared mutable pane.handle) so the loser of a concurrent stale race still retries; pass the already-known leader pane key through the captured native Agent Teams env refresh (renderer PTY spawns) and the adopted pane identity headless path, so those leaders can recover too. Co-Authored-By: Claude Fable 5 <[email protected]>
…eals epoch staleness Review follow-up (greptile): resolving by pane key re-registers the attempted handle against the current renderer epoch as a side effect, so epoch-only staleness is already healed for the retry — only skip the retry when the resolver returns no handle at all. Co-Authored-By: Claude Fable 5 <[email protected]>
|
@OrcaWin gentle ping — you are the requested reviewer on this one. @AmethystLiang tagging you as well, since this PR implements the fix for #11739 (P1, assigned to you) and addresses the same staleness family you have been investigating in #11191. Current status: all bot feedback is addressed — greptile's concurrent-remint race and the epoch-refresh same-handle retry case are both fixed with regression tests. Targeted tests pass ( Happy to adjust scope or approach if the team prefers a different direction for the |
- Re-apply the pane-key remint wiring over three weeks of upstream drift: tmux dispatcher call sites, runtime resolver injection, leader paneKey plumbing in pty.ts / orca-runtime.ts - Adopt upstream's pty.test.ts split (stablyai#14834); paneKey expectations now live in pty-spawn-runtime-handle-binding.test.ts - Extract resolvePane/resolvePaneOrWindow into claude-agent-teams-pane-resolution.ts to keep the dispatcher under the max-lines budget Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Synced with current What the sync involved
Verification on the merged tree
Relation to #14590 (“make close and handles incarnation-stable”, merged Aug 15): it stabilizes handle incarnation on the close/reload paths (and resolved #14524), but it does not touch the agent-teams tmuxCompat path — the team still resolves teammate panes via the leader-handle snapshot taken at team creation, so #11739 still reproduces whenever the leader handle changes (runtime restart, epoch refresh). This PR remains the fix for that path. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 036ef32f-31b0-4b67-a1d3-3565c6f6bc19
📒 Files selected for processing (9)
src/main/ipc/pty-spawn-runtime-handle-binding.test.tssrc/main/ipc/pty.tssrc/main/runtime/claude-agent-teams-pane-handle-remint.tssrc/main/runtime/claude-agent-teams-pane-resolution.tssrc/main/runtime/claude-agent-teams-service.test.tssrc/main/runtime/claude-agent-teams-service.tssrc/main/runtime/claude-agent-teams-tmux-dispatcher.tssrc/main/runtime/claude-agent-teams-types.tssrc/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (7)
- src/main/ipc/pty.ts
- src/main/runtime/claude-agent-teams-service.ts
- src/main/runtime/claude-agent-teams-types.ts
- src/main/runtime/orca-runtime.ts
- src/main/runtime/claude-agent-teams-service.test.ts
- src/main/runtime/claude-agent-teams-pane-handle-remint.ts
- src/main/runtime/claude-agent-teams-tmux-dispatcher.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Upstream split the monolithic PTY IPC module (stablyai#15172); the leader-prepare call site moved from pty.ts to pty/ipc/spawn-env.ts, so the paneKey pass-through is re-applied there (ctx.stablePaneKey). Everything else auto-merged. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
|
Re-synced with For clarity, since this push landed right after the review thread on |
|
@OrcaWin Gentle follow-up on this one. Since the first ping on Aug 7 the PR has been kept mergeable through two upstream re-syncs (currently on |
Upstream split OrcaRuntimeService into modules (stablyai#17605); the two call sites this PR touches moved out of orca-runtime.ts, so the same lines are re-applied in their new homes: the leaderPaneKey pass-through in orca-runtime-create-terminal.ts and the resolver injection plus paneKey plumbing in orca-runtime-resolve-terminal-split-source-authority.ts. Everything else auto-merged. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
|
Re-synced with |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
@Jinwoo-H @AmethystLiang — sorry for the direct ping; reaching out to you two specifically because you worked on this exact area recently (#14590 / #14524, the incarnation-stable handle work). This PR is the missing counterpart on the agent-teams side. The tmuxCompat path still resolves teammate panes via the leader-handle snapshot taken at team creation, so It's a small review in practice: the logic is one 40-line wrapper ( |
The only conflict was incidental: the previous merge's pre-commit oxfmt pass had reformatted runtime-status-recheck.ts, which upstream has since deleted — the deletion is accepted. All PR changes carried over cleanly. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
|
Re-synced with |
Two real hunks, both combining upstream features with the remint wiring: send-keys keeps the withFreshPaneHandle wrapper and adopts upstream's inputKind 'driving' option; prepareClaudeAgentTeamsLeader forwards both paneKey and upstream's new prepareAuth. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016gHoNRQpffLLRjf6aSDDWc
|
Re-synced with |
Summary
Fixes #11739.
orca claude-teamssessions: the team snapshots the leader terminal handle at launch into server-side team state, and once that handle is invalidated (handles are remintable — see the Validate ORCA_TERMINAL_HANDLE and remint stale orchestration terminals via pane key #7514 rationale), every shim call that touches the leader pane fails withterminal_handle_stale. Teammate spawning is the first casualty, and since the firstAgentspawn is what materializes the team, the whole feature is lost until the session is restarted.agentTeams.prepareLaunchalready receives it and then discarded it), and when an operation fails withterminal_handle_stale/terminal_gone, re-resolve the current handle viagetTerminalHandleForPaneKeyand retry once, persisting the fresh handle in team state (pane.handle, andteam.leaderHandlefor the leader).withFreshPaneHandlewrapper (claude-agent-teams-pane-handle-remint.ts) applied to split/send/read/focus paths in the tmux dispatcher. The leader pane key is threaded through all three launch paths that already know it (agentTeams.prepareLaunch, the captured native Agent Teams env refresh for renderer PTY spawns, and the adopted-pane-identity headless path); panes without a pane key (teammate panes, and headless launches whose random identity may be replaced by the canonical surface after spawn) and callers without the resolver keep the exact previous behavior — the API addition is optional, so no otherAgentTeamsTerminalApiconsumer changes.Screenshots
No visual change.
Testing
claude-agent-teams-service.test.ts: stale leader handle is reminted via pane key and the split retried; the fresh handle is persisted for later operations; concurrent operations racing on the same stale handle both recover; stale errors still propagate when no pane key is known or when the pane key resolves to the same attempted handle; send-keys recovery covered too.vitest run src/main/runtime/claude-agent-teams-service.test.ts— 12/12 passed (includes a concurrent same-stale-handle race regression test)vitest run src/main/ipc/pty.test.ts— 401/401 passed (prepareClaudeAgentTeamsLeaderForHandleconsumers updated for the pane key)oxlint/oxfmt --checkclean on all changed filespnpm exec tsc --noEmit -p config/tsconfig.node.json— passesReproduced live before the fix: in an aged claude-teams session,
tmux split-window -hthrough the shim fails withterminal_handle_staleeven whileORCA_TERMINAL_HANDLEis verifiably live — full trace and CLI-source analysis in #11739.