š fix(pr-autocreate): the push hook is quiet about Auto-fix once sarathi's list shows it on, 0.6.25
With "prAutocreate": { "autofixList": true }, niyam pr-autocreate's Claude hook now says nothing about Auto-fix for a pull request whose latest state on the session's sarathi Auto-fix list is on. Before this, autofixMessage checked only its own once-per-session ack and never read the list. So in athya-hq/athya_mono#3729 the Stop after a successful set_monitor was still held (exit 2) with the "Autofix must be ON" reminder (athya-hq/athya_mono#3718, comment 6909884198, point 4). This releases 0.6.25.
- The reader. New
autofixState(sys, session, url)reads<dir>/<session id>.jsonland folds it as sarathi 0.6.15'sreadRowsandfolddo. It keeps rows whoseprandeventare strings and matches the pull request by lower-casedowner/repo#N, parsing each row, so#10never matches#100. It skipswarned, letsopenedonly add the pull request, and lets any other event set its state. - Quiet when on. In
autofixMessage, when the pull request is on the list,autofixListis set and its state ison, the message is empty. This is decided before the ack is written, so anoffrow later gets the reminder at a later Stop. It applies to the PostToolUse half too. There, as before,state.notesgo out when there is no instruction. - Unchanged. A state of
opened,refusedoroffkeeps today's reminder, because the tag andbind_prsteps are what fix a refusal. A missing or unreadable list, or a session id that names none, also keeps it (fail-open). WithautofixListoff, nothing changes, even with anonrow. - One trade-off. A pull request this hook opened, whose list already shows
onbefore the hook's first instruction, also loses that instruction's placeholder-body note. That needsset_monitorto have run before niyam told the session anything, which the listed flow does not do.
Tests (src/pr-autocreate.test.ts)
onat Stop: exit 0, no output, no ack, no row added. The list also holds a partial line, another PR (#10), the PR in other letters, thenwarnedandopenedrows.offafteron: the next Stop exits 2 with the listed reminder (no step 4) and writes the ack, and the Stop after it is quiet.- After a push (PostToolUse) with
on: no Auto-fix instruction and no ack. refusedafterongets the reminder, and so does a session with no list, which the hook starts with anopenedrow.autofixListoff with anonrow: the whole reminder, step 4 included.autofixStatedirectly: the fold order, non-object and non-string rows, no list, a folder where the list goes, and a bad session id or URL.- The earlier "no second row" test now seeds a
refusedrow instead ofon, since anonrow now makes the push quiet.
š¤ Generated with Claude Code
Summary by cubic
Fixes pr-autocreate's Claude hook so it stays quiet about Auto-fix when the session's sarathi Auto-fix list already shows the pull request as on, releasing 0.6.25. Previously the hook checked only its own once-per-session ack and never read the list, so a Stop after a successful set_monitor was still held (exit 2) with the "Autofix must be ON" reminder.
Behavior
- New
autofixStatereads<dir>/<session id>.jsonland folds the rows as sarathi does: matches the pull request by lower-casedowner/repo#N, skipswarned, letsopenedonly add the pull request, and lets any other event set its state. - With
autofixListon, a pull request whose latest list state isongets no instruction and no ack, decided before the ack is written, so anofflater is told at a later Stop. The push (PostToolUse) half is quiet too: the test asserts no output, no error, and exit 0. opened,refused,off, or an unreadable or missing list keeps today's reminder (fail-open). WithautofixListoff, nothing changes.- Trade-off: a pull request the hook opened whose list already shows
onbefore the hook's first instruction loses that instruction's placeholder-body note.