You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/02 15:27:26 UTC
(maka) branch main updated: fix(runtime): give sandbox boundary wait a time budget (#4387)
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/main by this push:
new 114f20f4cf fix(runtime): give sandbox boundary wait a time budget (#4387)
114f20f4cf is described below
commit 114f20f4cf44caaa5e1e4bcfe3d7fc520b91e90f
Author: VyrnSynx <ma...@proton.me>
AuthorDate: Wed Sep 2 23:27:02 2026 +0800
fix(runtime): give sandbox boundary wait a time budget (#4387)
The sandbox boundary test waited for the boundary request with a hand-written loop of 100 `setTimeout(0)` iterations, which is a turn budget rather than a time budget and flakes on slow machines. It now uses the existing `waitFor` from `@maka/core/test-only/async-primitives` with a 5 s timeout and 10 ms poll. Test-only change.
Generated-by: Cursor
---
.../tool-runtime-sandbox-boundary.test.ts | 26 ++++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/packages/runtime/src/__tests__/tool-runtime-sandbox-boundary.test.ts b/packages/runtime/src/__tests__/tool-runtime-sandbox-boundary.test.ts
index 7e49760271..fb240bb362 100644
--- a/packages/runtime/src/__tests__/tool-runtime-sandbox-boundary.test.ts
+++ b/packages/runtime/src/__tests__/tool-runtime-sandbox-boundary.test.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { deferred, nextId } from '@maka/core/test-only/async-primitives';
+import { deferred, nextId, waitFor } from '@maka/core/test-only/async-primitives';
import assert from 'node:assert/strict';
import { mkdtemp, mkdir, realpath, rm, symlink, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
@@ -1077,10 +1077,22 @@ function header(cwd = process.cwd()): SessionHeader {
async function waitForBoundaryRequest(
events: SessionEvent[],
): Promise<Extract<SessionEvent, { type: 'sandbox_boundary_request' }>> {
- for (let attempt = 0; attempt < 100; attempt += 1) {
- const event = events.find((candidate) => candidate.type === 'sandbox_boundary_request');
- if (event?.type === 'sandbox_boundary_request') return event;
- await new Promise((resolve) => setTimeout(resolve, 0));
- }
- throw new Error('Sandbox boundary request was not emitted');
+ let event: Extract<SessionEvent, { type: 'sandbox_boundary_request' }> | undefined;
+ await waitFor(
+ () => {
+ const candidate = events.find((entry) => entry.type === 'sandbox_boundary_request');
+ if (candidate?.type === 'sandbox_boundary_request') {
+ event = candidate;
+ return true;
+ }
+ return false;
+ },
+ {
+ timeoutMs: 5_000,
+ pollMs: 10,
+ message: 'Sandbox boundary request was not emitted',
+ },
+ );
+ assert.ok(event);
+ return event;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org