Skip to content

Stop repeated recovery of finished workers - #25679

Merged
nwparker merged 14 commits into
mainfrom
nwparker/fix-worker-recovery-convergence
Oct 6, 2026
Merged

nwparker merged 14 commits into
mainfrom
nwparker/fix-worker-recovery-convergence

Conversation

@nwparker

@nwparker nwparker commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Finished workers could remain in recovery, causing repeated session copies and saves while the user typed. Finished assignments now leave recovery. Workers whose host becomes available later still recover automatically.

What Changed

  • Settle worker bookkeeping in the assignment's SQL transaction and repair historical completed, failed and circuit-broken assignments when the database opens. Use an additive partial index containing only potentially active workers, avoiding scans of finished history. Healthy checks stay read-only; actual repairs re-read and settle under the writer lock. SQLite maintains the index for older writers too, so a downgrade cannot bypass later repair. Preserve actual worker outcomes, diagnostic errors and terminal ownership.
  • Recover deleted git/folder workspaces using evidence from their execution host. An empty restarted SSH relay inventory cannot prove process death; uncertainty preserves the worker identity.
  • Continue automatic recovery with the existing backoff capped at 30 seconds. Resolve each workspace once per pass, with a fresh lookup on later passes. Retry only unresolved assignments through indexed SQL lookups, with no empty-batch copies or saves, repeated settlement, or foreground-process/agent probes. Explicit foreground status reads still work. Foreign provider identities do not start local timers.
  • Retain durable saving for successful adoption and snapshot only changed hosts. Preserve cancellation and queued explicit recovery requests. Keep pending terminal-close requests progressing on retries through a bounded probe of the existing release-state index; actual release reconciliation still reads the full backlog and retains its host, identity and archive checks.

Why

#25413 reduced copies but left stale assignments and repeated work. Fixing settlement at its source and limiting each retry to unresolved work removes that cost while preserving recovery after prolonged outages. An arbitrary retry cutoff would require user intervention, so this revision removes it. SQL read failures remain retry failures instead of silently ending recovery.

Linked Issue

Slack incident. Historical sources: #11271 and #22612. #23262 separately retired automatic JSON snapshots and is already merged.

Visual Proof

N/A — background lifecycle and recovery changes; no UI layout change. Hidden Electron restart journeys check rendered worker tabs, retained output, the original process identity, and absence of duplicate launch or interruption.

Testing

  • The final recovery gate passed 2,590 tests across 151 files; seven tests and one file skipped. Includes orchestration, runtime recovery, federation, CLI and SQL downgrade compatibility.
  • 67 focused settlement/recovery/release regressions passed, including all 45 assignment/worker state combinations, idempotent reopen and rollback after the second historical repair fails. A fake-timer regression reproduces delayed pending releases before the fix and preserves the original retry cadence afterwards; an empty backlog triggers no release reconciliation. A real SQL test verifies the bounded probe uses the existing index and actual reconciliation retains every requested/releasing resource.
  • After the release-cadence fix, 1,693 tests passed across 223 files (six tests and one file skipped), including federation, worker-release recovery, CLI and the full cross-version wire suite. The wire suite has 114 tests across 20 files, including upgrade and rollback against the latest release.
  • Six rebuilt hidden macOS Electron journeys passed: original worker retention, restart, profile isolation, project transfer and abrupt shutdown recovery.
  • The rebuilt final-head macOS client against a real Linux ARM64 Docker SSH host preserves a settled assignment’s live terminal through app restart and SSH reconnect. Host-side proof checks the same shell, live background child, environment and directory; rendered output confirms input still works. Removing startup repair makes this journey fail.
  • On the 100,000-assignment fixture, the latest change improved no-op repair from 4.40ms to 0.016ms. Healthy full database open measured 12.70ms; the first index-build/open with 1,000 stale workers to repair measured 65.06ms. The index is built once, and state changes maintain its active entries. These are local observations, not latency guarantees. Deterministic tests require one workspace lookup for 100 workers in a pass and fresh lookups on later passes.
  • Aligned the inherited prompt fixture with main’s corrected Windows/PowerShell coverage; all 31 fixture tests pass, and the combined merge contains exactly one copy of the Windows prompt block and matches main’s fixture.
  • All three typecheck projects, changed-code quality, global type-aware lint and 143 reliability gates passed.

