Skip to content

feat(hooks): register suggest-compact + ruff-format-gate; fix error-learner timeout false positives#643

Open
notque wants to merge 1 commit into
mainfrom
feat/evolve-ruff-gate-error-learner-fix-compact
Open

feat(hooks): register suggest-compact + ruff-format-gate; fix error-learner timeout false positives#643
notque wants to merge 1 commit into
mainfrom
feat/evolve-ruff-gate-error-learner-fix-compact

Conversation

@notque
Copy link
Copy Markdown
Owner

@notque notque commented May 14, 2026

Summary

  • Evolution cycle 2026-05-14: 3 proposals implemented (2 STRONG + 1 MODERATE)
  • Consensus scores: Proposal B=3.0/3.0 STRONG, Proposal D=3.0/3.0 STRONG, Proposal A=2.4/3.0 MODERATE

Changes

Proposal B — Register pretool-ruff-format-gate.py (PreToolUse:Bash, 5000ms timeout)

  • Blocks git push when ruff format --check finds violations in Python projects
  • Only activates when pyproject.toml with [tool.ruff] exists (zero false activations on non-Python repos)
  • Delivers deny via permissionDecision JSON (not exit 2); RUFF_FORMAT_GATE_BYPASS=1 escape hatch
  • Consensus: Pragmatist STRONG, Purist STRONG, User Advocate STRONG, Logician STRONG, Philosopher STRONG

Proposal A — Register suggest-compact.py (PreToolUse, no matcher, 2000ms timeout)

  • Advisory: counts Edit/Write calls per session; nudges /compact at 50-call threshold (ADR-103)
  • Never registered despite being complete; ADR-103 backed
  • Always exits 0; advisory only; never blocks execution
  • Consensus: Builder STRONG, User Advocate STRONG, Logician/Purist/Philosopher MODERATE (proxy calibration question, not a blocking concern)

Proposal D — Fix error-learner.py false-positive timeout detection

  • detect_error() was flagging tool outputs containing "timeout" in config strings as genuine errors
  • Patterns captured as junk: timeout=2000, stdin_timeout, PASS: all hooks now have timeout caps, Graduated: timeout/abc123, read_stdin(timeout=2)
  • Fix: 5 targeted false-positive phrases added to existing exclusion list
  • 7/7 test cases pass; real timeout errors ("request timed out", "timed out") still caught correctly
  • Consensus: all 5 personas STRONG (3.0/3.0)

Test Results

Test Case Result
suggest-compact registered in PreToolUse PASS
suggest-compact syntax valid PASS
pretool-ruff-format-gate registered in PreToolUse:Bash PASS
pretool-ruff-format-gate syntax valid PASS
timeout=2000 in output → not flagged as error PASS
stdin_timeout import → not flagged PASS
PASS: all hooks now have timeout caps → not flagged PASS
Graduated: timeout/abc123 → not flagged PASS
read_stdin(timeout=2) → not flagged PASS
request timed out after 30 seconds → still flagged PASS
TimeoutError: connection timed out → still flagged PASS
settings.json JSON validity PASS
Routing drift (116/116 skills) PASS
ruff format --check passes PASS

Shelved (consensus too low)

  • Proposal C: 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.
  • Proposal E: sprite-pipeline ADR session cleanup — MODERATE (11/15). Requires manual verification that ADR work is complete before removal.

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).

…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
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