Skip to content

Commit 1a33f46

Browse files
committed
sync(bfmono): fix(gambit): include extension schemas in exports and default serve to restored workspace (+19 more) (bfmono@f3d186c7b)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit/packages/gambit-core/` - bfmono rev: f3d186c7b Changes: - f3d186c7b fix(gambit): include extension schemas in exports and default serve to restored workspace - a83b7cbe7 fix(gambit): move unbounded build timeout to deck opt-in - acb2de627 fix(gambit): avoid strict json_schema 400s in openrouter responses - 8aba573b6 fix(gambit-simulator-ui): treat errored calibrate runs as failed - ca2028cf8 fix(gambit): prevent circular trace crashes in workspace test run API - 7e41517e5 fix(gambit): make build assistant run timeout unbounded - 24341143d feat(gambit): add deterministic verify fixture seeding - ff2c2d33d feat(gambit): add verify tab consistency UI - 91f0c93bb feat(gambit): add feature-flagged verify routing - 1392f8b65 feat(gambit): support deck-level maxTurns override - f5920ef86 chore(gambit): cut 0.8.5-rc.10 - 073c84d0e chore(gambit): cut 0.8.5-rc.10 - 2c669ba51 fix(gambit-core): ship builtin snippets/decks in npm runtime layouts - 498708844 docs(gambit): retire synthetic respond/end guidance and align deck authoring surfaces - 35ad1d5b5 feat(gambit-core): add OpenResponses convergence runtime, extensions, and async action semantics - b2d78cfb3 chore(gambit): cut 0.8.5-rc.9 - a0029f933 revert(gambit-ci): restore shell-based nix develop in ci-gambit-core - 1b2930064 fix(gambit-ci): create nix profile parent dir in ci-gambit-core - 168538d09 chore(gambit): cut 0.8.5-rc.8 - 9f2dd2186 Switch ci-gambit-core to run nix develop via step commands with a profile instead of custom shell overrides. This avoids both workflow-parse failures and literal path resolution failures. Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent 36e7f90 commit 1a33f46

27 files changed

Lines changed: 2632 additions & 14 deletions

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ It also serves:
167167
```
168168
http://localhost:8000/test
169169
http://localhost:8000/grade
170+
http://localhost:8000/verify (when GAMBIT_SIMULATOR_VERIFY_TAB=1)
171+
```
172+
173+
To seed deterministic Verify fixtures for local iteration:
174+
175+
```bash
176+
cd packages/gambit
177+
deno task verify:seed-fixture
170178
```
171179

172180
The Debug UI shows transcript lanes plus a trace/tools feed. If the deck has an\

deno.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"bundle:sim:sourcemap": "deno run -A scripts/bundle_simulator_ui.ts --sourcemap=external",
2626
"bundle:sim:web": "deno run -A scripts/bundle_simulator_ui.ts --platform=browser",
2727
"bundle:sim:web:sourcemap": "deno run -A scripts/bundle_simulator_ui.ts --platform=browser --sourcemap=external",
28+
"verify:seed-fixture": "deno run -A scripts/seed_verify_fixture.ts",
2829
"serve:bot": "mkdir -p /tmp/gambit-bot-root && GAMBIT_SIMULATOR_BUILD_BOT_ROOT=/tmp/gambit-bot-root GAMBIT_BOT_ROOT=/tmp/gambit-bot-root deno run -A src/cli.ts serve src/decks/gambit-bot/PROMPT.md --bundle --port 8000",
2930
"serve:bot:sandbox": "deno run -A scripts/serve_bot_sandbox.ts",
3031
"build_npm": "deno run -A scripts/build_npm.ts",

packages/gambit-core/src/runtime.test.ts

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2784,6 +2784,104 @@ Deno.test("child deck timeout override tightens inherited deadline", async () =>
27842784
}
27852785
});
27862786

2787+
Deno.test("child deck timeoutMs=0 disables deck-local timeout", async () => {
2788+
const origNow = performance.now;
2789+
let now = 0;
2790+
(performance as { now: () => number }).now = () => now;
2791+
2792+
const dir = await Deno.makeTempDir();
2793+
const modHref = modImportPath();
2794+
const deckPath = await writeTempDeck(
2795+
dir,
2796+
"child-timeout-zero.deck.ts",
2797+
`
2798+
import { defineDeck } from "${modHref}";
2799+
import { z } from "zod";
2800+
export default defineDeck({
2801+
inputSchema: z.any(),
2802+
outputSchema: z.string(),
2803+
guardrails: { timeoutMs: 0 },
2804+
run() {
2805+
(globalThis).__advanceNow?.(20);
2806+
return "late";
2807+
}
2808+
});
2809+
`,
2810+
);
2811+
2812+
try {
2813+
(globalThis as { __advanceNow?: (delta: number) => void }).__advanceNow = (
2814+
delta,
2815+
) => {
2816+
now += delta;
2817+
};
2818+
const result = await runDeck({
2819+
path: deckPath,
2820+
input: {},
2821+
modelProvider: dummyProvider,
2822+
isRoot: true,
2823+
guardrails: { timeoutMs: 1_000 },
2824+
runDeadlineMs: 1_000,
2825+
});
2826+
assertEquals(result, "late");
2827+
} finally {
2828+
delete (globalThis as { __advanceNow?: (delta: number) => void })
2829+
.__advanceNow;
2830+
(performance as { now: () => number }).now = origNow;
2831+
}
2832+
});
2833+
2834+
Deno.test("child deck timeoutMs=0 still respects inherited deadline", async () => {
2835+
const origNow = performance.now;
2836+
let now = 0;
2837+
(performance as { now: () => number }).now = () => now;
2838+
2839+
const dir = await Deno.makeTempDir();
2840+
const modHref = modImportPath();
2841+
const deckPath = await writeTempDeck(
2842+
dir,
2843+
"child-timeout-zero-inherited.deck.ts",
2844+
`
2845+
import { defineDeck } from "${modHref}";
2846+
import { z } from "zod";
2847+
export default defineDeck({
2848+
inputSchema: z.any(),
2849+
outputSchema: z.string(),
2850+
guardrails: { timeoutMs: 0 },
2851+
run() {
2852+
(globalThis).__advanceNow?.(20);
2853+
return "late";
2854+
}
2855+
});
2856+
`,
2857+
);
2858+
2859+
try {
2860+
(globalThis as { __advanceNow?: (delta: number) => void }).__advanceNow = (
2861+
delta,
2862+
) => {
2863+
now += delta;
2864+
};
2865+
await assertRejects(
2866+
() =>
2867+
runDeck({
2868+
path: deckPath,
2869+
input: {},
2870+
modelProvider: dummyProvider,
2871+
isRoot: true,
2872+
guardrails: { timeoutMs: 1_000 },
2873+
runDeadlineMs: 10,
2874+
}),
2875+
Error,
2876+
"Timeout exceeded",
2877+
);
2878+
} finally {
2879+
delete (globalThis as { __advanceNow?: (delta: number) => void })
2880+
.__advanceNow;
2881+
(performance as { now: () => number }).now = origNow;
2882+
}
2883+
});
2884+
27872885
Deno.test("worker sandbox flag defaults false when env access is denied", async () => {
27882886
const dir = await Deno.makeTempDir();
27892887
const modHref = modImportPath();

packages/gambit-core/src/runtime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,10 @@ function deadlineForRun(
450450
guardrails: Guardrails,
451451
existing?: number,
452452
): number {
453-
const timeoutDeadline = performance.now() + guardrails.timeoutMs;
453+
const timeoutMs = guardrails.timeoutMs === 0
454+
? Number.POSITIVE_INFINITY
455+
: guardrails.timeoutMs;
456+
const timeoutDeadline = performance.now() + timeoutMs;
454457
if (typeof existing === "number" && Number.isFinite(existing)) {
455458
return Math.min(existing, timeoutDeadline);
456459
}

scripts/seed_verify_fixture.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env -S deno run -A
2+
3+
import * as path from "@std/path";
4+
import {
5+
seedVerifyFixture,
6+
type SeedVerifyFixtureOptions,
7+
} from "../src/verify_fixture.ts";
8+
9+
function parseArgs(args: string[]): SeedVerifyFixtureOptions {
10+
const out: SeedVerifyFixtureOptions = {};
11+
for (let i = 0; i < args.length; i += 1) {
12+
const value = args[i];
13+
if (value === "--deck" && args[i + 1]) {
14+
i += 1;
15+
out.deckPath = args[i];
16+
continue;
17+
}
18+
if (value === "--sessions-root" && args[i + 1]) {
19+
i += 1;
20+
out.sessionsRoot = args[i];
21+
continue;
22+
}
23+
if (value === "--workspace-id" && args[i + 1]) {
24+
i += 1;
25+
out.workspaceId = args[i];
26+
continue;
27+
}
28+
if (value === "--help" || value === "-h") {
29+
console.log(
30+
[
31+
"Usage: deno run -A scripts/seed_verify_fixture.ts [options]",
32+
"",
33+
"Options:",
34+
" --deck <path> Deck path used to resolve grader metadata.",
35+
" --sessions-root <path> Explicit sessions root (defaults to deck-derived .gambit/workspaces).",
36+
" --workspace-id <id> Workspace id to seed (default: verify-fixture).",
37+
].join("\n"),
38+
);
39+
Deno.exit(0);
40+
}
41+
}
42+
return out;
43+
}
44+
45+
async function main() {
46+
const opts = parseArgs(Deno.args);
47+
const seeded = await seedVerifyFixture(opts);
48+
const relativeState = path.relative(Deno.cwd(), seeded.statePath);
49+
console.log(
50+
[
51+
"[verify-fixture] seeded workspace fixture",
52+
`workspaceId: ${seeded.workspaceId}`,
53+
`deckPath: ${seeded.deckPath}`,
54+
`graderId: ${seeded.graderId}`,
55+
`runCount: ${seeded.runCount}`,
56+
`statePath: ${relativeState || seeded.statePath}`,
57+
].join("\n"),
58+
);
59+
}
60+
61+
if (import.meta.main) {
62+
await main();
63+
}

0 commit comments

Comments
 (0)