Skip to content

fix(orchestration): follow a reminted pane handle during worker readiness - #61

Merged
DoozyX merged 1 commit into
mainfrom
DoozyX/retro-29-handle-rebind
Nov 14, 2026
Merged

DoozyX merged 1 commit into
mainfrom
DoozyX/retro-29-handle-rebind

Conversation

@DoozyX

@DoozyX DoozyX commented Nov 14, 2026

Copy link
Copy Markdown
Owner

ELI5

When Orca reloads its window layout while a new worker is starting, the worker's terminal gets a new internal id. Orca kept waiting on the old id and reported the start as failed, although the agent was running fine.

What Changed

Before: orca orchestration worker-start could fail with terminal_handle_stale before the task was injected, leaving a live agent with no task.

After: the readiness wait retries once on the pane's new handle when the same process is still behind it, and the worker is bound to that handle.

Mechanism: waitForWorkerAgentReadyRebinding already existed on main but nothing called it. Local worker start now goes through a small waitForWorkerStartAgentReady that calls it and moves the creation custody row (rebindWorkerTerminalResourceHandle, matched on owner, old handle and process incarnation) to the new handle. The federated attach path calls the rebinding wait directly.

Why

Retrying the whole start would launch a second agent beside the live one. Following the same process under its new handle keeps the one that already started. The pane key and process incarnation are read before the wait, so a different process in the same pane is never adopted.

Linked Issue

Fixes #29

Visual Proof

N/A: runtime behaviour in worker start; no UI change.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

pnpm tc:node exit 0. pnpm test src/main/runtime/rpc/methods/orchestration/worker/testing/worker-run-dispatch-contracts.test.ts src/main/runtime/terminal/wait src/main/runtime/orchestration/legacy-remote --maxWorkers=2 plus the federation tests: 314 passed, including the new case that rejects the first wait with terminal_handle_stale and expects the worker bound to term_reminted. Not reproduced against a live Orca reload. macOS only.

Risk

Level: Low

Only the terminal_handle_stale path during readiness changes. The riskiest part is the custody-row update; it is restricted to the same owner, old handle and process incarnation. Plain revert backs it out.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Supersedes #54.

…ness

A session-graph reload remints a live pane's handle while worker-start waits on
it, and the wait failed with terminal_handle_stale. Local and federated starts
now wait once more on the same process under its new handle and rebind the
worker's terminal custody row to it.
Copilot AI balanced review requested due to automatic review settings November 14, 2026 13:30
@coderabbitai

coderabbitai Bot commented Nov 14, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a19d67fe-79f0-4ad6-b6e0-90e0dd19b5e4
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@DoozyX
DoozyX merged commit ed1b531 into main Nov 14, 2026
1 check passed
@DoozyX
DoozyX deleted the DoozyX/retro-29-handle-rebind branch November 15, 2026 10:55
@DoozyX DoozyX mentioned this pull request Nov 22, 2026
DoozyX added a commit that referenced this pull request Nov 22, 2026
Conflicts: project-group-operations.ts (kept fork Claude-account assignment helpers and upstream setProjectGroupParents); local-worker-start.ts (took upstream readiness structure, ported fork reminted-handle rebinding #61 into placed-worker-readiness.ts and handOver). Extracted recordClaudeBackgroundTasks and dashboardCardsKeepPositions to keep merged files under the max-lines fence.

Claude-Session: https://claude.ai/code/session_01BPjp5w5YjQ5F2NAXKWuguC
DoozyX added a commit that referenced this pull request Nov 23, 2026
Upstream origin/main 0b23e7a (388 commits) into fork main 6f98610.

Accepted upstream's test-suite cut (stablyai#46786) and dead card components (stablyai#46833)
on all 44 modify/delete conflicts. Fork-feature regression tests removed with it:
- #63: federation-worker-brief-agent-in-front, orchestration-structured-worker-retry
- #67: federated-release-safety, federated-transport-safety, worker-release
- #69: worker-list-pagination
- claude accounts: repo-update-host-guard, claude-session-account-move
- git graph: hosted-review-creation-gitlab-self-hosted
- passkeys: main-process-ready-persistence-cleanup
- branch cleanup: remove-worktree-branch-cleanup, worktree-remove-branch-deletion, remove-worktree
- test isolation: dependency-security-release
Fork-only tests that imported upstream-deleted fixtures were removed too.

Code conflicts keep both sides:
- Claude background evidence helper now uses upstream's running-task map
  (stablyai#47081); status payload carries fork monitoredWork + upstream backgroundCommands.
- Worker start: upstream bindTerminal/handOver split reads the re-minted pane
  handle from setupStage (#29/#61); fork deadline brief guard (#63) plus upstream
  abort checks in preamble delivery.
- Status bar: fork per-account usage roster with upstream's unreachable-host
  gating (stablyai#42644); a null account owner now shows no roster instead of local
  accounts.
- client-ui-params.ts: moved feature-interaction schemas to their own module to
  stay under max-lines with the fork's omp status-bar fields.

Gates: install:release, mobile frozen install, pnpm tc, mobile typecheck and
typecheck:tests, conflict-area tests (38 files), independent review (1 finding,
fixed), check:changed vs fork parent (only finding: upstream's unchanged
bot-run-results.test.ts casts).
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.

orchestration: worker readiness fails with terminal_handle_stale before Task injection

2 participants