Skip to content

fix(server): poll with real ticks instead of bare yields in CursorAdapter tests#4536

Open
colonelpanic8 wants to merge 1 commit into
pingdotgg:mainfrom
colonelpanic8:t3code/fix-upstream-ci-test
Open

fix(server): poll with real ticks instead of bare yields in CursorAdapter tests#4536
colonelpanic8 wants to merge 1 commit into
pingdotgg:mainfrom
colonelpanic8:t3code/fix-upstream-ci-test

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 25, 2026

Copy link
Copy Markdown

What Changed

waitForFileContent and waitForJsonLogMatch in apps/server/src/provider/Layers/CursorAdapter.test.ts now poll with a real delay (Effect.sleep("25 millis") / TestClock.adjust("25 millis")) between attempts instead of a bare Effect.yieldNow.

Why

CI run 30140499630 failed on main in the "cancels pending ACP approvals and marks the turn cancelled when interrupted" test with AssertionError: expected false to be true. The commit that CI run built only touched apps/web/src/components/chat/TraitsPicker.tsx, so this was a pre-existing flake unrelated to that change.

Both helpers busy-poll a log file written by a real ACP mock child process (an actual subprocess, not a stub). With no real wall-clock delay between the 40 poll attempts, all attempts could be exhausted before the child process was scheduled and had written its response under CI load, so the assertion would see an incomplete log.

Sibling test files in the same directory (CursorProvider.test.ts, GrokAdapter.test.ts) already establish the correct pattern for this exact cross-process situation: sleep briefly between polls. This PR aligns CursorAdapter.test.ts with that convention. Since this suite runs under a virtual TestClock (via it.layer), the fix uses TestClock.adjust for the generator that runs directly on the test's own fiber (matching an existing local precedent in the same file around line 288-302), and plain Effect.sleep for the other helper, which is a bare async function that runs its own fresh, live Effect.runPromise per iteration.

Verified locally: vp test run CursorAdapter.test.ts passes 18/18 consistently across repeated runs. vp lint and a scoped vp run typecheck in apps/server are clean.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (N/A — no UI change)
  • I included a video for animation/interaction changes (N/A)

Note

Low Risk
Test-only polling changes; no production server or adapter behavior is modified.

Overview
Fixes flaky CursorAdapter tests that poll log files written by a real mock ACP child process.

waitForFileContent now waits 25ms between attempts via Effect.sleep instead of Effect.yieldNow. waitForJsonLogMatch uses TestClock.adjust("25 millis") with a short comment that the mock runs on the real clock, matching the steer-test polling pattern already in this file and sibling adapter tests.

Without wall-clock or scheduler hops, all 40 poll attempts could finish before the subprocess wrote its response under CI load (e.g. the cancel-approval test seeing an incomplete NDJSON log).

Reviewed by Cursor Bugbot for commit e88d8ec. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix polling in CursorAdapter tests to use real ticks instead of bare yields

  • In waitForFileContent, replaces a bare scheduler yield between poll attempts with a 25ms sleep, introducing real elapsed time between read checks.
  • In waitForJsonLogMatch, replaces the yield with TestClock.adjust("25 millis") and adds a comment explaining why the mock process requires real-clock advancement.
  • Behavioral Change: poll helpers now consume real or simulated time between attempts rather than yielding immediately, which may affect test timing and throughput.

Macroscope summarized e88d8ec.

…pter tests

waitForFileContent and waitForJsonLogMatch busy-polled for output from a
real ACP mock child process using Effect.yieldNow with no wall-clock delay
between attempts, so under CI load the child process could lose the race
against the fixed attempt budget and the assertion would see an
incomplete log. Sibling adapter test files already use a real delay
between polls for this exact cross-process situation; align this file
with that convention (TestClock.adjust for the fiber running under the
test's virtual clock, Effect.sleep for the plain-async helper running its
own live runtime).
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b34a7d3c-1e3c-43ec-8b7b-f83ce19631f0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Jul 25, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Test-only changes in CursorAdapter.test.ts that improve polling behavior by using real ticks instead of bare yields. No production code is affected.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant