Skip to content

test(impeccable): give hook-bridge children time to start before the timeout - #739

Merged
marcusrbrown merged 1 commit into
mainfrom
fix/hook-bridge-load-flakes
Oct 30, 2026
Merged

marcusrbrown merged 1 commit into
mainfrom
fix/hook-bridge-load-flakes

Conversation

@marcusrbrown

Copy link
Copy Markdown
Collaborator

The createSpawnRunner timeout starts counting at spawn. On a loaded host it could fire before a freshly started Node child had registered its SIGTERM handler or written its pid file. The grace-period test then failed on a missing marker, and the grandchild tests failed with ENOENT on the pid file.

Seven tests need their child to be running before the timeout fires. They now use a 4 s timeout (CHILD_STARTUP_TIMEOUT_MS), and their elapsed bounds are derived from it. The grace-period test also checks that the child wrote a ready file, and the grandchild test waits for the pid file before reading it. Test files only.

Measured on the file:

  • Alone: 18/20 passing before, 20/20 after.
  • Under load (8 busy loops plus a full suite): 10/10 after.

The file now takes about 57 s per run, up from about 36 s, because five tests wait out the 4 s timeout.

…timeout

The runner's timeout counts from spawn, so on a loaded host it could fire
before a freshly started Node child registered its handler or wrote its pid
file. Tests that need the child running use a 4 s timeout and assert the
child got that far.
@fro-bot fro-bot added the agent: working Agent is currently working on this label Oct 30, 2026

@fro-bot fro-bot left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: PASS

Test-only change to .opencode/impeccable/hook-bridge.integration.test.ts. I read the diff and the surrounding helpers (waitUntil, readPid, expectProcessGone, trackedFile). I did not run the suite.

Blocking issues

None

Non-blocking concerns

  • The affected tests now rely on the child starting inside 4 s, not 0.4–1 s. This is a better margin, but still a fixed wall-clock bound. If the flakes come back on a heavily loaded host, a startup-gated approach would be sturdier. For example, the fixture could signal readiness and the test could start the clock from that signal. The ready-file assertion in the grace-period test already does part of this.
  • waitUntil (line 120) does not throw on budget exhaustion. In the exited-child grandchild test, the expect(existsSync(grandchildPidFile)).toBe(true) that follows it (line 445) is what fails, so the assertion is correct. It is also an easy line to delete as redundant later. The comment there already explains why it stays.
  • Suite runtime goes up by about 20 s (about 36 s to about 57 s), as the PR description says. Per-test 15_000 budgets still cover the worst case of 4000 + grace + 2000 slack. If this file gets slower, consider a shared constant for the 2000 slack.

Missing tests

None. The change fixes test reliability only. It adds the ready-file check, which stops the grace-period test from passing or failing on a missing marker alone, and the pid-file wait. No production code or security boundary is touched. There are no dependency, workflow, or secret-handling changes.

Risk assessment (LOW)

Test-only change with no runtime, API, auth, or dependency impact. The worst outcome is slightly slower CI, and the timing bounds are derived from CHILD_STARTUP_TIMEOUT_MS so they stay consistent if it is tuned.


Run Summary
Field Value
Event pull_request
Repository fro-bot/dashboard
Run ID 40984858305
Cache hit
Session ses_e759e4ddaffeJl23tGE05y6a24

@fro-bot fro-bot removed the agent: working Agent is currently working on this label Oct 30, 2026
@marcusrbrown
marcusrbrown merged commit 434ec6b into main Oct 30, 2026
11 checks passed
@marcusrbrown
marcusrbrown deleted the fix/hook-bridge-load-flakes branch October 30, 2026 01:21
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