aboutsummaryrefslogtreecommitdiff
path: root/.ai/scripts/inbox-status
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-23 23:55:15 -0500
committerCraig Jennings <c@cjennings.net>2026-07-23 23:55:15 -0500
commit0f91a8e0cd0a4b5b351efe407987bb8bb6ab125e (patch)
treeea2ed0fc2b45f7f3d21e54d32adc9333c8ba9ff6 /.ai/scripts/inbox-status
parent392f14a83dedad96750749d46ad808f9c9bad493 (diff)
downloadrulesets-0f91a8e0cd0a4b5b351efe407987bb8bb6ab125e.tar.gz
rulesets-0f91a8e0cd0a4b5b351efe407987bb8bb6ab125e.zip
fix(inbox-send): write handoffs atomically so a failure leaves no phantom
inbox-send wrote straight to the destination path, and write_text truncates on open, so any mid-write failure left a zero-byte .org in another project's inbox. inbox-status counted that phantom as a pending handoff and blocked a turn in the receiving project over a file with no content and no sender. Both send paths now write to a temp sibling and os.replace it into place, so the inbox only ever sees a complete file. A caught failure removes the temp and re-raises, leaving no debris. encoding is pinned to utf-8 on the write and on the roots-config read, which closes the locale-dependent failure that first surfaced this. inbox-status also skips the .inbox-send-* temp, so the brief window before the rename can't read as pending either. The atomicity is only complete once the consumer ignores the in-flight file.
Diffstat (limited to '.ai/scripts/inbox-status')
-rwxr-xr-x.ai/scripts/inbox-status1
1 files changed, 1 insertions, 0 deletions
diff --git a/.ai/scripts/inbox-status b/.ai/scripts/inbox-status
index b917144..17031af 100755
--- a/.ai/scripts/inbox-status
+++ b/.ai/scripts/inbox-status
@@ -35,6 +35,7 @@ mapfile -t pending < <(find inbox -maxdepth 1 -type f \
! -name '.gitkeep' \
! -name 'lint-followups.org' \
! -name 'PROCESSED-*' \
+ ! -name '.inbox-send-*' \
-printf '%f\n' 2>/dev/null | sort)
n=${#pending[@]}