Skip to content

test(agent-runs): stop a success-path assertion racing a 10ms deadline - #3710

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/deterministic-disposal-test
Aug 14, 2026
Merged

test(agent-runs): stop a success-path assertion racing a 10ms deadline#3710
kojiwakayama merged 1 commit into
mainfrom
fix/deterministic-disposal-test

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What

"successful strict project file calls dispose cancellation listeners and timers" built its client with operationTimeoutMs: 10 / timeoutMs: 10 around a stubbed fetch, then asserted the abort listener was added once and removed once.

Nothing in that test is about timeouts. The deadline was incidental config that made a success-path assertion depend on wall clock: under a loaded parallel run the 10ms can elapse before the call settles, the timeout path runs, and the counts stop being 1/1.

Raised to 30s, with the reasoning in a comment so it is not "tidied" back down.

What this deliberately does not change

The other 12 short deadlines in this file stay. Tests named "bounds a stalled terminal response" or "enforces its deadline after trace" need a 1ms budget — that is the behaviour under test, and contention only makes those fire more reliably, which is the outcome they assert.

That distinction matters: sweeping every short deadline in the suite would break a dozen legitimate timeout tests to chase a handful of real ones.

Honest status

This is a plausible fix for one instance, not a proven fix for the suite:

  • I could not reproduce the failure in isolation, even under 12 saturating busy-loops (0/6). The mechanism fits the evidence but is unproven.
  • The suite's failing test varies between runs — three earlier failures today were a different test entirely — so one fix cannot be expected to make the suite green.
  • Four full-suite runs passed afterwards. Against a ~1-in-3 baseline, four clean runs occur by chance about 20% of the time, so that is a regression check that passed, not evidence of improvement.

What it does establish: this test no longer depends on wall clock for an assertion that has nothing to do with time. That is correct regardless of whether it was the cause.

deno lint and deno fmt --check clean; the file passes 75/75.

Background, including a correction to my own earlier over-count of the affected sites: veryfront-issue-inbox#506.

Summary by CodeRabbit

  • Tests
    • Improved cancellation cleanup test reliability by using longer operation and request timeouts.
    • Preserved validation that cancellation listeners are properly removed.

"successful strict project file calls dispose cancellation listeners and
timers" built a client with operationTimeoutMs/timeoutMs of 10 around a
stubbed fetch, then asserted the abort listener was added once and removed
once. Nothing in it tests timeout behaviour; the deadline was incidental
config that made a success-path assertion depend on wall clock. Under a
loaded parallel run the deadline can elapse before the call settles, the
timeout path runs, and the counts stop being 1/1.

Raised to 30s. The tests in this file that do exercise deadlines keep
their short ones -- those need the timeout to fire, and contention only
makes them fire more reliably.

Honest about what this does not establish: I could not reproduce the
failure in isolation even under 12 saturating busy-loops (0/6), so the
mechanism is plausible rather than proven, and the suite's failing test
varies between runs. Four full-suite runs passed afterwards, but against
a ~1-in-3 baseline that is a regression check, not evidence of a fix.

Context in veryfront-issue-inbox#506.
@github-actions

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 454 3062 KiB ⚠️ 39 known

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 66ea9c32-aa23-4c0f-8b3d-5fa5cc7db5ca

📥 Commits

Reviewing files that changed from the base of the PR and between 7fc8d41 and 4b3cf02.

📒 Files selected for processing (1)
  • src/agent/runtime/project-files-client.test.ts

📝 Walkthrough

Walkthrough

The cancellation-listener cleanup test now uses 30-second operation and request timeouts. Its fetch behavior and listener-disposal assertions remain unchanged.

Changes

Test stability

Layer / File(s) Summary
Increase cleanup test timeout budgets
src/agent/runtime/project-files-client.test.ts
The test increases operation and request timeouts from 10 milliseconds to 30 seconds while preserving its cleanup assertions.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 4b3cf

This localized test change removes an unrelated wall-clock dependency from a success-path assertion without changing production behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: kwakayama

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the test change and the removal of the 10ms deadline race.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/deterministic-disposal-test

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

@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit 4eece1f Aug 14, 2026
34 checks passed
@kojiwakayama
kojiwakayama deleted the fix/deterministic-disposal-test branch August 14, 2026 16:00
@kojiwakayama kojiwakayama mentioned this pull request Aug 14, 2026
5 tasks
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