Skip to content

test: stop three CI flakes from failing unrelated PRs - #1265

Merged
devswha merged 3 commits into
mainfrom
fix/ci
Oct 17, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/ci

Conversation

@devswha

@devswha devswha commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Change

Three integration and unit tests fail CI intermittently on PRs that do not touch them. This makes one of them reliable (root cause reproduced), hardens another, and makes the third report why it failed. Test code only; production code is untouched, so there is no changelog fragment.

  • scripts/check.test.ts › "fails closed when source identity is lost after the fast checks" (Fixes CI: check CLI source-identity test fails intermittently in Fast checks #1225). The nested check.ts fast runs with CHECK_DIR, so it takes the PC-wide admission port (41745). The self-hosted runners share one loopback, and lanes waiting for a slot (CHECK_WAIT_SECONDS: 2400) hold that port while they poll. Fast checks sets no wait, so a moment's overlap refused the nested run before it wrote its report. The test then read the previous report (unchanged: null) or found none (ENOENT), which are the two symptoms in the issue. The nested run now gets CHECK_WAIT_SECONDS=20.
  • server/pending-input.contract.test.ts › "two connections share refusal then retry a new attempt once" / "shares a held row's send with its saved copy". The typed barrier was awaited through an fs.watch on the temp root with a 5 s limit. It failed with recorder barrier timed out on three main pushes in a row on 2026-10-16 (runs 38927859150, 38929423777, 38932829315); no issue was filed. The file's own notes say fs.watch can drop a change, and every other barrier in the file uses waitBytes. The barrier now uses waitBytes too: it reads the recorder log directly, allows 8 s, and prints the bytes it saw on timeout.
  • server/usage-login.contract.test.ts › "starts claude in an isolated credential home" (Refs test: usage-login contract test times out on the claude case in CI (flaky) #1260). The root cause is not found. As the issue suggests, the timeout now says whether the receipt was written, whether the pane exited, and what the pane shows.

Not included: the skill-walk ordering failure in Fast checks, which #1251 fixes.

Validation

  • CI: check CLI source-identity test fails intermittently in Fast checks #1225, reproduced: with 127.0.0.1:41745 held for 3 s, the old test fails with ENOENT .../.check/report.json (the CI symptom) and the new test passes (6.1 s). It also passes with the port free (2.1 s). Command: HERDR_TEST_MODE=unit bun test --timeout 60000 scripts/check.test.ts -t "fails closed when source identity is lost after the fast checks".
  • pending-input and usage-login could not be reproduced locally: secret then usage-login ×8 on one isolated session, then usage-login plus the two pending-input cases ×10 with 28 busy cores, all through bun run check run, all green. So the pending-input change is a hardening whose effect on CI is not yet measured.
  • The new usage-login diagnostic was exercised with a temporary copy whose fake claude exits before its receipt: login did not finish: receipt missing, pane exited; the pane shows: ....
  • bun run check run for both integration files in full: 80 pass, 0 fail.
  • bun run check fast: exit 0; unit 4,284 pass, 0 fail, 8 skip; typecheck, build and workflow checks pass.

The source-identity CLI test runs check.ts fast with CHECK_DIR set, so the
nested run takes the PC-wide admission port. Self-hosted runners share one
loopback, and lanes waiting for a slot hold that port while they poll. Fast
checks sets no CHECK_WAIT_SECONDS, so a moment's overlap refused the nested
run before it wrote a report: the test then read the previous report
(unchanged: null) or none (ENOENT).

Give the nested run a 20 s wait. Holding 127.0.0.1:41745 for 3 s reproduces
the ENOENT on the old test; the new one passes under the same hold.

Fixes #1225
The two cross-tab regressions waited for their typed barrier through an
fs.watch on the temp root with a 5 s limit, and failed on three main pushes in
a row on 2026-10-16 with "recorder barrier timed out". The file's own notes
say fs.watch can drop a change, and every other barrier here uses waitBytes.

Use waitBytes, which reads the recorder's log directly, allows 8 s and shows
the bytes it saw when it times out.
The claude case times out intermittently in CI with only "login did not
finish". Name whether the fake CLI's receipt was written, whether the pane
exited, and what the pane shows, so the next failure tells a CLI that never
started from a signal that went unseen.

Refs #1260
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0afe0443-c23d-464f-889d-ddd0f35a9e30
📥 Commits

Reviewing files that changed from the base of the PR and between 6c78881 and c8badc2.

📒 Files selected for processing: 3
  • scripts/check.test.ts
  • server/pending-input.contract.test.ts
  • server/usage-login.contract.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Tests
    • Improved reliability of retry tests by waiting for expected output rather than filesystem events.
    • Added visible pane details to login timeout failures, making test failures easier to diagnose.
    • Adjusted the Linux source-identity test’s wait period while preserving its existing checks.

The changes update synchronization in the check CLI and pending-input tests. The login test also reports receipt status, pane exit status, and pane text when its timeout occurs.

Changes: Test reliability

Layer / File(s) Summary
Nested check wait
scripts/check.test.ts
The Linux x64 source-identity test sets CHECK_WAIT_SECONDS to 20 for its nested fast run.
Pending-input retry barriers
server/pending-input.contract.test.ts
Two retry tests replace filesystem-watch barriers with waitBytes after the submit succeeds.
Login timeout diagnostics
server/usage-login.contract.test.ts
The timeout error includes receipt status, pane exit status, and visible pane text when available. It reports pane-read failures and the absence of an opened pane.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to c8bad

The changes affect test synchronization and timeout diagnostics, not production behavior. The inspected concerns do not establish a current failure that should block merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly summarizes the main change: preventing three intermittent CI test failures from affecting unrelated pull requests.
Description check Passed The description includes the required Change and Validation sections. It explains the affected tests, causes or known limitations, resulting behavior, reproduction details, and validation results.
Linked Issues check Passed The only active directly linked issue is #1225. The PR adds CHECK_WAIT_SECONDS=20 to the nested check.ts fast run in scripts/check.test.ts. This lets the run wait for the shared admission port i…
Out of Scope Changes check Passed The changes stay within the stated test-reliability scope. The pending-input changes replace a lossy fs.watch barrier with the existing waitBytes helper and add timeout output. The usage-login cha…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Full details: Linked Issues check

Explanation

The only active directly linked issue is #1225. The PR adds CHECK_WAIT_SECONDS=20 to the nested check.ts fast run in scripts/check.test.ts. This lets the run wait for the shared admission port instead of failing before it writes .check/report.json. The existing source-identity assertions remain in place. The PR reports reproduction of the old ENOENT failure with port 41745 held and successful runs with the port held and free.

Full details: Out of Scope Changes check

Explanation

The changes stay within the stated test-reliability scope. The pending-input changes replace a lossy fs.watch barrier with the existing waitBytes helper and add timeout output. The usage-login change adds timeout diagnostics for the receipt, pane exit, and pane contents. These changes modify test code only and directly address the three intermittent test failures described by the PR.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3 files.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha
devswha merged commit cd93f99 into main Oct 17, 2026
24 of 25 checks passed
@devswha
devswha deleted the fix/ci branch October 17, 2026 15:55
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.

CI: check CLI source-identity test fails intermittently in Fast checks

1 participant