Reproduce the worker checks using the commands in orchestration.worker-recovery-convergence in config/reliability-gates.jsonc. Run the compatibility suite with ORCA_BACKGROUND_LAUNCH=1 pnpm test tests/e2e/cross-version-wire --fileParallelism=false --maxWorkers=1.

Review

Claude Opus 5.5 reviewed the full PR through three adversarial rounds; the final review is CLEAN for P0/P1 on 9875cf10d104c1ea6b41bf40b076cd6ca62fe37f. It independently passed 124 targeted tests with the repository configuration. Review identified a bounded P2 delay in requested terminal closes; the final change restores their existing retry cadence with an indexed, bounded backlog probe. The final review rechecked full-backlog preservation, release intent, archive protection, host ownership and retry cancellation. The inherited Windows prompt fixture was also aligned with main to remove a duplicate block in the combined merge.

Covered transaction rollback, genuine report outcomes, terminal custody, incarnation replacement, host isolation, uncertain SSH evidence, failed durable writes, queued recovery, late availability and cancellation. SQL tests check the actual query plan and stable parameterization across batch sizes. The foreground regression fails with five probes before the correction, then passes with zero recovery probes and one explicit status read. The scoped-query and late-recovery tests also fail with their production corrections reverted. Reverting the worker-first startup query and per-pass workspace reuse causes four failures in query-plan and lookup-count tests. Reverting the later active-worker index and read-only preflight causes two failures: query-plan coverage and a healthy repair under another connection’s writer lock. Old-writer reintroduction and upgrade-index rebuilding are covered.

Rebased onto main's released-protocol correction. Aligned the duplicate-import cleanup with main so the combined merge retains the provider import; fixed the over-budget prompt fixture; retained the released JSON parser as a test-only dependency so historical compatibility sources remain executable. One additive partial index; no table-column, schema-version, execution-command or wire payload changes.

Agent skill upstream boundary

  • Not applicable; no upstream skill material copied or translated.

Notes

The reliability gate remains experimental. Native macOS/local/daemon restart behavior and deterministic SSH contracts are covered. Native Linux/Windows desktop and WSL worker journeys, active-assignment SSH absence/deleted-folder recovery, and paired-runtime journeys remain gaps. Historical repair with a live SSH terminal is exercised through restart and reconnect. Completed historical assignments no longer re-adopt an unpersisted terminal surface solely from stale worker bookkeeping; the process and terminal custody are preserved. Recovery inventories omit foreground-agent probes, so badge/title refresh can wait for the next normal inventory. The pre-existing failed-database-open handle cleanup limitation is outside this change. Remaining costs: a one-time index build and repair for older databases, minor index maintenance on worker-state changes, automatic metadata retries for unresolved workers, and delayed cleanup until the owning host can verify process exit. Healthy repair checks inspect only the active-worker index and do not take a writer lock. SSH relay readiness already triggers immediate recovery; the timer remains a fallback. No retry cutoff or age-based discard is introduced. The original customer's typing latency and CI p95 have not been measured; deterministic counts and the synthetic scale measurement cover the identified work.

Checklist

  • Focused on the worker recovery incident and necessary validation fixes.
  • Explained the user experience, mechanism and alternatives.
  • Self-reviewed correctness, ownership, performance and atomicity.
  • Cross-platform, folder workspace, SSH and compatibility impact considered.
  • Final-head CI is green: 24 successful checks and 18 intentionally skipped checks, including all five unit shards, four SSH isolation shards, Linux persistence, Linux/Windows packaging, relay integration, cross-version compatibility, static checks and final verification. Local type, quality and automated checks also passed.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Dispatch completion now settles eligible workers as abandoned at the assignment-settled stage, and database initialization repairs historical settled assignments. Legacy recovery uses execution-host inventory and terminal-absence evidence to classify missing-workspace workers, persists the observed host, and defers unverifiable workers. Automatic retries are scoped to deferred dispatches and avoid empty persistence batches. The change also adds tests, reliability-gate details, and test-harness updates.

Priority: ⬆️ High

Merge Risk: 🟡 Moderate · up to 36bca

A live SSH worker could be treated as exited, while workers with deleted workspaces may never recover automatically. Resolve both paths before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to 36bca

The change affects 4 systems.

