Skip to content

fix(auto-reply): refuse to clear the send flag and to send without a queue row - #55

Merged
twoimo merged 13 commits into
mainfrom
stability/6-verifier-followups
Nov 16, 2026
Merged

twoimo merged 13 commits into
mainfrom
stability/6-verifier-followups

Conversation

@twoimo

@twoimo twoimo commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Why

Independent verifiers of the stability stack listed follow-ups that make the send-once guarantee hold even against hand edits and misuse, plus three doc and help fixes. An auto-reply must never post twice, and every later change should be caught by a check rather than by memory.

What changed

  • A queue trigger refuses to clear reply_jobs.ax_mutation_authorized once set, and both validators (Python and Rust) require that trigger and reject a sending row whose flag is 0. Folded into schema v3: no baked runtime or live queue carries v3 yet (journal copies, 405 baked binaries and 23 queue files checked read-only).
  • send_reply refuses to send when it has no queue connection or event id, instead of sending without a sending commit.
  • ax-read help says it needs safety.allow_ax_send; the misplaced unittest guard moved to the end of its file; a dated correction note in unit5-live-proofs.md; AGENTS.md says the host tick starts the session command with /bin/sh, not Terminal.

Scope

  • A trigger does not fire on INSERT OR REPLACE or DELETE. Nothing uses INSERT OR REPLACE on reply_jobs; the only DELETE is the retention archive, which removes sent and skipped rows after recording their tombstones.

Blast Radius

Queue files are created and validated with the new trigger, so a queue made by this branch's intermediate v3 shape fails closed. No such queue exists outside tests.

Verification

  • cargo test 1,169 passed; CI Python list ran 1,366 tests, OK with 9 skipped, under a sandbox with an empty HOME.
  • The send-once model check passes, including a probe that tries to clear a set flag (refused now, cleared on the pre-fix code).

🤖 Generated with Claude Code

twoimo and others added 13 commits November 16, 2026 09:38
reply_jobs.ax_mutation_authorized records that Return may have been
pressed for a job. The triggers only ever set it, but a direct UPDATE can
still put it back to 0, and nothing rejects a sending row that lacks it.

These tests pin three things on both a created queue and one migrated
from v2: an UPDATE that clears a set flag fails, a sending row without the
flag fails validation, and a v3 queue whose schema could clear the flag
is not adopted. The Rust stopped-clean validator gets the same two cases.

All fail today.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The insert and status triggers set reply_jobs.ax_mutation_authorized and
never clear it, but any direct UPDATE could. A cleared flag on a job whose
Return may have fired lets recovery reschedule it and post it twice.

A BEFORE UPDATE OF ax_mutation_authorized trigger now aborts any update
from 1 to 0. Both validators expect the trigger in an exact v3 queue and
reject a sending row whose flag is 0. The Rust stopped-clean check already
refused every sending row as nonterminal, so for it this only names the
broken invariant.

The trigger joins schema v3 instead of starting a v4. The v3 layout exists
only on the unmerged stability stack. No baked runtime or installed CLI on
this host has the v3 column code, and every queue on disk is at v0 or v2.
The supervisor's one-transaction v0/v2 to v3 step now also creates the
trigger. A queue in the earlier v3 shape fails closed on open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three tests called send_reply with no queue connection or event_id, so
local-send ran without the job ever being committed to sending. The worker
never sends that way; its only caller passes both. Each test now holds its
event as a processing row in a real queue, the way process_job does, and
keeps checking what it checked before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e row

send_reply commits the job to sending, which sets its send authority,
before local-send can press Return. When the caller passes no queue
connection or no event_id, it skips that commit and still runs local-send,
so a reply can reach the room with no durable record that it may have.

The pin calls the send boundary without each in turn and expects no
command and an unchanged processing row, then a normal call that sends
once. It fails today: both calls send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
send_reply committed the job to sending only when it had both a queue
connection and an event_id. Without either it skipped the commit and still
ran local-send, so Return could post a reply that no row marked as
possibly sent. Recovery would then treat the job as never attempted.

send_reply now returns False before any command when either is missing,
next to the existing refusal for a missing event. The sending commit no
longer has a branch around it. The only caller, _deliver_scheduled_reply,
always passes both, so the worker sends exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The four eprintln! lines become one SERVER_LOGIN_WARNING const so a test
can read what the warning tells the user. stderr is byte-identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ax-read needs safety.allow_ax_send because opening a chat that is not
already open presses Return in KakaoTalk. Its help still calls it a plain
read, and the server-login warning recommends it with no mention of the
gate. The pin reads the rendered ax-read help and the warning text. It
fails today.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ax-read has required safety.allow_ax_send since 0d818f2, because opening a
chat that is not already open presses Return in KakaoTalk. Its help now
says so, and the server-login warning adds that local-send and ax-read
both need the gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GeekNewsReadbackTests sat after the __main__ guard, so running the file
directly ran 19 of its 21 tests, and naming that class failed with
"module '__main__' has no attribute". The guard now ends the file. The
-m unittest runs in CI already loaded the class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 2026-09-22 entry describes the operator send as local-send to the
--chat name with a local-search readback. The code now binds the room
through the room catalog entry for the --queue directory and reads back
with local-read on that chat_id. A dated sub-bullet records this and
leaves the historical entry as written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
auto-reply-host --tick spawns the pinned command with /bin/sh to avoid the
Gatekeeper and Automation prompts that opening it in Terminal caused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@twoimo
twoimo merged commit f6ccc5b into main Nov 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant