Skip to content

Replace hook CPU cutoff with deterministic work bounds (T15) - #256

Merged
erickb336 merged 1 commit into
mainfrom
codex/t15-hook-work-bounds
Oct 17, 2026
Merged

erickb336 merged 1 commit into
mainfrom
codex/t15-hook-work-bounds

Conversation

@erickb336

@erickb336 erickb336 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #255
Sage task T15

The existing one-megabyte hook check failed CI at 5,140 ms against a 5,000 ms CPU cutoff. This change measures filesystem work instead of machine speed and removes fastest-of-three retries. It preserves all seven input shapes, both roles and their permission outcomes. Production hook code is unchanged.

Each handler runs once. The test counts filesystem probes, submitted path characters and repeated operation/path probes. A broad 120-second child timeout remains only as a deadlock guard. Two disposable-plugin mutations prove the test detects an unbounded ancestor walk and a missing prefix cache, with specific work-limit diagnostics. Parser input never runs as a shell command.

Validation on 56f9d8f:

  • npm run build: built 311 files.
  • npm run check: passed; 4 timing annotations remain.
  • Focused hook and timing-discovery tests: tests 5, pass 5, fail 0.
  • Detached origin/main with the new tests: tests 2, pass 2, fail 0. Main passing is expected because this repairs a test, not production behavior. Each deliberately regressed plugin fails with the required work-limit diagnostic; the original plugin passes the same input.
  • Independent code review and QA: one clean cycle each on this exact commit.
  • Full npm test: tests 1480, pass 1480, fail 0, cancelled 0; 306293 ms.
  • Exact-head CI run 38985569726: tests 1480, pass 1480, fail 0.

All test commands use fake ps, pgrep and kill first on PATH. This measures the four intercepted synchronous filesystem-probe families, not every parser algorithm or wall-clock latency. One original long-word agent case retains its existing fail-closed result. No new live-provider behavior is claimed. Other timing tests remain outside this repair.

@erickb336
erickb336 marked this pull request as ready for review October 17, 2026 00:19
@erickb336
erickb336 merged commit ee6b5a9 into main Oct 17, 2026
1 check passed
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.

Replace machine-speed hook cutoff with deterministic work bounds (T15)

1 participant