Changed systems: src, config, package.json, tests

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (service) was modified; 24 changed files map to changed impact.
  • observed — config (service) was modified; 1 changed file maps to changed impact.
  • observed — package.json (service) was modified; 1 changed file maps to changed impact.
  • observed — tests (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in src/main/runtime/orca-runtime-test-scenario-builders.spec.ts: Added a targeted oxlint suppression comment before setOrchestrationDb, describing the recovery fixture’s listed planner, terminal settlement, and authority lookup methods as the scope of the type assertion’s safety.
  • observed — Modified behavior in src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-04.spec.ts: Added a safety comment and a targeted Oxlint suppression before the mocked OrchestrationDb setup; the test’s recovery logic and expectations are unchanged.
  • observed — Modified behavior in src/main/runtime/orchestration-message-delivery-identity.test.ts: Imports STATUS_METHODS for configuring the built-CLI RPC server.
  • observed — Modified behavior in src/main/runtime/orchestration-message-delivery-identity.test.ts: The built CLI subprocess environment now includes ORCA_AGENT_LAUNCH_TOKEN set to the test launch token.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 25 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: preventing repeated recovery of finished workers.
Description check ✅ Passed The description covers the required sections, explains the change and rationale, and details testing and known gaps. The linked-issue section cites a Slack incident and historical pull requests but do…
Full details: Docstring Coverage

Explanation

Docstring coverage is 10.53% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 25 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfad577e-79d1-4436-bb55-1b69897b932d
📥 Commits

Reviewing files that changed from the base of the PR and between 56dbf1b and 4a9bf26.

📒 Files selected for processing (17)
  • config/reliability-gates.jsonc
  • src/main/runtime/orca-runtime-test-scenario-builders.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-04.spec.ts
  • src/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-05.spec.ts
  • src/main/runtime/orchestration-message-delivery-identity.test.ts
  • src/main/runtime/orchestration/db/dispatch-context/dispatch-completion.ts
  • src/main/runtime/orchestration/db/orchestration-db.ts
  • src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-settlement.ts
  • src/main/runtime/orchestration/worker-dispatch-settlement.test.ts
  • src/main/runtime/runtime-legacy-worker-missing-workspace-recovery.test.ts
  • src/main/runtime/runtime-legacy-worker-recovery-test-fixture.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-persistence.test.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-persistence.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-runner.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-types.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.

Comment on lines 38 to 46
reconcile(
options: LegacyWorkerRecoveryOptions = {}
): Promise<LegacyWorkerTerminalRecoveryResult> {
if (!options.retry) {
this.cancelScope(options.connectionId ? `ssh:${options.connectionId}` : 'local')
}
let resolveResult!: (result: LegacyWorkerTerminalRecoveryResult) => void
let rejectResult!: (error: unknown) => void
const result = new Promise<LegacyWorkerTerminalRecoveryResult>((resolve, reject) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,190p' src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts

Repository: stablyai/orca

Length of output: 5722


🏁 Script executed:

printf '%s\n' '--- runner ---'
sed -n '1,260p' src/main/runtime/runtime-legacy-worker-terminal-recovery-runner.ts
printf '%s\n' '--- types ---'
sed -n '1,240p' src/main/runtime/runtime-legacy-worker-terminal-recovery-types.ts
printf '%s\n' '--- bindings and usages ---'
rg -n -F -- 'new RuntimeLegacyWorkerTerminalRecoveryController' src
rg -n -F -- 'updateRetry(' src/main
rg -n -F -- 'ports.reconcile' src/main/runtime
printf '%s\n' '--- relevant test files ---'
rg -l -F -- 'RuntimeLegacyWorkerTerminalRecoveryController' src test tests 2>/dev/null || true
printf '%s\n' '--- changed hunk versus PR base ---'
git diff --unified=35 d518d4a5466ed5355b1ea3dcce81044f013fd0e3 4a9bf26fd5b930f82b8865ec4e236e018ebc8327 -- src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts

Repository: stablyai/orca

Length of output: 18105


🏁 Script executed:

printf '%s\n' '--- production controller construction ---'
sed -n '120,225p' src/main/runtime/orca-runtime-preserved-branch-cleanup.ts
printf '%s\n' '--- explicit reconcile callers ---'
rg -n -F -- '.legacyWorkerRecovery.reconcile(' src/main
rg -n -F -- 'legacyWorkerRecovery.reconcile(' src/main
printf '%s\n' '--- retry tests ---'
sed -n '1,280p' src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts
printf '%s\n' '--- runner and retry changed status ---'
git diff --unified=8 d518d4a5466ed5355b1ea3dcce81044f013fd0e3 4a9bf26fd5b930f82b8865ec4e236e018ebc8327 -- src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts

Repository: stablyai/orca

Length of output: 20716


🏁 Script executed:

printf '%s\n' '--- production controller construction ---'
sed -n '120,225p' src/main/runtime/orca-runtime-preserved-branch-cleanup.ts
printf '%s\n' '--- explicit reconcile callers ---'
rg -n -F -- '.legacyWorkerRecovery.reconcile(' src/main
rg -n -F -- 'legacyWorkerRecovery.reconcile(' src/main
printf '%s\n' '--- retry tests ---'
sed -n '1,280p' src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts
printf '%s\n' '--- controller retry diff ---'
git diff --unified=8 d518d4a5466ed5355b1ea3dcce81044f013fd0e3 4a9bf26fd5b930f82b8865ec4e236e018ebc8327 -- src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts

Repository: stablyai/orca

Length of output: 20706


🏁 Script executed:

printf '%s\n' '--- bound runtime methods ---'
rg -n -F -- 'reconcileLegacyWorkerTerminals' src/main/runtime
rg -n -F -- 'updateLegacyWorkerTerminalRecoveryRetry' src/main/runtime
printf '%s\n' '--- automation operation ---'
sed -n '175,215p' src/main/runtime/orca-runtime-automation-operations.ts
printf '%s\n' '--- method definitions and owners ---'
rg -n -C 12 -- 'reconcileLegacyWorkerTerminals\s*\(|updateLegacyWorkerTerminalRecoveryRetry\s*\(' src/main/runtime

Repository: stablyai/orca

Length of output: 42194


🏁 Script executed:

nl -ba src/main/runtime/runtime-legacy-worker-terminal-recovery-controller.ts | sed -n '32,112p'
printf '%s\n' '--- runner update ---'
nl -ba src/main/runtime/runtime-legacy-worker-terminal-recovery-runner.ts | sed -n '142,156p'
printf '%s\n' '--- retry contract ---'
nl -ba src/main/runtime/runtime-legacy-worker-terminal-recovery-types.ts | sed -n '17,32p'
printf '%s\n' '--- production bindings and explicit call ---'
nl -ba src/main/runtime/orca-runtime-preserved-branch-cleanup.ts | sed -n '180,189p'
nl -ba src/main/runtime/orca-runtime-automation-operations.ts | sed -n '193,208p'
printf '%s\n' '--- retry test coverage block ---'
nl -ba src/main/runtime/runtime-legacy-worker-terminal-recovery-retry.test.ts | sed -n '89,166p'

Repository: stablyai/orca

Length of output: 9510


Reset the scope when the queued explicit pass starts.

When an explicit request arrives during a timer pass, cancelScope() deletes the retry record but does not stop the running pass. If both passes defer a worker, the timer pass recreates the record and arms a retry before the explicit pass runs. The explicit pass then reuses that record, so its fresh six-retry budget can start with one retry already counted. Cancel the scope again when the queued explicit pass starts.

Suggested fix
     const run = this.queue.then(async () => {
       try {
+        if (!options.retry) {
+          this.cancelScope(options.connectionId ? `ssh:${options.connectionId}` : 'local')
+        }
         resolveResult(await runLegacyWorkerTerminalRecovery(this, this.ports, options))

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Assignment settlement at its source — new worker-dispatch-settlement.ts settles an active worker (starting/ready/start_unknown/stopping/stop_unknown) to abandoned with stage: 'assignment_settled' when its dispatch is completed/failed/circuit_broken, called from completeDispatch and settleActiveDispatchesForTask, plus a one-shot reconcileSettledWorkerDispatches repair at DB open. Preserves last_error, does not kill a terminal or claim process exit.
  • Bounded recovery retries — MAX_LEGACY_WORKER_RECOVERY_RETRIES = 6 with capped exponential backoff and an exhausted flag; a non-retry (startup/reconnect/explicit) reconcile cancels the scope and resets the budget, while the internal timer passes retry: true. Exhaustion leaves unverifiable workers unchanged and logs once per host.
  • Deleted-workspace and host-routed recovery — the runner now defers foreign/runtime/wrong-connection/unrecoverable-local PTYs up front, turns selector_not_found into a provider keyed by the PTY's own host with workspace: null, gates on inventory.queriedHostIds.has(hostId), and retires a deleted workspace only on !allLivePtyIds.has(ptyId) or a differing terminal identity. Resolutions carry an optional hostId.
  • Durable-write budget — persistence snapshots only hosts whose session actually changed, prefers the owning-provider hostId over stale workspace metadata, and flushes when originals.size > 0 || adopted so unchanged adopted surfaces stay durable without extra rollback copies.

The added tests are meaningful rather than tautological: the settlement suite injects trigger failures to prove whole-transaction rollback and reopens the DB to prove historical repair, the missing-workspace suite exercises the 100-candidate single-inventory budget and the live/unverified/different-incarnation deferrals, and the retry suite advances fake time to pin exactly six retries, budget reset on explicit recovery, and per-host cancellation. I traced the queriedHostIds/allLivePtyIds absence proof against retireOrchestrationAuthorityAbsentFromInventory and the PtyControllerInventory contract comment, and the stopping/stop_unknown → abandoned settlement against the guards in updateTaskStatus, settleWorkerReportInTransaction, and decision-gate-store; the latter cannot reach an active worker through any production caller.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the nwparker/fix-worker-recovery-convergence branch from 4a9bf26 to 206248d Compare October 5, 2026 23:22

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior pullfrog review at 4a9bf26.

  • Queued explicit recovery now resets the retry scope — reconcile runs a second cancelScope inside the queued run for non-retry passes, so a timer pass that re-arms after the caller's synchronous cancel cannot survive once the explicit pass actually starts.
  • Regression test for the queued-reset race — advances fake timers through a hung timer pass, then asserts the re-armed timer was cancelled (vi.getTimerCount() === 0) and the explicit pass gets a fresh six-retry budget.
  • Inherited journal fixture repaired — journal-submission-positions.test.ts now builds its Codex provider handle with codexProviderHandle('thread-1') instead of a stale literal, the same fixture repair as #25706.

I traced the race the new commit closes: a timer pass already in flight can call updateRetry after the caller's synchronous cancelScope and re-arm a timer, so the in-queue cancel is genuinely needed, and it does not affect the host-isolation or exhaustion paths. The new test fails without it.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker force-pushed the nwparker/fix-worker-recovery-convergence branch from 206248d to f9edb76 Compare October 6, 2026 00:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

🟡 Minor · Keep plain-SSH inventory misses from settling… · orca-runtime-preserved-branch-cleanup.ts:185

src/main/runtime/orca-runtime-preserved-branch-cleanup.ts:185
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Keep plain-SSH inventory misses from settling prior-relay workers.

When a persisted SSH worker’s workspace resolves while its target is in plain-SSH fallback, SshPlainShellPtyProvider.probePtyLiveness() returns false for a prior-relay PTY ID that is not in the new provider’s shells or lost sets. The new binding turns that result into proven absence. Recovery can then persist exited, retire the saved terminal surface, and reconcile a worker whose prior-relay process is still live. Return unknown for IDs the fallback provider did not own; require an owning-host proof before settling the worker.

🟡 Minor · Deleted-workspace candidates bypass… · runtime-legacy-worker-terminal-recovery-runner.ts:86-95

src/main/runtime/runtime-legacy-worker-terminal-recovery-runner.ts:86-95
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Deleted-workspace candidates bypass host-evidence recovery.

When an eligible candidate’s workspace is missing, production resolution propagates Error('selector_not_found'). This catch only accepts error.code, so the candidate can fall through to deferredDispatchIds without an inventory check. The scheduled retry invokes the same runner and can defer it again while the workspace remains missing.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1fbf8afa-67e2-407a-bbfd-716c4c45bf78
📥 Commits

Reviewing files that changed from the base of the PR and between 62265a4 and 36bcaef.

📒 Files selected for processing (6)
  • config/reliability-gates.jsonc
  • src/main/runtime/orchestration/db/worker-dispatch/worker-dispatch-settlement.ts
  • src/main/runtime/orchestration/worker-dispatch-repair-safety.test.ts
  • src/main/runtime/runtime-legacy-worker-missing-workspace-recovery.test.ts
  • src/main/runtime/runtime-legacy-worker-terminal-recovery-runner.ts
  • src/shared/startup-line-prompt-carry.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/reliability-gates.jsonc

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@nwparker
nwparker merged commit c8ff7e8 into main Oct 6, 2026
42 checks passed
OrcaWin pushed a commit that referenced this pull request Oct 6, 2026
…ess-table helpers

Phase 3's #25859 and main's #25679 each kept orca-runtime-preserved-branch-cleanup.ts under the
300-line limit, but together they reached 303. The proof's logic now lives in
run-terminal-shell-alone.ts; the runtime method delegates to it unchanged.
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.

1 participant