Record a computer reset as soon as the profile is gone - #404
Merged
Conversation
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 6, 2026 13:33
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
# Conflicts: # CHANGELOG.md
davidmckayv
approved these changes
Sep 6, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Deep-reviewed against live code (correctness, governance, no vendor/secret/scale issues). Composed build+tests green. CHANGELOG/format rebase on CI-validated substance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
resetComputersays of itself:The row is written last:
Both clears are database deletes. A connection reset, a failover or a statement timeout in either
throws before the row is reached, and the throw propagates. The profile is already destroyed by
then —
provider.resetran first and there is no undo — so the outcome is a computer with everylogin wiped and nothing on the trail saying who did it or when. That is precisely what the note
above rules out, and it is the one action where the trail is the only record that survives.
Measured, with a snapshot store whose
clearrejects:and the same for the screenshot store.
Fix
The row is written as soon as
provider.resetreturns, which is the point of no return, and the twoclears follow. Nothing else moves: the reason string still comes from
result.cleared, both clearsstill run in the same order, and a failure in either still propagates, so the caller is still told
the clears did not finish.
Writing it before the deletes rather than wrapping them is deliberate. Swallowing the delete failure
would make the row a claim the deployment cannot back — the screenshots are the part the comment
below
snapshots.clearsays made "every login is gone" untrue in the first place — so the honestrecord is a reset that happened, with the failure surfaced to whoever pressed the button.
Where it runs
and both clears are keyed by
botId, so a second replica sees the same reset with the samerow whichever process served it.
provider.resetremains the single destructive step andthe deletes are unconditional by
botId, so two resets racing converge on the same end state.Boundary and audit
own steps is what changed.
failed delete used to write no row at all; now it writes one and still reports the failure.
Changelog
CHANGELOG.mdunderUnreleased.Tests
Two in
server/tests/computer-gateway.test.ts, beside the existing reset tests:clearrejects: the reset still recordscomputer.resetagainst the bot,and the failure still reaches the caller
clearrejects: sameAgainst
mainboth fail withReceived: [].How I tested
Windows 11, Bun 1.3.14.
bun test server/tests/computer-gateway.test.tsis 59 passed, 0 failed, upfrom 57 by the two new tests. Neighbours unchanged:
computer-client18,computer-sandbox8,computer-provider12,computer-session-guard5,audit7, all passing.bun run --filter server typecheckandbunx biome checkare clean.