feat(hooks): register suggest-compact + ruff-format-gate; fix error-learner timeout false positives#643
Open
notque wants to merge 1 commit into
Open
Conversation
…earner timeout false positives
Proposal B (STRONG 3.0/3.0): Register pretool-ruff-format-gate.py in PreToolUse:Bash
- Blocks git push when ruff format --check finds violations
- Only activates on projects with pyproject.toml [tool.ruff] section
- RUFF_FORMAT_GATE_BYPASS=1 escape hatch; advisory deny via permissionDecision
Proposal A (MODERATE 2.4/3.0): Register suggest-compact.py in PreToolUse (no matcher)
- Advisory: counts Edit/Write calls, nudges /compact at 50-call threshold
- ADR-103 backed; never registered despite being complete
- Always exits 0; advisory only
Proposal D (STRONG 3.0/3.0): Fix error-learner.py timeout false-positive detection
- detect_error() was flagging tool outputs containing "timeout" in config strings
(e.g., "timeout=2000", "stdin_timeout", "PASS: all hooks now have timeout caps",
"Graduated: timeout/abc123") as genuine timeout errors
- Adds 5 targeted false-positive phrases to existing exclusion list
- 7/7 test cases pass; real timeout errors ("request timed out") still caught
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.
Summary
Changes
Proposal B — Register
pretool-ruff-format-gate.py(PreToolUse:Bash, 5000ms timeout)git pushwhenruff format --checkfinds violations in Python projectspyproject.tomlwith[tool.ruff]exists (zero false activations on non-Python repos)permissionDecisionJSON (not exit 2);RUFF_FORMAT_GATE_BYPASS=1escape hatchProposal A — Register
suggest-compact.py(PreToolUse, no matcher, 2000ms timeout)/compactat 50-call threshold (ADR-103)Proposal D — Fix
error-learner.pyfalse-positive timeout detectiondetect_error()was flagging tool outputs containing "timeout" in config strings as genuine errorstimeout=2000,stdin_timeout,PASS: all hooks now have timeout caps,Graduated: timeout/abc123,read_stdin(timeout=2)Test Results
timeout=2000in output → not flagged as errorstdin_timeout import→ not flaggedPASS: all hooks now have timeout caps→ not flaggedGraduated: timeout/abc123→ not flaggedread_stdin(timeout=2)→ not flaggedrequest timed out after 30 seconds→ still flaggedTimeoutError: connection timed out→ still flaggedShelved (consensus too low)
pretool-main-thread-discipline.py— WEAK (3/15). Hook source explicitly says "NOT registered"; /tmp marker mechanism rated architecturally fragile by 3/5 personas. Revisit when session-detection uses a typed, bounded-lifetime signal.Evolution Cycle
This PR was generated and validated by the toolkit-evolution skill (2026-05-14 cycle).
Critique: 5-persona multi-persona-critique. A/B: 14/14 tests pass.
Prior cycle suggestions addressed: error-learner upstream fix (Proposal D), unregistered hook audit continuation (Proposals A, B).