Both writers chained the close: `fflush() || fsync() || fclose()` in
write_state() and `write_all() || fclose()` in save_dropin(). Short-circuit
evaluation meant a failing first call skipped fclose(), so every refused
write leaked one descriptor. A daemon that answers 429s for hours, or one
on a full disk, reaches EMFILE - which reads like a network failure, not
like a file one.
Measured on the real code path with RLIMIT_FSIZE:
provstate 8 refused writes: 7 -> 15 open fds (8 lost), now 7 -> 7
providers (drop-in padded past one stdio buffer, else the write stays
in the buffer and only fclose sees the failure) 7 -> 15, now 7 -> 7
Both tests fail without the fix and pass with it; make check all green
(21 suites), check-asan clean over 46 binaries.
jobrec_write(), write_sidecar() and provstate's write_state() wrote into a
temp, ignored the result and renamed it over the live file. A full disk (or
EIO) then left a torn json where a job record or a key's quota state used to
be. For provstate that is the dangerous direction: a truncated state parses as
all zeroes, so "this key is out of quota until 19:00" became "admit it" and the
harness hammered a spent account.
All three now fflush+fsync+fclose, unlink the temp when any step fails, and
only then rename. Test proof, both tests fail on the old code:
test_provstate.c RLIMIT_FSIZE=8, write_state fails -> last_status still 429,
preflight still waits
test_jobs.c RLIMIT_FSIZE=8, delegate_retry cannot write -> the record on
disk is still a whole json, no .tmp left behind
make check: all tests passed. tests/check_asan.sh: all 45 binaries clean.
Markdown tables are drawn as columns now (src/md.c, test_md, and a case in
test_ui.sh that checks the screen). The site counts lines, tools, tests,
plugins and palettes from the tree instead of naming them; the binary-size
figure is gone because it aged with every build.
The delegate panel cycle has a test (host + tasks plugin, widget says
delegate:panel exit 0), and the turn loop is driven with lcm at 8 KiB and
32 KiB budgets, so compaction is measured rather than claimed.
swarm, provstate and planner get smoke tests. TODO.md is rewritten against
the tree: the step limit was the old default (8 -> 150), skills and memory
were already built, and the open points are claude exit 2, a real Telegram
approval, A2A, the npm leftovers and the scheduler/job tests.