Repository navigation
A cut output's file stays its outcome's until the store records it; two flaky tests sync on events - #505
Merged
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
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: bb27dcbdbd
ℹ️ 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".
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
lydakis
added a commit
that referenced
this pull request
Oct 31, 2026
* A cut output's file stays its outcome's until the store records it 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 * Record #505's matched perf screen Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Memory: a refused cleanup takes back only its own changes 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 * Memory: note others' changes under the folder lock, store-qualified owner, 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 * Memory: a cleanup's finish holds every folder's lock through its revert 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 --------- Co-authored-by: Claude <[email protected]>
lydakis
added a commit
that referenced
this pull request
Oct 31, 2026
* A cut output's file stays its outcome's until the store records it 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 * Record #505's matched perf screen Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Memory: a refused cleanup takes back only its own changes 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 * Memory: note others' changes under the folder lock, store-qualified owner, 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 * Memory: a cleanup's finish holds every folder's lock through its revert 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 * Triggers: each HOME has labels of its own launchd keeps one domain per user and systemd one user manager, whatever HOME is, so a test's or an eval's HOME added its triggers beside the user's own, under the same labels: a same-named trigger replaced or removed another HOME's, and one left loaded after its HOME was deleted fired into nothing. A trigger's label is now me.lydakis.agent.trigger.TAG.NAME, TAG being eight hex digits of a hash of HOME (FNV-1a 64, folded to 32 bits, trailing slash left out). Sonny's start moves each trigger made before labels had the tag to its tagged label, once, rolling back one that will not load. A fire whose HOME is gone removes its definition and unloads its own job, by the label launchd (XPC_SERVICE_NAME) or systemd (its cgroup) runs it under. Closes #453. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Triggers: the relabel moves only triggers made from this HOME systemd's unit folder can be shared by several HOMEs (one absolute XDG_CONFIG_HOME); a trigger whose definition runs with another HOME is that HOME's to move, at its own Sonny's start. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g --------- Co-authored-by: Claude <[email protected]>
lydakis
added a commit
that referenced
this pull request
Oct 31, 2026
…ne/day-two condition (#520) * A cut output's file stays its outcome's until the store records it 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 * Record #505's matched perf screen Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Memory: a refused cleanup takes back only its own changes 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 * Memory: note others' changes under the folder lock, store-qualified owner, 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 * Memory: a cleanup's finish holds every folder's lock through its revert 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 * Triggers: each HOME has labels of its own launchd keeps one domain per user and systemd one user manager, whatever HOME is, so a test's or an eval's HOME added its triggers beside the user's own, under the same labels: a same-named trigger replaced or removed another HOME's, and one left loaded after its HOME was deleted fired into nothing. A trigger's label is now me.lydakis.agent.trigger.TAG.NAME, TAG being eight hex digits of a hash of HOME (FNV-1a 64, folded to 32 bits, trailing slash left out). Sonny's start moves each trigger made before labels had the tag to its tagged label, once, rolling back one that will not load. A fire whose HOME is gone removes its definition and unloads its own job, by the label launchd (XPC_SERVICE_NAME) or systemd (its cgroup) runs it under. Closes #453. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Triggers: the relabel moves only triggers made from this HOME systemd's unit folder can be shared by several HOMEs (one absolute XDG_CONFIG_HOME); a trigger whose definition runs with another HOME is that HOME's to move, at its own Sonny's start. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Trigger tests: an ended one-off keeps its row until its turn is done Since #442 a sent one-shot's row stays, ended, until its turn is known to have completed; only Sonny's window and the served tool forget it. The real-launchd and real-systemd tests still expected an empty list after the one-off ended itself, so both failed there (neither runs in CI). They now expect the one ended row. Closes #511. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Memory eval: a learned condition, day one hears the fact, day two applies it The day-six review asked whether a fresh lead on day two applies what day one learned. The memory condition seeds facts by hand; learned installs the skill, saves nothing, and on day one has a new agent in the project hear the fact from the person in passing, with nothing to change. Day two's fresh agent, in the same HOME, gets the task: only what the first agent chose to save can carry it. Rows record day one's status and the facts it saved; the summary counts day_one_saved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g * Memory eval: find day two's turn from its accepted event; record the 10-31 run Day one and day two share a daemon, so day two is not turn 1; the script waited on /1 and got turn_not_found. Take the turn from the run's accepted event, record day one's rounds and tokens, and assert both in the synthetic test (which failed before this change). docs/MEMORY_EVAL.md gets the 2026-10-31 run on openai/gpt-6.1-sol: learned 6/6, memory 9/9, none 3/9. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013jkdGFBzSEQmnVuCCNV83g --------- Co-authored-by: Claude <[email protected]>
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.
Follow-up to #485, from the day-six external review, plus the two timing-dependent tests it flagged.
The gap in #485
A parallel batch records its results in call order. A later call's outcome can therefore sit in the batch's buffer, with its output file already written, while an earlier call keeps running. Once the keeper returned, the file names had left
Kept's drop guard and sat in a plainVecinOutcome.files. If the turn was stopped at that point, the outcome was dropped and the file stayed on disk with no artifact row naming it, so neither prune nor delete would ever find it.Reproduced on main: the new test leaves
TURN-shell-2-stdoutbehind and fails.The fix
Outcome.filesis nowtools::Files. It removes its files when dropped unless the store has recorded them, the way a temporary file goes away unless it is kept. Ownership now lasts through the database handoff:tool_finishcallsfiles.recorded()right after its savepoint commits. This covers every call path, including the batch's ordered writer.process_finish.Arc, so the held answers that a group's rollback snapshot clones (Live) never remove the files twice. When there are no files, which is the usual case, it allocates nothing.Kept's ownDropis folded into this type.What remains: a group commit that fails after the savepoint took the files leaves them on disk. That is the same class as the daemon crash between write and record that #485 already documented.
Flaky tests
tool_startedbefore the gate's lapse matters, and gives the gate 2 s instead of 100 ms. The daemon has no op to make a gate lapse on demand, so the lapse is still a clock. The difference is that the test now asserts its precondition (the call started) instead of racing it.Checks
cargo fmt --check,cargo clippy -p agent-runtime --all-targets -D warnings, andcargo test -p agent-runtimeall pass.test_accounting,test_answeredandtest_approvals, with bubblewrap andAGENT_TEST_SANDBOX=1: 90 tests OK.Perf: when nothing is cut, the cost is one
Optioncheck per recorded result and no allocation. A cut call adds oneArc.Closes #484. Closes #502.