Repository navigation
fix(computer): never execute or overwrite a dead command - #111
Conversation
|
Reviewed head High-value fix: the CAS preserves a Stop/recovery receipt, and the second command-row read prevents executing a command already marked interrupted at that boundary. The regressions check both receipt preservation and absence of Docker execution. No new security or template-fit blocker found in this diff. All seven current GitHub checks pass. Please record the check commands/results in the description. Also preserve these guards when reconciling with the computer-backend extraction in #133; an interrupted receipt must continue to mean the user should inspect before repeating the operation. This was static review; I did not rerun Docker tests. |
jerelvelarde
left a comment
There was a problem hiding this comment.
The two guards are valuable and the original-head behavior is sound, but this PR cannot merge into current main: GitHub reports mergeStateStatus DIRTY / mergeable CONFLICTING in the command-execution area.
Please rebase and adapt the new CAS/fallback/post-lease reads to the extracted backend implementation. Current main stores command receipts through this.receipts (separate Docker and desktop stores) and dispatches via session.exec; the added code still hard-codes "computer-commands" and is attached to the old Docker-only executor. Preserve the two guards using the active backend's receipt store, then rerun the regressions plus desktop-backend tests so desktop commands cannot bypass the interrupted-receipt check.
Validation: all 14 tests in tests/computer.test.ts pass locally on the current PR head, including both new race regressions; root TypeScript and changed-file Biome checks pass. Existing GitHub checks are green for that old head, but cannot establish integration with the now-conflicting backend. Requesting changes for integration readiness, not a failure of the tested Docker-only fix.
Adapt the two race guards to the extracted backend receipt store and session.exec path. Add desktop coverage requested by @jerelvelarde.
|
Thanks — reconciled against the extracted backend on the current head. Both guards now use |
jerelvelarde
left a comment
There was a problem hiding this comment.
Re-reviewed updated head: earlier backend integration blocker is resolved. Guards use active this.receipts and session.exec paths across Docker/desktop and preserve quarantined/interrupted receipts before dispatch. All 56 computer/E2B desktop tests passed, including three receipt-race regressions; current main merges cleanly. Useful command-safety fix, clear template limits, no remaining actionable security/correctness finding. Current exact-head seven CI checks are green.
Problem
There are two races after a computer command row is created:
put().interruptedreceipt even though side effects actually ran.That second case is particularly dangerous because it can invite a retry of side effects whose outcome is already unknown.
Change
status: "running"; if another path already quarantined the row, return that receipt unchanged.Tests
Two race regressions pin both boundaries:
No command schema, timeout, or successful execution behavior changes.
Current-main adaptation
After @jerelvelarde pointed out the computer-backend extraction, the two guards were moved onto the active backend receipt store (
this.receipts) and the currentsession.execpath instead of the old Docker-only implementation.The regressions now cover both Docker and the E2B desktop receipt store; a desktop command whose receipt becomes interrupted after lease validation is asserted never to dispatch.
Verification
Fresh CI on the reconciled current-
mainhead:quality: passedcomputer-container: passedbrowser: passedbrowser-container: failed in the unrelated worker/sessions/<id>/downloadsfixture withWORKER_FAILURE.Integration limits
The guards prevent dispatch at these two pre-execution race boundaries. They do not claim cancellation of a command already dispatched to a backend.