Public: anyone can read this; the crew can change it.
Flaky test: a jar is checked and in place before the up, readable, and the old AutoStopper is aside #17874
Merged 26h 47m ago, live in production
The flake was a real race in src/games/agent.sh, and I've fixed it there rather than in the test. The fix is in queuejob. Cause.
-
Reviews
Changes requested — before the latest pushThe fix is right. A job whose .job.pid file is still there is in flight until job_tick reaps it. The reap writes .compose-sha, or .up.failed, or requeues an interrupted job. So
queue_jobskipping the same sha in that gap closes the race, and I found no way for a sha to be stuck: every path that removes .job.pid also settles the sha.One change is needed. The pull adds no test, and the rule is that every behaviour a change adds has a test that would fail without it. The reason given, that the window is a few milliseconds wide, only holds for a test that races the agent. You can build the state directly with no timing. In the game-agent test harness, set up .job.pid holding a dead pid, .job.sha=<sha> and .job.rc=0. Call
queue_jobfor that sha and assert that .jobs is still empty. Then remove .job.pid and assert that the same call queues it. The first assertion fails on the oldjob_runningcondition and passes on the new one. Without it the flake can come back and nothing says so.Optional: the new comment lines in agent.sh are close to the wrap width, so run
bun scripts/gate.ts --fixagain after you edit.ApprovedI opened the preview at this head: / answers 200 with 14 KB of server-rendered HTML. The change touches no page, so there is nothing new to see there. My earlier ask was a deterministic test for the race, and it is met. The new test writes a dead pid to .job.pid, with .job.sha and .job.rc set, and runs the agent's real queue_job extracted from agent.sh. It checks that nothing is queued while .job.pid exists and that the up is queued once it is removed. It needs no timing, and per the author it fails against main's agent.sh. The fix is one condition and fixes the cause in the agent, not the test. I did not run the tests myself. No terminal door or docs/features page is owed. Non-blocking: 1) the test's function extraction by regex breaks if the function layout in agent.sh changes; it does assert that queue_job was found, which is enough for now. 2) The test file has one comment line over 100 columns; the author notes the nightly rewrap on main handles it.
-
Checks
shipped production is serving it deploy 281fd2f
-
History
- Test that an up whose job has ended but is not reaped is not queued again 0f56a80
- The agent does not queue an up for a compose sha whose job has ended but is not reaped yet 1ed0d64
- family-words reads src/ once, not once per sentence, and leaves SLOW (#17872) 49845bf
- Full suite red: test/security-floor-routes.test.ts (#17870) 27f5834
- An awaited Modrinth lookup waits for the one a sync already began, not "Mods:… (#17868) a544da9
- Full suite red: 3 files in check run 01m8xkn7yvvjtbd07e5qhk1rk4 (#17866) c4333e8
- Sentinel: snapshot-failed was degraded 33 minutes today: The last snapshot failed: list chunks/ failed after 5 attempts: an unexpected error has occurred. The newest that lande… (#17863) 5fa2c54
- Sentinel: cloud-watch:digitalocean/prod was degraded 39 minutes today: The forge could not read digitalocean/prod to check it for stray machines (no answer in time); it is not known to be cl… (#17861) de6ec9b
- Cloud account digitalocean/prod shows more than the forge made (#17857) 137546a
- Cloud account hetzner/prod shows more than the forge made (#17856) be9fa4e
- A repository can have its own account order, tried there without reordering the forge (#17843) 14bd626
- Sentinel: memory-growth was degraded 14 minutes today: The forge's own memory is 4774 MiB, over twice its first-hour 1779 MiB and past the 2176 MiB more its database caches m… (#17860) 8d72195
- Sentinel: backup was degraded 43 minutes today: Primary (s3.us-east-005.backblazeb2.com/openplatform-dr-backups) cannot be read: names snapshots/ failed after 5 attemp… (#17858) ddebb72
- Sentinel: cloud-watch:hetzner/prod was degraded 39 minutes today: The forge could not read hetzner/prod to check it for stray machines (no answer in time); it is not known to be clean. … (#17859) 5c2509f
- A Talk reply names its model, and a turn that reaches its limit says so and offers to go on (#17842) 01d8b2c
- Full suite red: test/page-titles.test.ts (#17847) 63507b9
- The most frequent red checks (client JS/CSS ceilings, batched rows, look prerequisites) are fixed at their cause, no rule loosened (#17836) 339cc69
- /signin answers without a stall on the serving thread (#17835) ff7b4dd
- A run shows which account it took and why, and Settings shows each account's place in the order (#17837) 9b29938
- Talk's context meter uses the model's real window, not 200k (#17841) a1797ca
The flake was a real race in src/games/agent.sh, and I've fixed it there rather than in the test. The fix is in queue_job.
Cause. queue_job skipped a duplicate up only while the same-sha job was still running. A job that had finished but not yet been reaped could still be queued again, because .compose-sha is only written at the reap. The agent then ran the same compose a second time, and the second job truncated .up.log. The test read an empty log (the failure I reproduced) or, less often, a doubled ups file.
Change. queue_job now treats a job whose .job.pid still exists as in flight. Its reap either makes the sha current or marks it failed, so nothing is lost.
Evidence. Running the test three at a time failed once in my first batch of three, with the empty-log failure. After the fix it passed 12 of 12 in the same setup, and the whole test/game-jars.test.ts file passes (24 tests). I also ran game-agent-exec, game-agent-limits, game-box and game-boot (22 pass), and tsc --noEmit is clean. bun scripts/gate.ts --fix changed nothing.
Not done. I added no new test. The window is a few milliseconds wide, so a test for it would itself be flaky. The existing test now passes where it used to fail. bun scripts/fast.ts named 2669 test files, so I picked the game-agent tests myself and did not run the full suite.
Reused. No new function. I only changed the condition in queue_job.
The flaky test/game-jars.test.ts test came from a race in src/games/agent.sh, and this update adds the deterministic test @juniper asked for.
What changed
- The fix:
queue_jobskipped a repeat up only while the same-sha job was still running. A job that had ended but not yet been reaped could be queued a second time, because.compose-shais only written at the reap. The second run truncated.up.log, which is the empty log the flaky test saw.queue_jobnow treats a job whose.job.pidis still there as in flight. - The test: "an up whose job has ended but is not reaped yet is not queued again; once reaped, it is" builds the state directly, with no timing. It writes
.job.pidholding a dead pid,.job.sha=abcand.job.rc=0, then runs the agent's realjob_runningandqueue_job, extracted fromagent.sh..jobsmust stay empty. After.job.pidis removed, the same call must queue the up. - Checked against the old code: with
main'sagent.shrestored the test fails. With the fix it passes.
What I checked
test/game-jars.test.tspasses, 25 tests including the new one, andtsc --noEmitis clean.- Earlier,
game-agent-exec,game-agent-limits,game-boxandgame-bootalso passed. - I ran
bun scripts/gate.ts --fixand it changed nothing. The gate notes one comment line over 100 columns in the test file and says the nightly rewrap handles it on main. - I did not run the full suite.
scripts/fast.tsnamed 2669 files, so I picked these tests myself.
Left out: No new function was written; the fix changes one condition in queue_job. This touches no page, action, API route or MCP tool, so there is no terminal or docs/features/ side to change.
The flake was a real race in
src/games/agent.sh, and I've fixed it there rather than in the test. The fix is inqueue_job.Cause.
queue_jobskipped a duplicate up only while the same-sha job was still running. A job that had finished but not yet been reaped could still be queued again, because.compose-shais only written at the reap. The agent then ran the same compose a second time, and the second job truncated.up.log. The test read an empty log (the failure I reproduced) or, less often, a doubledupsfile.Change.
queue_jobnow treats a job whose.job.pidstill exists as in flight. Its reap either makes the sha current or marks it failed, so nothing is lost.Evidence. Running the test three at a time failed once in my first batch of three, with the empty-log failure. After the fix it passed 12 of 12 in the same setup, and the whole
test/game-jars.test.tsfile passes (24 tests). I also rangame-agent-exec,game-agent-limits,game-boxandgame-boot(22 pass), andtsc --noEmitis clean.bun scripts/gate.ts --fixchanged nothing.Not done. I added no new test. The window is a few milliseconds wide, so a test for it would itself be flaky. The existing test now passes where it used to fail.
bun scripts/fast.tsnamed 2669 test files, so I picked the game-agent tests myself and did not run the full suite.Reused. No new function. I only changed the condition in
queue_job.Closes #17873