fix(workspace): recover ambiguous ownership without duplicate reuse - #1442
fix(workspace): recover ambiguous ownership without duplicate reuse#1442vincentkoc wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 24, 2026, 3:49 AM ET / 07:49 UTC. ClawSweeper reviewWhat this changesThis PR retries ambiguous SSH workspace-owner acquire and renewal responses within bounded deadlines, adds a native-Windows Job Object supervisor for witnessed workloads, and updates the related tests and run documentation. Merge readiness⛔ Blocked until stronger real behavior proof is added - 5 items remain Keep open. Static review found no discrete patch defect, but the PR’s own exact-head evidence still lacks the required native-Windows final-effect and complete WSL2 lifecycle proof for this authority-bearing change. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherThe workspace-owner subsystem serializes access to reused SSH workspaces before sync, execution, collection, and cleanup. It turns remote ownership responses and child-record state into either permission to continue a retained run or a fail-closed cleanup/reuse decision. flowchart LR
A[CLI run request] --> B[Workspace owner protocol]
B --> C[SSH owner and child records]
C --> D{Response and record valid?}
D -->|confirmed| E[Retained workload]
D -->|ambiguous response| F[Bounded reconciliation]
F --> E
D -->|record changed| G[Stop native Windows job]
G --> H[Safe workspace reuse]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The source contains record revalidation and kill-on-close handling, but the changed authority boundary still needs exact-head final-effect proof. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Add redacted exact-head native-Windows record-tamper final-effect evidence and a successful Windows-to-WSL2 retained-workload lifecycle before merging. Do we have a high-confidence way to reproduce the issue? Yes for the central source path: the pre-PR acquire code returned exit 7 immediately on a transport error, and the new focused tests simulate lost acquire and renewal responses. No complete exact-head native-Windows or WSL2 live reproduction is available. Is this the best way to solve the issue? Unclear; bounded same-token reconciliation and identity-checked Windows supervision are narrow approaches, but their required final effects remain unproven on the exact head. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a131bae570da. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (19 earlier review cycles; latest 8 shown)
|
23ab3fa to
f92135a
Compare
|
@clawsweeper re-review The reviewed head is stale; The legacy two-line POSIX record remains intentionally fail-closed. It has no sentinel identity or process-group authority, so it cannot prove descendant ownership or safe termination. Treating it as recoverable would reintroduce the unrelated-process/PID-reuse risk this change removes. This is the explicit owner decision for this persisted-state boundary; no compatibility path is intended. Please review the exact head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
f92135a to
eda596d
Compare
|
@clawsweeper re-review Please review exact head This head closes the two startup-cleanup findings from Sol/high: POSIX no longer reopens an orphaned FIFO during failed startup, and native Windows establishes the identity-bound job supervisor before child-record publication and cleans every rejected startup through exact process handles. The production delta remains at the approved net The explicit legacy-record decision remains unchanged: old two-line POSIX records fail closed because they cannot prove sentinel or process-group authority. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4b970cd to
e84d5f3
Compare
e84d5f3 to
55d4fcb
Compare
8c0bcb2 to
b7c62e4
Compare
|
@clawsweeper re-review Please review exact head This fixes the prior security P1 at the native Windows supervisor owner: after a publication handshake, the supervisor revalidates its exact PID/start-time child record on every poll and closes the kill-on-close job on record removal or mismatch. A Windows-only regression proves both record removal and identity tampering terminate the workload leader and descendant before inspect/reuse, then release with zero residue. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
b7c62e4 to
d08073d
Compare
|
@clawsweeper re-review Exact head: Please review the scope-B boundary: bounded ambiguous acquire/renew reconciliation, unchanged POSIX two-line direct-child witnessing, and native Windows-only Job Object containment with supervisor-record revalidation. Kernel-owned POSIX descendant containment is deferred to #1488. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Exact-head live proof update for
Hosted exact-head CI is fully green ( |
|
@clawsweeper re-review Exact head remains The PR body and #1442 (comment) now contain redacted exact-head live evidence. Native Windows and POSIX pass with zero residue, but the real WSL2 workload path is blocked: its ownership-expanded argv wrapper is |
|
🦞🧹 I asked ClawSweeper to review this item again. |
d08073d to
bdd59ba
Compare
|
@clawsweeper re-review Rebased onto the landed WSL2 stdin transport prerequisite. Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Related: #1488
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where users reusing an SSH workspace could see a retained run abort after an acquire or renewal response was lost, even when the remote ownership mutation had succeeded.
Native Windows also needs the witnessed process tree to stop before the workspace is reused when its published supervisor record is removed or changed.
Why This Change Was Made
Acquire retries are bounded by the configured ownership wait and use same-token idempotence to reconcile a lost success response. Renewal retries are bounded by the last confirmed ownership TTL; mismatch and expiry remain terminal.
Native Windows keeps the identity-checked Job Object supervisor and revalidates its exact PID/start-time record on every poll, closing the job on record loss or mismatch. Linux, macOS, and WSL2 retain the current two-line direct-child PID/start-identity witness. This PR makes no POSIX descendant-containment claim; kernel-owned POSIX containment is tracked in #1488.
No configuration, protocol action, readiness behavior, or secret handling changes.
User Impact
Brief response loss no longer aborts a retained run while ownership is still provably within its deadline. Native Windows descendants are terminated before inspection and reuse after supervisor-record loss or tampering. POSIX completion and direct-child ownership behavior remain unchanged.
Evidence
bdd59ba9805b8e172fdbcccb344d8fa4b62ed9970364ddb5c4d2462a152db4d232f74f4f7604681bgo vet ./internal/cli/...: passgo build -trimpath ./cmd/crabbox: passgofmtandgit diff --check: passbdd59ba9805b; no source-code finding, but proof remains blocked on the native Windows authority boundary and a complete WSL2 lifecycleowner=0 child=0 run=0 launcher=0 tmp=0with zero local spools.owner=0 child=0 run=0 witness=0 tmp=0, zero local spools, lease released. The earlier combined-head proof covered record removal/tampering and descendant termination, but it is not substituted for fresh exact-head final-effect proof.wsl.execontrols both passed. The exact owner acquire stayed ambiguous for 168 seconds while broker heartbeats timed out, then failed closed. Three exact task wrappers were mapped and stopped; finalowner=0 child=0 run=0 launcher=0 tmp=0, zero local spools, lease released and absent.+158/-40, net+118lines, justified by bounded reconciliation and the native Windows security boundary+467/-5; docs and changelog:+11/-3Current Blocker
Do not merge until a maintainer resolves ClawSweeper's exact-head proof hold. Fresh native Windows record-tamper final-effect proof and a successful Windows-to-WSL2 acquire/renew/workload/release lifecycle remain unavailable; all exact task leases, processes, remote residue, and local spools are cleaned.