Repository navigation
fix(agent): count a script's write the file clock dates a tick early - #8130
Conversation
A file a script wrote at the start of its run could be reported as
never written ("No successful write to `recon_tables.xlsx` is recorded
for this turn"), and the bare-output test failed now and then on Linux
CI on unrelated branches.
A run's window started at time.time_ns(), but Linux and Windows date
file writes by a coarser clock that trails it by up to one tick (4 ms
and 15.6 ms), so a write in the run's first few milliseconds looked
older than the run. The window now opens 20 ms earlier: longer than
either tick, and far shorter than any gap between two tool calls.
|
Verdict: Approve This fixes a real false alarm. The agent could tell the user a file was "never written" when a script had in fact written it right at the start of its run. That happened because the file system stamps writes slightly behind the precise clock the run's start time came from. Opening each run's window 20 ms earlier covers one clock tick on Linux and Windows, and the new test reproduces the race without relying on timing luck. I found nothing blocking. Real-world evidenceN/A: no evidence bundle was produced for this PR. The change is an internal timing margin with no CLI, UI or API surface to exercise directly. The verdict rests on static review alone; I couldn't run the tests here because pytest isn't installed in the review environment. 🔍 Technical detailsIssues found 🟢 Shifted windows can now overlap back-to-back runs (
Strengths
|
Main now starts a run's window 20 ms early for the file clock (amd#8130); the PR also dates a file by its ctime so a copy counts. Together they credited a file created a few ms before the run, which is what failed the Windows unit lane, not a metadata-change stamp: the earlier st_birthtime change is backed out. The stale-file test now creates its file before that slack, as a real file from an earlier turn is.
A file a script wrote at the very start of its run could be reported to the user as never written ("No successful write to
recon_tables.xlsxis recorded for this turn"), even though it was on disk. The same race madetest_a_bare_output_a_script_wrote_beside_the_named_input_is_foundfail now and then on Linux CI, on branches that never touched the agent. After this, such a write counts, and the test is stable.The run's window started at the precise wall clock, while Linux and Windows date file writes by a coarser clock that trails it by up to one tick. The window now opens 20 ms earlier.
Test plan
test_a_write_the_file_clock_dates_a_tick_early_is_still_the_runsfails before the change with the CI message, passes aftertest_completion_evidence.py,test_agent_loop_completion_scope.py,test_grounding.pyand six others)