Commit 8086252
fix(runtime): de-flake 250ms sandbox hook-timeout tests; honor runner timeout defaults in body-runner
CI's Test Core intermittently failed sandbox tests with 'hook ... exceeded
timeout of 250ms' (nested-write.integration.test.ts 'rollup_parent_total' on
PR #3263 twice; quickjs-runner.test.ts 'lvl4' on main runs 29678362032 /
29677462748). Root cause: every sandbox invocation compiles a fresh WASM
module (newAsyncContext), and a nested hook compiles another one inside the
parent hook's budget — on a loaded CI runner that fixed cost alone can blow
the 250ms default, while the tests in question are about nested-write
correctness, not the budget.
- body-runner: stop hardcoding the 250ms/5000ms fallbacks as an explicit
opts.timeoutMs — when neither body nor action declares a timeout, leave it
unset so QuickJSScriptRunner's constructor defaults (hookTimeoutMs /
actionTimeoutMs, same 250/5000 values) apply. Default behavior is
unchanged; the previously dead constructor option now works.
- quickjs-runner.test.ts: shared runner gets hookTimeoutMs 10s (behavioral
tests); the timeout-resolution suite uses a dedicated stock-default runner
and asserts the effective budget via the error message ('timeout of
250ms'/'50ms') instead of a wall-clock bound.
- both nested-write integration tests: construct the runner with
hookTimeoutMs 10s — their subject is the hook → sandbox → nested-write
path, not the default budget.
hook-wrappers.ts runWithTimeout was investigated and is not a budget source
here: it only applies when hook metadata declares 'timeout', which these
tests do not.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent b28fd59 commit 8086252
4 files changed
Lines changed: 35 additions & 13 deletions
File tree
- packages/runtime/src/sandbox
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
126 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | | - | |
| 99 | + | |
95 | 100 | | |
96 | 101 | | |
97 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| |||
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
367 | 377 | | |
368 | 378 | | |
369 | 379 | | |
| |||
375 | 385 | | |
376 | 386 | | |
377 | 387 | | |
378 | | - | |
| 388 | + | |
379 | 389 | | |
380 | 390 | | |
381 | 391 | | |
| |||
390 | 400 | | |
391 | 401 | | |
392 | 402 | | |
393 | | - | |
394 | 403 | | |
395 | | - | |
| 404 | + | |
396 | 405 | | |
397 | 406 | | |
398 | 407 | | |
399 | 408 | | |
400 | | - | |
401 | | - | |
402 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
403 | 412 | | |
404 | 413 | | |
405 | 414 | | |
406 | 415 | | |
407 | 416 | | |
408 | | - | |
| 417 | + | |
409 | 418 | | |
410 | 419 | | |
411 | 420 | | |
412 | 421 | | |
413 | | - | |
| 422 | + | |
414 | 423 | | |
415 | 424 | | |
416 | 425 | | |
| |||
0 commit comments