Skip to content

Let a test command raise its watchdog idle threshold - #442

Merged
Maximo-Guk merged 4 commits into
mainfrom
maximo/test-idle-timeout-override
Sep 4, 2026
Merged

Maximo-Guk merged 4 commits into
mainfrom
maximo/test-idle-timeout-override

Conversation

@Maximo-Guk

@Maximo-Guk Maximo-Guk commented Sep 4, 2026

Copy link
Copy Markdown
Member

gadgets-with-timeout --idle 60 has been observed reaping workshop-backend's unit suite in CI. Nothing about CI mode prints less: vp pipes every task's stdout, so vitest is non-TTY everywhere and prints one line per completed file. What differs is the machine — a 4-vCPU runner at vp's concurrency floor, where the import-dominated backend suite (import 261s, tests 19s in a green run) overlaps three other workerd fleets and its healthy silences stretch past 60s.

  • Widens the command the task builders take to TestCommand (string | { command, idleSeconds }), so one command can raise its own idle threshold without bumping the default for the other suites. The backend unit suite uses 120s
  • Adds TESTS_WITH_TIMEOUT_DISABLE=1, which turns the watchdog off entirely. This isn't actually used anywhere yet, but it's there if agents would like to disable it locally, or if we ever want to disable idle watchdogs in CI for example
  • Also divides up vp run concurrency between the dev server's two runs

`gadgets-with-timeout --idle 60` reaps `workshop-backend`'s unit suite
under CI contention. Import dominates that suite's runtime and vitest's
non-TTY reporter only prints on file completion, so a healthy run goes
quiet for long stretches -- no hang, just no output.

Widen the command the task builders take to `TestCommand`, so one
command can raise its own idle threshold without bumping the default
for the other ~25 suites (which would also bust every package's vp
cache). `withTestTimeout` stays unary, since
`vitestTaskWithExclusions` hands it to `Array.prototype.map`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the kernel Changes to the Workshop kernel label Sep 4, 2026
@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

LGTM!

github run

@Maximo-Guk
Maximo-Guk marked this pull request as ready for review September 4, 2026 03:15

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Preview: pr442-maximo-test-i-76e4cd63

https://pr442-maximo-test-i-76e4cd63-router.cloudflare-os-previews.workers.dev

Dashboard · deleted when this PR closes

The HEAD commit blamed vitest's non-TTY reporter, but that is not
CI-specific: vp pipes every task's stdout, so vitest is non-TTY locally
too and prints one line per completed file everywhere. What differs in
CI is the machine -- a 4-vCPU runner at vp's concurrency floor, with the
backend unit suite (import 261s, tests 19s) overlapping three other
workerd fleets. The 60s cliff is contention, not reporter behaviour.

120s clears the longest healthy silence seen in a green run (23s) by a
wide margin while keeping the wedge detection tighter than 180.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

LGTM!

github run

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown
  • [P2] Preserve invalid concurrency values scripts/vp/concurrency.ts:381: Number() accepts values Vite+ rejects, such as 1e2, 0x10, or whitespace-padded numbers, silently rewriting them into valid limits. Validate strict decimal syntax before splitting so malformed values reach Vite+ unchanged.

github run

@Maximo-Guk
Maximo-Guk force-pushed the maximo/test-idle-timeout-override branch from 97ad90c to 253baeb Compare September 4, 2026 15:25
@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

LGTM!

github run

Maximo-Guk and others added 2 commits September 4, 2026 10:28
`TESTS_WITH_TIMEOUT_DISABLE=<anything>` makes `with-timeout.ts` skip
arming both the idle and wall-clock timers, leaving the stdio piping and
signal relay in place: for a CI whose job-level timeout already bounds a
wedge, or a deliberately unsupervised local run. A wedge is then killed
anonymously by whatever is outside, with no surviving-tree diagnostic.

Under vp a cached task sees no ambient variable it does not declare, so
the shared task builders declare it in `env` on every vitest `test`
task, and the two hand-declared cached tasks that wrap the watchdog
(`@gadgets/scripts#test`, `workshop-backend#build:integration-worker`)
spread the same list. `env` fingerprints the value, so toggling the
switch is a cache miss and a supervised run never replays a pass that
only finished because nothing was watching. `scripts/vitest-task.test.ts`
checks every cached task wrapping `gadgets-with-timeout` declares it.

Not wired into CI here; that is a separate decision.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
run-dev-server spawns `build:configurator` and `build:app:dev` as two
`vp run -r --cache` children at once, each with the same `vpRunEnv()`
result, so each got the whole machine-derived VP_RUN_CONCURRENCY_LIMIT
and together they claimed the budget twice over.

`vpRunEnv` now takes an options object with a `concurrentRuns` count,
and the new `splitConcurrencyLimit` divides the resolved limit between
that many runs: floored at vp's own default of 4, since that is what
each child used with the variable unset, so a small machine is
unchanged; and capped at the whole limit, so an explicit value below
the floor is never raised past what was asked. A value that is not a
positive integer passes through untouched for vp to report. The dev
server lists its two runs and derives the count from the list; `run.ts`
moves to the new signature; run-local and the release build are
unchanged (bare `vpRunEnv()` still works).

The mechanism previously lived only in gadgets-internal's wrapper over
this module, which can now import `splitConcurrencyLimit` instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Maximo-Guk
Maximo-Guk force-pushed the maximo/test-idle-timeout-override branch from 253baeb to b6e44b5 Compare September 4, 2026 15:29
@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Maximo-Guk Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

3 similar comments
@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Maximo-Guk Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Maximo-Guk Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@ask-bonk

ask-bonk Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Maximo-Guk Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@Maximo-Guk
Maximo-Guk merged commit 115fede into main Sep 4, 2026
15 of 16 checks passed
@Maximo-Guk
Maximo-Guk deleted the maximo/test-idle-timeout-override branch September 4, 2026 15:53
twinprime19 added a commit to twinprime19/cloudflare-os that referenced this pull request Sep 10, 2026
Absorbs cloudflare/cloudflare-os main 54d5d8b: composer skill picker and pills (cloudflare#422, cloudflare#423), Workers compatibility date bump (cloudflare#448), gatekeeper-kit replayable runs (cloudflare#460), workspace-sheets xlsx export (cloudflare#433), multi-tab Google Docs (cloudflare#450), and fixes cloudflare#442, cloudflare#446, cloudflare#447, cloudflare#454.

Conflicts resolved in the chat composer and slash-command picker: upstream's structure with the fork's Lingui wraps and the workspace idle-pause resume call re-applied. Upstream's new React tests mount through the fork's i18n root.

Claude-Session: https://claude.ai/code/session_017psYJXWDchbjuq7DarzGkV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Changes to the Workshop kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants