Repository navigation
fix(test): write the fake reporter's argv and env atomically and clean the shared delegate dir at exit (#702) - #884
Merged
Conversation
…d remove the shared data dir at exit The stand-in reporter wrote env in several chunks, so a reader that woke between two of them took a prefix for the whole file (seen on CI in a_child_with_a_complete_report_settles_done). Write to a temp name and rename, as fake_tole does. The shared-delegate-data dir of the lib tests is now removed by an atexit hook; the start sweep stays for killed runs. Refs #702 #712.
…ically Same prefix-read race as the delegation reporter: env leaves the process in several writes. Refs #702.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Nov 17, 2026
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
Makes the stand-in child scripts of two lib test modules write their
argvandenvrecords atomically, and removes theshared-delegate-data-<pid>-<hex>directory of the tole-cli lib tests when the test process exits.Why
delegation::delegate::tests::a_child_with_a_complete_report_settles_done_and_the_parent_sees_it_fencedfailed once on CI (PR #880, run 43971776253, jobno-mcp profile; the PR did not touch delegation code). The assertion atdelegate_tests.rs~991 (env.contains("TOLE_DELEGATION_REPORT=...")) printed a truncated environment. Root cause: the stand-in child wroteenv > filein place; a CI runner's environment is over 4 KiB andenvwrites it in several chunks, so a reader that woke between two chunks took a prefix for the whole file.fake_tolealready had the temp-and-rename fix (#828);fake_reporter(and the discussionreviewer_bin) did not. A test race, not a product bug.an_independent_participant_is_a_consult_child_settled_with_its_report(#702) uses the samefake_reporterand is covered by the same fix.The lib tests also left one
shared-delegate-data-*directory per run in TMPDIR (79 accumulated locally); only a 6-hour sweep at the next start removed them.Changes
crates/tole-cli/src/delegation/delegate_tests.rs:fake_reporterwritesargvandenvto*.tmpand renames them into place.data_dir()registers anatexithook that removes its own per-process directory; the start-up sweep stays for killed runs.crates/tole-cli/src/discuss/tool_tests.rs:reviewer_bingets the same temp-and-rename treatment forargvandenv.Tests only; no production code changed.
Testing
taskset -c 0, 3-4 busy loops,--test-threads=16, all green:wire_size_missions100 loops;delegationlib 40 loops default and 40 loops--no-default-features;session_effort_e2e8 loops;agents10 loops. 80 delegation-lib loops left no newshared-delegate-data-*dir.session_effort_e2e(fork/exec mutex from flaky test: session_effort_e2e::a_rejecting_provider_still_answers_without_the_parameter (session lock still held by the test process) #646, mock reads until the body parses),wire_size_missions(port 0, reads to Content-Length, read timeout), and theagentsload guard (the tests already open it to its bound of 64 load per CPU, which a CI runner cannot reach).--all-features,--no-default-features, shell-tools only),cargo check -p tole-core --no-default-features --tests: clean. Fullcargo test --no-fail-fastwithTOLE_REQUIRE_BWRAP=1in the default,--no-default-featuresand shell-tools profiles: no failures. Delegation and discuss lib tests re-run 3x default and once--no-default-featuresafter the last change: green.atexitcleanup, and ran the delegation lib tests including undertaskset -c 0). CI: all 19 checks green and Cora Review "No issues found" on the final head.corais not installed on the author's host; the CI Cora review is the gate.Refs #702, #712, #738