Skip to content

fix(hooks): six defects in ModelRungGuard, VerificationGate, ISAFoldGate, EventLogger - #1738

Closed
elhoim wants to merge 5 commits into
danielmiessler:mainfrom
elhoim:fix/hooks
Closed

fix(hooks): six defects in ModelRungGuard, VerificationGate, ISAFoldGate, EventLogger#1738
elhoim wants to merge 5 commits into
danielmiessler:mainfrom
elhoim:fix/hooks

Conversation

@elhoim

@elhoim elhoim commented Aug 3, 2026

Copy link
Copy Markdown

5 commits, one per fix, so each can be cherry-picked independently. Each was verified to apply cleanly onto 47df8ee by itself.

Commit Fix
f06dec4 read only the transcript tail and skip sidechain rows
2f04673 let the verification gate split units on a newline between digits
aee48b3 decide hard-fail from is_error, not from words in the output
382ac46 stop ISAFoldGate reading a read-only command as a prod mutation
0a7551a resolve the bun binary instead of spawning it bare

Six defects under hooks/. These are guardrails, so each change is deliberately conservative: nothing previously blocked starts passing.

  • ModelRungGuard.hook.ts:125liveModel() does not filter isSidechain, so a subagent's model reads as the main loop's. Dispatching to a lower rung injected a false "MODEL RUNG" warning and wrote a bogus off-pin telemetry row.
  • ModelRungGuard.hook.ts:118 — read the entire transcript into memory before slicing TAIL_BYTES, contradicting the file's own "<20ms hot path" comment. Reads only the tail.
  • VerificationGate.hook.ts:76 — the digit-lookaround split refuses to break on a newline between two digits, so unrelated lines merged into one "unit" that could satisfy both halves of a T5 block, defeating the gate.
  • VerificationGate.hook.ts:222 — hard-fail was decided by a regex over resultText and never consulted is_error, so a successful rg -n "exit 1" tripped it via the new "command" event fallback.
  • ISAFoldGate.hook.ts:48PROD_MUTATION_RES matched raw command text, so a read-only rg -n "Tools/Release.ts" counted as a production mutation and blocked Stop. The 120-char truncation separately cut real wrangler … INSERT commands past the match point.
  • EventLogger.hook.ts:235 — spawned bare bun detached, the exact class hooks/lib/resolve-bin.ts was added this release to fix. ENOENT surfaced asynchronously past the sync try/catch, and the resulting missing state file made the self-heal fire on every tool call. Uses the helper.

Testing. Commands and output are in the per-file notes above. I did not do a fresh-system install verification (contributing step 3) — these are targeted fixes verified per-file, not an install run.

elhoim added 5 commits August 3, 2026 07:01
Two defects in the same function, hence one commit. liveModel() read the entire
transcript before slicing TAIL_BYTES, contradicting the file's own "<20ms hot
path" comment; and it did not filter isSidechain, so a subagent's model was read
as the main loop's, injecting a false MODEL RUNG warning and writing a bogus
off-pin telemetry row.
…n digits

The digit-lookaround refused to break there, so unrelated lines merged into one
"unit" that could satisfy both halves of a T5 block, defeating the gate.
A successful `rg -n "exit 1"` tripped the gate via the new "command" event
fallback. Adds isToolError to TxEvent as the raw flag, with no text heuristic
mixed in.
…tation

PROD_MUTATION_RES matched raw command text, so `rg -n "Tools/Release.ts"`
counted as a production mutation and blocked Stop. The 120-char truncation
separately cut real `wrangler … --command "INSERT …"` before its write verb, so
the evidence text is widened too.
EventLogger spawned bare `bun` detached — the exact class hooks/lib/resolve-bin.ts
was added this release to fix. ENOENT surfaced asynchronously past the sync
try/catch, and the resulting missing state file made the self-heal fire on every
tool call.
@danielmiessler

Copy link
Copy Markdown
Owner

Thanks @elhoim — the six hook defects. Ported into the source tree (the public repo is generated from it, so I'm closing this here), credited by number at the fix site. Ships in the next release. I tightened the ISAFoldGate exemption a bit further on the way in — dropped less/bat and excluded rg --pre.

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.

2 participants