fix(hooks): six defects in ModelRungGuard, VerificationGate, ISAFoldGate, EventLogger - #1738
Closed
elhoim wants to merge 5 commits into
Closed
fix(hooks): six defects in ModelRungGuard, VerificationGate, ISAFoldGate, EventLogger#1738elhoim wants to merge 5 commits into
elhoim wants to merge 5 commits into
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
5 commits, one per fix, so each can be cherry-picked independently. Each was verified to apply cleanly onto
47df8eeby itself.f06dec42f04673aee48b3382ac460a7551aSix defects under
hooks/. These are guardrails, so each change is deliberately conservative: nothing previously blocked starts passing.ModelRungGuard.hook.ts:125—liveModel()does not filterisSidechain, 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 bogusoff-pintelemetry row.ModelRungGuard.hook.ts:118— read the entire transcript into memory before slicingTAIL_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 overresultTextand never consultedis_error, so a successfulrg -n "exit 1"tripped it via the new"command"event fallback.ISAFoldGate.hook.ts:48—PROD_MUTATION_RESmatched raw command text, so a read-onlyrg -n "Tools/Release.ts"counted as a production mutation and blocked Stop. The 120-char truncation separately cut realwrangler … INSERTcommands past the match point.EventLogger.hook.ts:235— spawned barebundetached, the exact classhooks/lib/resolve-bin.tswas 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.