Forget what a Bot did on the computer that was just reset - #367
Open
zopeVaibhav wants to merge 1 commit into
Open
Forget what a Bot did on the computer that was just reset#367zopeVaibhav wants to merge 1 commit into
zopeVaibhav wants to merge 1 commit into
Conversation
zopeVaibhav
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 4, 2026 17:45
zopeVaibhav
force-pushed
the
fix/clear-activity-on-computer-reset
branch
from
September 4, 2026 17:46
e51d2d0 to
026527c
Compare
zopeVaibhav
force-pushed
the
fix/clear-activity-on-computer-reset
branch
from
September 4, 2026 18:06
026527c to
390cb4b
Compare
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.
Closes #366
What this changes
Resetting a Bot's computer deletes the browser profile it worked on. The activity pane beside the
chat did not hear about it, so the commands and file operations from the wiped profile stayed on
screen, sitting alongside anything the Bot did afterwards with nothing to tell the two apart. Only a
full page reload cleared them, which is likely why it went unnoticed: reaching Admin by typing the
URL reloads the app and empties the store, and the bug only shows when somebody navigates there and
back through the sidebar.
The pane is a module-level store in the browser keyed by Bot id (
byComputerinapp/src/lib/computers/activity.ts), and a reset does not change that id, so the entry survives it.Invalidating
computerKeys.alldoes not reach the store, because the pane is browser-session staterather than a query.
clearActivityalready exists and already carries this exact reasoning in its own comment —"Wiping a computer deletes the machine those commands ran on, so leaving them on screen would
describe something that no longer exists." Nothing in the tree called it. This adds the one call site
it was written for, in the
onSuccessofsetComputerStateMutationOptions.Guarded on
action === "reset". Stopping a browser keeps the profile and is meant to resume where itleft off, so its history is still true of the machine the Bot gets handed back, and clearing it there
would be the same kind of lie in the other direction.
Nothing else changes. The audit trail, which is the record, was correct throughout and is untouched.
The server, the gateway and the computer routes are not modified.
Where it runs
existed rather than adding one. The store is
byComputerandbrowsedinapp/src/lib/computers/activity.ts, module-level in the browser tab and deliberately so: it isa live view of what this session watched happen, not a record. The record is the audit trail,
which is in Postgres and which this does not touch.
reset request already goes to whichever process the load balancer picks and is already
answered the same way by any of them; this only decides what the browser that sent it does
with its own pane afterwards.
on its own memory after its own request succeeded.
performed in one tab does not clear the pane in another tab, or on another person's screen
watching the same Bot. That is unchanged behaviour: the pane never crossed tabs, because it is
fed by the component that watched the run rather than by a socket. Making the reset itself
travel would mean carrying it on the channel events socket and giving the pane a subscription,
which is a real feature rather than a wiring gap, and is worth deciding separately. The failure
this leaves is strictly smaller than the one it removes: the tab that pressed Reset is the one
whose screen was lying to the person who pressed it.
Boundary and audit
call itself is untouched — it is still the same
POSTthroughclient, and thecomputer.resetrow still lands. This runs after that call has already succeeded.A failed reset does not reach
onSuccess, so a reset that was refused leaves the pane exactlyas it was, which is correct: nothing was wiped.
to or read from the server. The
botIdused is the one the browser just sent in its ownrequest URL.
Changelog
CHANGELOG.mdunderUnreleased.Proof
Reproduced first, on
fb999b1, before touching anything.bun run devagainst a deployment with a Bot that has a computer.echo repro-marker-bravo.POST /api/computers/general-assistant/computers/resetreturns200and acomputer.resetrowlands in the audit trail.
After the change, step 6 shows an empty pane.
Regression test.
app/tests/computer-reset-clears-activity.test.ts, three cases: a reset forgetsthat Bot's history, a stop keeps it, and one Bot's reset leaves another Bot's history alone.
Control run. With the
onSuccessrestored to() => invalidateComputers(queryClient)and thetest file unchanged, 2 of the 3 fail:
The one that still passes is the stop case, which asserts the history survives — it should pass
either way, and a version of this test where it did not would be testing the wrong thing.
Checks, on this branch.
The
server/testsroutine-queue and agent-handoff integration suites are flaky on a clean checkoutof
mainhere and were not used as a signal; this branch changes no server file.