Repository navigation
Memory: a refused cleanup takes back only its own changes - #509
Conversation
A parallel batch records results in call order, so a later call's outcome can wait in the batch's buffer, its output file already written, behind an earlier call still running. Once written, the file names left the cleanup guard for a plain vector in the outcome: stopping the turn then dropped the outcome and left the file with no artifact row to find it by, so neither prune nor delete removed it. `Outcome.files` is now `Files`, which removes its files when dropped unless the store recorded them, as a temporary file goes unless kept. `tool_finish` and the background `process_finish` mark them recorded once their savepoint commits. Copies share the files through an Arc, so the held answer a group's rollback snapshot clones doesn't remove them twice; no files allocates nothing. The keeper's own guard folds into it. New runtime test: a batch with a slow call beside a large-output one, stopped after the second wrote its file, leaves no file; it fails on main. Flaky tests sync on events instead of tight wall-clock bounds: - #502: the two sandboxed commands each wait for the other's mark, so they pass only by running at once, with no 1.1 s bound. - #484: the lapse test waits for the answered call to start and gives the gate two seconds instead of 100 ms. Closes #484. Closes #502. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g
…-2jed7q # Conflicts: # docs/DAEMON_MEASUREMENTS.md
…-2jed7q # Conflicts: # docs/DAEMON_MEASUREMENTS.md
The loss guard reverted the cleanup's whole commit, and with it any fact another agent saved or removed while the cleanup was open: git kept it in the refused commit, but memory lost it and nothing told the agent. `cleanup start` now records which agent runs the cleanup (AGENT_BOT_ID, or none for the person). A save or removal by anyone else while it is open is noted in `.cleanup-others` as the fact now stands. When the guard refuses the cleanup, those facts are put back over the revert, each as its agent last left it, their folders reindexed and committed, and the refusal says how many were kept. Snapshot isolation in effect: the guard takes back the cleanup's writes, never another writer's. Closes #471. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 676cc50e17
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…wner, say when kept facts overfill the index Review fixes on the refused-cleanup put-back: - A save or rm hands the cleanup journal the fact as it wrote it while the folder is still locked, instead of rereading the file after the lock is gone, where the cleanup could have changed it in between. - The cleanup's owner is AGENT_STORE#AGENT_BOT_ID: bot ids are each store's own, and stores under one HOME share its memory. - When the put-back leaves a folder's index past its limit (the cleanup's removals made room for saves the revert brings back beside), the refusal says so; nothing saved is dropped to fit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae9b6cfb6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rt and put-back A save between put_back reading the journal and replaying it was overwritten with the older noted text, and a save during the revert itself could be clobbered. The finish now takes every folder's lock, in sorted order, from its commit to its end; saves and removals wait and land after. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g
Fixes #471, flagged as a priority in the day-six external review.
The bug
When the memory loss guard refuses a cleanup, it reverts the cleanup's whole commit. Anything another agent saved or removed while the cleanup was open went into that commit too, so the revert silently took it back. Git still had it in the refused commit, but memory had lost it and no agent was told.
The fix
The guard now takes back only the cleanup's own writes and never another agent's. In effect this is snapshot isolation.
cleanup startrecords who runs the cleanup in.cleanupasby, taken fromAGENT_BOT_ID, or none for the person.saveorrmby anyone else appends the fact as it now stands (its text, ornullfor a removal) to.cleanup-others. The file is append-only JSON lines with mode 0600, and it is git-ignored.git revertruns as before. Then each noted fact is put back as its agent last left it, the affected folders are reindexed under the lock, and the result is committed as "Memory saved while a refused cleanup ran". The refusal message now says how many facts were kept.cleanup start, removes the stale notes file.The memory-cleanup skill's step 6 says this in one line ("Only your changes go back: what other agents saved meanwhile stays"), and the memory row in
sonny/FEATURES.mdis updated.Checks
a_refused_cleanup_keeps_what_other_agents_saved_meanwhile. Another agent saves one fact, rewrites a second and removes a third during a cleanup the guard refuses. All three of its changes survive, and the cleanup's own changes are reverted.cargo test -p agent-client(80 passed),cargo clippy -p agent-client --all-targets -D warningsandcargo fmt --checkall pass.Perf: this changes only the
memoryscript (client crate) and adds no daemon path. A save outside a cleanup costs one extrastatof.cleanup.