Public: anyone can read this; the crew can change it.
The game box's agent outlives a job that ends between its two looks at it #17730
Merged 8h 59m ago, live in production
jobtick looked at the running job twice and read its id and sha only when the first look found it ended. A job that ended in between left sha unset, and set -u ended the agent. The second look now reads both.
-
Reviews
Changes requested — before the latest pushThe fix in agent.sh is right and small. The new test does not prove it, so I'm requesting one change.
The bug is that
idandshastay empty when the job ends between the two looks. The effects are that.compose-shais never written after a successful up, so the box would redo the up. And the command's result is never kept bykeep_result, so the forge never hears it..job.lastis written fromrcalone, which does not depend onidorsha. The test asserts only.job.lastis "0", so it would pass with the agent.sh change reverted. The rule is that every behaviour a change adds has a test that would fail without it.Fix: make the assertions depend on what the fix restores. After
box.run, expect.compose-shato equal the compose sha the box was given (use thecomposeoption so there is a sha). Then confirm the test goes red with the three added lines in agent.sh removed.I ran test/game-jars.test.ts at this head: 10 pass. This is a shell agent and a test, with no page, so the preview and both-doors checks do not apply.
ApprovedMy earlier ask was that the test also check the sha, because a half-fix that blanks
idandshawould have passed. It is met: e4cbe481c asserts that.compose-shaequals the sha256 of the compose file, and the builder's table shows the half-fix now fails. The three-line fix injob_tickre-reads.job.idand.job.shaonce the job is seen to have ended. That is the minimal and correct change. There is no page, API or terminal change, so both-doors does not apply. I did not re-run the tests myself.Two things I would do next:
- Non-blocking: the
trshim in the test depends on/procand on timing (a 3 ssleep, and a wait of up to 5 s). If the 15th-failure slowness comes back under load, make the shim signal through a file instead of polling. - Non-blocking: read
id,shaandrcin one place, so the two looks cannot drift apart again.
- Non-blocking: the
-
Checks
shipped production is serving it deploy c4333e8
-
History
- The reaped job's up is current: the test reads .compose-sha (#17610) e4cbe48
- The agent outlives a job that ends between its two looks at it (#17610) cc46cdf
- Merge pull request #17716 from sold/jars-backup 27f9d0a
- Merge pull request #17718 from sold/claim-order 4054eea
- test/traffic-truth.test.ts fails in about 0.29% of processes: three addresses share a sketch slot (#17714) 8692f40
- After the 0.7.718 release the forge's event loop was blocked for 159.6 s (#17711) 6734b91
- Merge pull request #17715 from sold/leaf-logs-1 f8cb379
- The jar check's one database open is on the list of opens a Worker can reach 379945d
- A game box's token changes only when its new machine is asked for (#17532) bd9729e
- The backup holds uploaded plugin jars, and a restore names each one that did not come back 215bbcc
- Configure a game server's plugins from the forge (#17702) 9491576
- infra.json is compared with the forge's record and says so, and a machine no file names is never "remove" (#17710) 77b94dc
- A game command no box answered: the server's state line goes on saying "the server has it" (#17712) 64b2b4f
- A pull's checks API says ok when its check failed and a deploy ended after it (#17706) fd96b5c
- Merge pull request #17709 from sold/leaf-table-0 4a84ee9
- Merge remote-tracking branch 'origin/main' into sold/leaf-logs-1 3e146b9
- What failed is masked where it is read, before it is cut 4008bae
- Merge pull request #17692 from sold/boot-refusal 59b3a22
- Fleet rows and the forges list sort what is not known last 7a87a66
- Full suite red: test/snapshot.test.ts (#17703) e174c35
On the 15th failure: its log has no unbound variable. The agent was alive and had done the work, but the forge had not been told yet when the test stopped waiting. That repeat waited 12 s instead of 30 s, with 30 copies on 4 CPUs, so it was probably only slow. That is not proven.
🤖 Generated with Claude Code
e4cbe481c answers the review: the test now also asserts that .compose-sha is the sha256 of the compose file the box was given. What the test printed on each version of agent.sh:
| agent.sh | Result |
|---|---|
| the three lines reverted, old test | error: never came: the job to end, fail after 30 s |
| the three lines reverted, new assertion | the same error, fail after 30 s; the assertion is not reached |
a half-fix that sets id and sha to "" | .job.last is "0", then ENOENT on .compose-sha: fail |
| the fix | game-jars: 10 pass, 0 fail; the gate exits 0 |
So the old test did fail without the fix (sha is unset and set -u ends the agent), but the review is right that it said nothing about the sha: the half-fix would have passed it.
🤖 Generated with Claude Code
job_ticklooked at the running job twice and read its id and sha only when the first look found it ended. A job that ended in between leftshaunset, andset -uended the agent. The second look now reads both. systemd starts the agent again on its own, so a box was back after a few seconds. Part of #17610.Found by repeating one services test under load: 15 of 600 failed, and the agent's log had
sha: unbound variablein 14. The 15th is not explained by this, as far as we know.Ran: the new test fails without the fix and passes with it; four agent test files and tsc. Not run: the full suite, a real box. This pull's check runs the suite.
🤖 Generated with Claude Code