Repository navigation
fix(sandbox): preserve routes across create and cleanup races - #4277
Conversation
Independent source review — #4277Verdict: no blocking finding in the four-file N1–N3 repair at Identity: independently verified all four frozen source SHA256 values and all fifteen retained receipt SHA256 values in Mechanism review
Regression and retained execution evidenceRead the new tests, existing race/lost-answer/cancellation/tenant tests, placement publication implementation and tunnel pre-send boundary. New regressions use the real filesystem publication seam and real paired in-memory tunnel endpoints. The publication barrier is restored in The retained old-source run contains seven causal failures: two old done/pending sweep answers corrupting the new route; removed/replaced candidates during a previous refusal; removed/replaced connections during durable publication; and fresh unsent tunnel-saturation stickiness. Both adversarial remote-503 lookalike controls already pass on the old source. The repaired run is 9/9 with 48 assertions. Its established-placement saturation assertion verifies that the new fallback does not relocate an existing workspace. Retained actual local execution, not cached status: hub/placements/tunnel 90/90, 412 assertions; full sandbox 967/967, 3,884 assertions across 49 files (64.62 seconds). Inspected the successful scoped TypeScript/lint, four-file format, manual register, links, SAST and diff-check receipts. An initial missing dependency binding attempt is separately preserved as setup failure and is not counted as a product regression. LimitsThis reviewer made no source changes and ran no tests, containers, browser sessions, devices or CI. The tests are the author's retained Darwin/Bun execution with real temporary filesystem and in-memory tunnel transport, not a physical-device or Linux deployment proof. Fresh hosted CI, exact-head review/protection state and current-main composition remain the merge gate. Deliberately conservative errors other than the explicitly proven pre-send cases can still retain a route; no blanket offline/error fallback is accepted. |
A deleting sweep could remove or mark a newly created device session’s route as deleting while its placement write was in progress. Candidate selection could also outlive a device connection, and a create rejected locally before transmission kept a route that no remote session could use.
Destroy finalization now checks the captured placement identity as well as the existing create generation under the per-session ordering. Create admission rechecks the registered connection and eligibility, then checks that connection again after durable publication. A private forwarding outcome permits fallback only for a fresh create proved unsent; remote errors, lost answers, abandoned calls and retries of existing placements retain their conservative routing behavior.
Addresses N1–N3 in the independent #4189 follow-up review. Updates the existing device-routing contract and automated manual-test references.
Validation on Bun 1.4.2, macOS:
These are local protocol/filesystem checks. Fresh hosted CI and independent review remain the merge gate; no deployment or real remote-device acceptance is claimed.