carlos / platform Public

hosts-used scan can't list annie-welding: its /data listing changes between SSM pages, so flagship activation (Task 15) would refuse Issue closed

Found in a read-only rehearsal scan for Task 15 (flagship), 2026-10-27 ~18:30Z, before any console downtime. scripts/hosts-used-scan-aws.sh at 50c0cb14 with --profile keymail and the flagship coords (4 boxes, 4 region buckets, prefix instances, no fleets):

ok   box:adi-knitting: 248 paths
FAIL box:annie-welding: i-092c0c1eea75723cb: the listing under /data changed while it was paged
ok   box:barbara-tinkering: 237 paths
ok   box:iris-clockmaking: 519 paths
ok   bucket:carlos-data-au-271376211898: 6 keys
ok   bucket:carlos-data-ie-271376211898: 4715 keys
ok   bucket:carlos-data-uk-271376211898: 1855 keys
ok   bucket:carlos-data-us-271376211898: 7 keys

Why. annie's find /data -maxdepth 3 is 12,124 lines, about 462 KB once gzipped and base64-encoded, so about 23 pages of 20,000 characters. Each page is a separate SSM run of find, and the reassembled listing's checksum has to match. On annie, SQLite -wal and -shm files under /data/amadan/instances/ appear and disappear every few seconds (two listings 4 s apart differed 2 times in 24 s). A full listing takes over a minute, so all three retries fail, and they would fail with the console stopped too, because the boxes keep serving. Dev never hit this: each dev box fits in one page.

Effect. console hosts-used activate refuses an unscanned target, and flagship can't close a region. So Task 15's activation can't succeed with the script as it is. I have NOT stopped the flagship console.

Possible fixes (not built):

  1. The remote script runs find once into a private file on tmpfs (mode 0600, a random name under /run), each page reads from that file, and the last page deletes it. The box listing becomes a consistent snapshot. Cost: the scan writes one scratch file per box, so the header's "writes nothing" claim changes.
  2. Return the whole listing from one SSM run through --output-s3-bucket-name (no 24,000-character cap). Cost: the box role needs to write to an S3 prefix, which is an IAM change.
  3. Leave SQLite -wal, -shm and -journal out of box listings. Smaller change, but it only works if the mapper never needs them: a host whose only trace on a box is a -wal file would be missed. Weakest of the three.

I'd recommend 1. It's a script change plus tests, with one review (stopping rules apply).

Fixed and used (2026-10-27, Paul's go). Merged to main as 57aec0ad (branch hosts-used-scan-snapshot, squashed). Each box now runs find once (with -ignore_readdir_race) into a mktemp scratch file in /run, and every SSM page is cut from that file, with the sha256, length and line-count check over it. The file is removed by exact path after paging, on failure too. A failed snapshot command removes its own, and a detached timer removes the exact path after 900 s if its name never reached the scan. Tests: TestHostsUsedScanAWSPagesOneSnapshot (failed first with the old "changed while it was paged") and TestHostsUsedScanAWSExpiresALostSnapshot. Astra round 1: READY AFTER FIXES, one P2 (the lost-response cleanup owner), fixed with the expiry. CI green on the branch tip.

On flagship: the dry scan was clean on all 8 targets (annie-welding 12,105 paths, 0 unmapped), and the real scan in the activation window took 87 s. No scratch file was left on any box. Closing.