Repository navigation
Conversation
|
| const decision = decideWorkerTerminalRelease(reconciled.resource) | ||
| return { | ||
| dispatchId, | ||
| state: decision.action === 'already_released' ? 'already_released' : 'retained', | ||
| reason: | ||
| decision.action === 'retained' | ||
| ? decision.reason | ||
| : reconciled.resource.retained_reason === 'user_requested' | ||
| ? 'user_requested' | ||
| : 'identity_unproven', |
There was a problem hiding this comment.
Unfinished release reported retained
If the resource’s host scope or terminal handle changes during the death probe, settleDeadWorkerTerminalRelease correctly refuses to release it. This branch then reports retained even when the current row is still requested or unknown. The caller receives a misleading receipt for an unfinished release, without the pending or unknown recovery guidance. Return a receipt based on the current row’s release state.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe runtime now requires a negative PTY probe and a refreshed process inventory before classifying an incarnation as exited. Missing-terminal worker releases use a helper that checks liveness and terminal state, then settles against an expected resource snapshot. Tests cover unavailable archives after confirmed process exit, inconclusive liveness, retention requests, and concurrent resource changes. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change finishes cleanup for workers proven dead and no longer leaves them stuck. It rechecks state before releasing. No concrete merge-blocking issue was found in the supplied evidence. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change strengthens checks before cleanup and preserves concurrent ownership decisions. No introduced security issue was established in the reviewed flow, but behavior across all production environments has not been confirmed. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2bb4d911-f5b6-49c0-aac1-f319512b99f5
📒 Files selected for processing (11)
src/main/runtime/orca-runtime-process-death-probe.test.tssrc/main/runtime/orca-runtime-process-incarnation-liveness.test.tssrc/main/runtime/orca-runtime-subscribe-to-terminal-resize.tssrc/main/runtime/orchestration/db/worker-terminal/worker-terminal-release.tssrc/main/runtime/orchestration/worker-terminal-process-liveness.tssrc/main/runtime/rpc/methods/orchestration-worker-release-incarnation-fallback.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-completion.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-missing-archive.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-missing-terminal.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-recovery.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| const ptyId = workerTerminalPtyIdForDeathProbe(processIncarnation, hostScope) | ||
| const probe = this.ptyController.probePtyLiveness?.bind(this.ptyController) | ||
| if (!ptyId || !probe) { | ||
| return 'unverifiable' | ||
| } | ||
| const probed = await withTimeoutResult( | ||
| Promise.resolve().then(() => probe(ptyId)), | ||
| PTY_CONTROLLER_LIST_TIMEOUT_MS | ||
| ) | ||
| if (!probed.ok || probed.value !== false) { | ||
| return 'unverifiable' |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Add an authoritative SSH PTY liveness probe.
For a UUID-suffixed SSH relay worker whose terminal is already missing, SshPtyProvider has no probePtyLiveness implementation. The optional probe is therefore unavailable, so inspectTerminalProcessIncarnationLiveness returns unverifiable instead of exited, even when the process is dead. This can leave the supported interactive SSH release workflow in its unknown or recovery-pending state.
Implement the probe through the owning relay. Return false only after a bounded, successful relay response proves that the PTY is absent. Return null for transport errors, timeouts, incomplete inventories, or other uncertainty. Do not use cached hasPty or livePtyIds as death proof.
There was a problem hiding this comment.
ℹ️ No critical issues — one stale comment inline, plus a test-coverage nit below.
Reviewed changes
- Negative owning-provider death probe —
inspectTerminalProcessIncarnationLivenessnow requiresprobePtyLiveness(ptyId) === falsefor a v4-UUID incarnation, then re-lists and re-classifies;null/probe-less/legacy staysunverifiable(workerTerminalPtyIdForDeathProbe). - Post-probe race fences — new
worker-release-missing-terminal.tsre-inspects the terminal and re-checks the incarnation lookup after the awaited probe before settling, called from both the completion and retained paths. - CAS token + widened archive rule —
settleDeadWorkerTerminalReleasetakes an optionalexpectedResourceand letsrequested/unknownarchive-less rows settle asarchive_status: 'unavailable'only when that token is supplied; existing archives stay checksum-fenced. - Tests updated to the new outcomes, plus a new probe unit suite and race-guard suite.
#26912's case 1 (release_unavailable instead of a permanent release_unknown) and cases 2a–2c/2e are addressed by the three conditions above. The CAS checks, archive-preservation clause, and BEGIN IMMEDIATE ordering all look sound; I found no way for a concurrent retain/takeover/remint to be settled released.
ℹ️ Release-flow tests never exercise the real UUID-only probe
worker-release-missing-archive.test.ts and the updated incarnation-fallback tests mock inspectTerminalProcessIncarnationLiveness, and the shared harness records a legacy runtime_test:term_worker:1 incarnation. The new gate only certifies v4-UUID incarnations, so the path from a genuine probePtyLiveness === false through settleDeadWorkerTerminalRelease to archive_status: 'unavailable' is only covered in isolation in orca-runtime-process-death-probe.test.ts. A single harness-based case setting a UUID incarnation and driving the real runtime method would pin the integration the PR is really about.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Incremental delta since the prior pullfrog review (d61f2669..134ae2f8, two commits):
- Extracted a receipt projector — new
worker-release-receipt.tsownsWorkerReleaseReceipt,releaseUnknownRecovery,releasePendingRecovery,retainedReason, and a pureworkerReleaseReceiptFromResourcethat turns a fresh row into a receipt;worker-release-completion.tsre-exports the moved symbols sostructured-worker-release-stop.tskeeps its import site. - Refused settlement reports current state —
releaseProvenDeadMissingWorkerTerminalnow builds the refused-settlement response from the fresh row instead of hardcodingretained:decideWorkerTerminalReleasefirst foralready_released/retained, thenrelease_unknown(withlastError+ recovery) for anunknownrow,release_pendingforrequested/releasing, andretainedotherwise. - Tests — the "protects … replaced during the death probe" expectation moves to
release_pending; new cases pinrelease_unknownwhen a column changes while the row is already unknown, andalready_releasedwhen settlement races an already-released row. - Comment correction —
134ae2f8fixes the stale settlement comment, addressing the prior review's inline thread.
The refused-settlement projection is correct across the branches I traced: the CAS token deliberately omits ownership_state, and a concurrent takeover is still refused by the decideWorkerTerminalRelease(...) !== 'proceed' guard, yielding a retained/user_takeover receipt. Prior review feedback is addressed and its thread was resolved.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
A finished worker whose terminal disappeared can stay stuck in cleanup when its output was never archived. This change records output as unavailable after the owning provider proves the original process is gone. If cleanup loses a race with another action, its response now reports the resource's current state.
What Changed
Missing-terminal cleanup requires a bounded owning-provider proof for the original UUID incarnation, then rechecks discovery, terminal, host, owner, process identity and release decision after the awaited probe. A matching resource can complete a requested release with
archive.status: unavailable; existing archives remain intact.When settlement is refused, the response is built from the fresh row: an owned pending release stays pending, an unknown release keeps its diagnostic and recovery guidance, a takeover is retained, and an already released row reports that state. The receipt projection is reused in a separate module, keeping the existing file below its configured line limit.
Why
Requesting release changes the row before the old no-archive guard evaluates it. Truthful output unavailability removes that dead end without inventing an archive. Fresh-row responses also prevent a pending or unknown release from being mislabeled as retained. Concurrent retention, takeover, changed identity, or a reappearing process still blocks settlement.
Linked Issue
Fixes #23712
Visual Proof
N/A — worker cleanup accounting and provider evidence only; no renderer changes.
Testing
macOS ARM64 headless tests: 94 passing tests across all 9 worker-release suites. Coverage includes missing archives, retries, authentic archives, owning-provider proof, reminted identities, concurrent retention/ownership changes, and refused-settlement responses. Node typecheck, default changed-file oxlint, formatting, changed-code quality and ordinary commit hooks passed. No lint suppression or hook bypass was used.
The initial candidate passed an Electron/Vite build. The follow-up was independently checked with the 94 tests, node typecheck and default lint; the build was not repeated. Actual daemon/SSH/WSL/Windows recovery, full repository CI and signed-runtime acceptance remain unverified. Installed production is unchanged.
AI Disclosure
Codex assisted implementation and tests. An independent agent reviewed the frozen source and the four-file follow-up. The account owner requested this recovery work.
Review
The initial 11-file candidate passed an independent 90-test review. The latest four-file follow-up passed independent review, 94 tests, node typecheck and default lint. The committed files match the reviewed byte images. Review receipt SHA-256: 855db14c625e1c047e00dffa0a5d8845064bcc9b5e3ae826457d868560c4c58d.
Source baseline: 9dea72f. Current candidate: 134ae2f.
A subsequent two-line test-comment correction describes the verified settlement accurately. Independent review confirmed that it changes no assertions or behavior; the four verified implementation files are unchanged, and ordinary commit hooks passed. Tests were not repeated for this comment-only commit.
The refused-settlement response correction addresses the Greptile finding. Bot check success is not a maintainer approval or full repository CI result.
Agent skill upstream boundary
Notes
No schema/RPC changes, production database edits, fabricated output, retention toggles or broad terminal closes. Unknown evidence cannot authorize release.
The SSH provider capability finding remains a separate limitation: SSH relay UUID cases without an owning-relay liveness probe stay unverifiable. Supporting them requires an incarnation-aware, read-only relay capability and mixed-version coverage. Attaching a terminal or using incomplete inventory as a death probe is not substituted here.
Official signed release and deployment remain with the maintainer release process; publishing this source does not release any production resource.
Checklist