opencode-model-router 1.15.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +126 -0
- package/README.md +148 -30
- package/package.json +8 -4
- package/server.ts +3 -0
- package/src/compat/child-session.ts +32 -0
- package/src/compat/v2-client.ts +183 -0
- package/src/compat/v2-hooks.ts +409 -0
- package/src/escalate/effort-override.ts +165 -0
- package/src/escalate/ladder.ts +57 -7
- package/src/index.ts +243 -54
- package/src/router/agent-options.ts +43 -12
- package/src/router/config.ts +145 -23
- package/src/router/depth-guard.ts +152 -0
- package/src/router/depth.ts +826 -0
- package/src/router/protocol.ts +1 -0
- package/src/v2.ts +25 -0
- package/src/verify/checker.ts +1 -1
- package/src/verify/dispatch.ts +1 -1
- package/src/verify/dod.ts +8 -1
- package/src/verify/gate.ts +16 -1
- package/src/verify/paths.ts +9 -1
- package/src/verify/wiring.ts +95 -4
- package/tiers.json +20 -17
package/src/router/protocol.ts
CHANGED
|
@@ -294,6 +294,7 @@ export function buildDoDProtocolSection(cfg: RouterConfig): string {
|
|
|
294
294
|
"[/acceptance]",
|
|
295
295
|
"",
|
|
296
296
|
"- check kinds: testsPass | buildPasses | lintClean | fileExists path=\u2026 | schemaMatch path=\u2026 schema=\u2026 | run command=\"\u2026\" expect=\u2026",
|
|
297
|
+
"- cwd: <dir> in the block when the producer works outside this directory (e.g. a git worktree); checks, tests and the grader run there.",
|
|
297
298
|
"- testsPass runs only the tests affected by the producer's changes (the full suite is CI's job); prefer it over a hand-written full-suite run command. A failure that also fails at the dispatch-time reference is excused as pre-existing.",
|
|
298
299
|
"- Per dispatch you may add `VERIFY:<mode>` as one token, <mode> being `required` or `deferred` (default deferred: returns at once with a handle and a risk level) and `VERIFY_WAIT:<n>s`. Pick required when later work depends on this delegation, or call router_verify before building on a medium/high-risk deferred result; unverified delegations stay listed in the prompt until verified or expired (1 h, or a restart); absent from the list does not mean verified.",
|
|
299
300
|
"- Command allowlist (first-token basename): npm, npx, pnpm, yarn, bun, node, tsc, tsx, vitest, jest, eslint, prettier, pytest (plus exactly `uv run pytest`). No shell chaining, redirection, substitution or newlines; interpreter inline-eval/print flags are forbidden. buildPasses probes a build script, then root tsconfig.json (npx tsc --noEmit). Unavailable checks produce acceptance caveats, not producer escalation; strictUnverifiable restores rejection.",
|
package/src/v2.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode/plugin";
|
|
2
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
3
|
+
import ModelRouterPlugin from "./index";
|
|
4
|
+
import { createV2Runtime } from "./compat/v2-client";
|
|
5
|
+
import { registerV2Hooks } from "./compat/v2-hooks";
|
|
6
|
+
|
|
7
|
+
/** Keep the routing engine shared; translate only the host API at this boundary. */
|
|
8
|
+
export default {
|
|
9
|
+
id: "opencode-model-router",
|
|
10
|
+
server: ModelRouterPlugin,
|
|
11
|
+
async setup(ctx: Plugin.Context) {
|
|
12
|
+
const runtime = createV2Runtime(ctx);
|
|
13
|
+
// The engine consumes directory/client only. V2 has no legacy HTTP server
|
|
14
|
+
// URL or Bun shell context; do not invent either for the adapter.
|
|
15
|
+
const input = {
|
|
16
|
+
directory: ctx.location.directory,
|
|
17
|
+
worktree: ctx.location.project.directory,
|
|
18
|
+
client: runtime.client,
|
|
19
|
+
routerChildRunner: runtime.childRunner,
|
|
20
|
+
routerHost: "v2" as const,
|
|
21
|
+
};
|
|
22
|
+
const hooks = await ModelRouterPlugin(input as unknown as PluginInput);
|
|
23
|
+
return registerV2Hooks(ctx, hooks, runtime);
|
|
24
|
+
},
|
|
25
|
+
} satisfies Plugin.Plugin & { server: typeof ModelRouterPlugin };
|
package/src/verify/checker.ts
CHANGED
|
@@ -82,7 +82,7 @@ export function atLeastProducerTier(
|
|
|
82
82
|
// Prompt builder
|
|
83
83
|
// ---------------------------------------------------------------------------
|
|
84
84
|
|
|
85
|
-
const GRADER_SYSTEM =
|
|
85
|
+
export const GRADER_SYSTEM =
|
|
86
86
|
'You are an independent, skeptical verification grader. You did NOT produce this work and have no stake in it. Evaluate ONLY whether the artefact satisfies EACH acceptance criterion below. For every criterion, cite concrete evidence from the artefact. If the evidence is missing, ambiguous, partial, or you are uncertain for ANY reason, you MUST fail that criterion. Default to FAIL. Do not give the benefit of the doubt. Output ONLY a single JSON object on one line: {"pass": boolean, "reasons": string[]}. Set pass=true ONLY if every criterion is satisfied with cited evidence; otherwise pass=false with a reason per failed criterion.';
|
|
87
87
|
|
|
88
88
|
/** Upper bound on the working-directory string interpolated into the prompt. */
|
package/src/verify/dispatch.ts
CHANGED
|
@@ -67,7 +67,7 @@ function none(reason: string): ReferenceState {
|
|
|
67
67
|
* appended (a deleted file keeps its directory's canonical spelling); lexical `resolve` when no
|
|
68
68
|
* ancestor resolves.
|
|
69
69
|
*/
|
|
70
|
-
function canonicalPath(path: string): string {
|
|
70
|
+
export function canonicalPath(path: string): string {
|
|
71
71
|
const absolute = resolve(path);
|
|
72
72
|
let head = absolute;
|
|
73
73
|
const tail: string[] = [];
|
package/src/verify/dod.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface DoD {
|
|
|
25
25
|
criteria: string[]; // [] when none
|
|
26
26
|
deliverable: string | null;
|
|
27
27
|
source: DoDSource;
|
|
28
|
+
cwd?: string;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export interface InferHints {
|
|
@@ -79,7 +80,8 @@ export function normalizeDoD(d: DoD): DoD {
|
|
|
79
80
|
const rawDeliverable = typeof d.deliverable === "string" ? d.deliverable.trim() : "";
|
|
80
81
|
const deliverable: string | null = rawDeliverable.length > 0 ? rawDeliverable : null;
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
const cwd = typeof d.cwd === "string" ? d.cwd.trim() : "";
|
|
84
|
+
return { kind, checks, criteria, deliverable, source: d.source, ...(cwd ? { cwd } : {}) };
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
// ---------------------------------------------------------------------------
|
|
@@ -131,6 +133,7 @@ export function parseAcceptanceBlock(text: string, source: DoDSource = "explicit
|
|
|
131
133
|
const criteria: string[] = [];
|
|
132
134
|
let deliverable: string | null = null;
|
|
133
135
|
let kindHint: DoDKind | null = null;
|
|
136
|
+
let cwd: string | undefined;
|
|
134
137
|
|
|
135
138
|
for (const rawLine of innerLines) {
|
|
136
139
|
const line = rawLine.trim();
|
|
@@ -153,6 +156,9 @@ export function parseAcceptanceBlock(text: string, source: DoDSource = "explicit
|
|
|
153
156
|
if (kvPairs["path"] !== undefined) check.path = kvPairs["path"];
|
|
154
157
|
if (kvPairs["schema"] !== undefined) check.schema = kvPairs["schema"];
|
|
155
158
|
checks.push(check);
|
|
159
|
+
} else if (lline.startsWith("cwd:")) {
|
|
160
|
+
const rest = line.slice("cwd:".length).trim().replace(/^(["'])(.*)\1$/, "$2").trim();
|
|
161
|
+
if (rest) cwd = rest;
|
|
156
162
|
} else if (lline.startsWith("criteria:")) {
|
|
157
163
|
const rest = line.slice("criteria:".length).trim();
|
|
158
164
|
if (rest) criteria.push(rest);
|
|
@@ -173,6 +179,7 @@ export function parseAcceptanceBlock(text: string, source: DoDSource = "explicit
|
|
|
173
179
|
criteria,
|
|
174
180
|
deliverable,
|
|
175
181
|
source,
|
|
182
|
+
...(cwd ? { cwd } : {}),
|
|
176
183
|
});
|
|
177
184
|
}
|
|
178
185
|
|
package/src/verify/gate.ts
CHANGED
|
@@ -24,7 +24,8 @@ import { isCheckable } from "./dod";
|
|
|
24
24
|
import { runDeterministic } from "./deterministic";
|
|
25
25
|
import { runChecker } from "./checker";
|
|
26
26
|
import type { ArtefactView, CheckerDeps } from "./checker";
|
|
27
|
-
import {
|
|
27
|
+
import { isAbsolute } from "node:path";
|
|
28
|
+
import { isWithinDir, resolveBaseDir } from "./paths";
|
|
28
29
|
|
|
29
30
|
/** The concrete, inspectable result of a delegation (artefact contract §3.3). */
|
|
30
31
|
export interface Artefact {
|
|
@@ -62,6 +63,12 @@ export interface GateDeps {
|
|
|
62
63
|
*/
|
|
63
64
|
require?: "never" | "whenDoDPresent" | "always";
|
|
64
65
|
strictUnverifiable?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Canonicalizes a path for the outside-the-base check: one directory can be spelled several
|
|
68
|
+
* ways (a Windows 8.3 short name, a symlink such as macOS /var -> /private/var), and a lexical
|
|
69
|
+
* comparison would call the producer's own files "outside". Absent means lexical comparison.
|
|
70
|
+
*/
|
|
71
|
+
canonicalPath?: (path: string) => string;
|
|
65
72
|
}
|
|
66
73
|
|
|
67
74
|
export interface GateResult {
|
|
@@ -187,6 +194,14 @@ export async function accept(
|
|
|
187
194
|
|
|
188
195
|
let verdict: Verdict;
|
|
189
196
|
if (dod.kind === "deterministic") {
|
|
197
|
+
const canonical = deps.canonicalPath ?? ((path: string) => path);
|
|
198
|
+
const canonicalBase = canonical(effectiveBaseDir);
|
|
199
|
+
if (artefact.changedFiles.length > 0 && artefact.changedFiles.every(
|
|
200
|
+
({ path }) => isAbsolute(path) && !isWithinDir(canonical(path), canonicalBase),
|
|
201
|
+
)) {
|
|
202
|
+
const reason = `the producer changed files only outside ${effectiveBaseDir} (e.g. ${artefact.changedFiles[0].path}); checks run there cannot see them. Add "cwd: <dir>" to the [acceptance] block to verify where the work landed.`;
|
|
203
|
+
return gateResult({ pass: false, outcome: "unverifiable", method: "none", reasons: [reason], caveats: [reason] }, dodSource, deps.strictUnverifiable);
|
|
204
|
+
}
|
|
190
205
|
verdict = await runDeterministic(dod, {
|
|
191
206
|
...deps.deterministic,
|
|
192
207
|
cwd: effectiveBaseDir,
|
package/src/verify/paths.ts
CHANGED
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
// resolve relative paths against an effective base dir instead of the router's
|
|
6
6
|
// own cwd.
|
|
7
7
|
|
|
8
|
-
import { isAbsolute, join } from "node:path";
|
|
8
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
9
|
+
|
|
10
|
+
/** Lexical containment only: no filesystem or symlink resolution. */
|
|
11
|
+
export function isWithinDir(path: string, dir: string): boolean {
|
|
12
|
+
const key = (p: string) => process.platform === "win32" ? resolve(p).toLowerCase() : resolve(p);
|
|
13
|
+
const delta = relative(key(dir), key(path));
|
|
14
|
+
// Only a leading `..` SEGMENT leaves the dir: a child named `..cache` stays inside.
|
|
15
|
+
return delta !== ".." && !delta.startsWith(`..${sep}`) && !isAbsolute(delta);
|
|
16
|
+
}
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* Resolve the effective base directory for a delegation's verification.
|
package/src/verify/wiring.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* silently stop applying to graded work.
|
|
15
15
|
*/
|
|
16
16
|
import { createHash } from "node:crypto";
|
|
17
|
+
import type { ChildSessionRunner } from "../compat/child-session";
|
|
17
18
|
import { access, readdir, readFile as fsReadFile, realpath, stat, unlink } from "node:fs/promises";
|
|
18
19
|
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
19
20
|
import { createBatchCoordinator, type BatchCoordinatorOptions, type BatchPlanner } from "./batch";
|
|
@@ -64,6 +65,7 @@ import { DEFAULT_IDLE_TTL_MS } from "../router/idle-sweep";
|
|
|
64
65
|
import {
|
|
65
66
|
buildAcceptedSuffix,
|
|
66
67
|
buildForcingNote,
|
|
68
|
+
canonicalPath,
|
|
67
69
|
tierModel,
|
|
68
70
|
toolLabel,
|
|
69
71
|
type ChangedFile,
|
|
@@ -123,6 +125,32 @@ export function extractAssistantText(res: any): string {
|
|
|
123
125
|
.join("\n");
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
function isValidHttpStatus(status: unknown): status is number {
|
|
129
|
+
return typeof status === "number" && Number.isInteger(status) && status >= 100 && status <= 599;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function graderPromptResponseError(res: unknown): Error | undefined {
|
|
133
|
+
if (typeof res !== "object" || res === null) return undefined;
|
|
134
|
+
const envelope = res as {
|
|
135
|
+
error?: unknown;
|
|
136
|
+
data?: { info?: { error?: unknown } };
|
|
137
|
+
response?: { status?: unknown };
|
|
138
|
+
};
|
|
139
|
+
const error = envelope.data?.info?.error ?? envelope.error;
|
|
140
|
+
const responseStatus = envelope.response?.status;
|
|
141
|
+
const validStatus = isValidHttpStatus(responseStatus);
|
|
142
|
+
const malformedStatus = responseStatus !== undefined && !validStatus;
|
|
143
|
+
const httpStatus = validStatus && responseStatus >= 400
|
|
144
|
+
? responseStatus : undefined;
|
|
145
|
+
if (error == null && httpStatus === undefined && !malformedStatus) return undefined;
|
|
146
|
+
const detail = typeof error === "object" && error !== null ? error as {
|
|
147
|
+
data?: { statusCode?: unknown };
|
|
148
|
+
} : undefined;
|
|
149
|
+
const nestedStatus = detail?.data?.statusCode;
|
|
150
|
+
const status = httpStatus ?? (isValidHttpStatus(nestedStatus) ? nestedStatus : undefined);
|
|
151
|
+
return new Error(`grader prompt failed${status === undefined ? "" : ` (${status})`}: SDK error`);
|
|
152
|
+
}
|
|
153
|
+
|
|
126
154
|
/** P0 (deterministic.ts header, T2): what a gate needs from its dispatch. */
|
|
127
155
|
export interface PreparedVerification {
|
|
128
156
|
/**
|
|
@@ -865,7 +893,7 @@ export interface VerificationWiring {
|
|
|
865
893
|
): Promise<PreparedVerification>;
|
|
866
894
|
/** Session ids currently running a grader prompt, so hooks can skip them. */
|
|
867
895
|
graderSessions: Set<string>;
|
|
868
|
-
/**
|
|
896
|
+
/** Stop a plugin-created child; v1 deletes it, a host runner owns v2 cleanup. Never throws. */
|
|
869
897
|
disposeChildSession(sid: string): Promise<void>;
|
|
870
898
|
/** Run one grader turn, parented to the caller's session when given. */
|
|
871
899
|
dispatchGrader(
|
|
@@ -886,7 +914,7 @@ export interface VerificationWiring {
|
|
|
886
914
|
* the changed files are "unavailable" and the reference is the untracked default. `deadline`
|
|
887
915
|
* bounds every testsPass step (T3); without it each testsPass check owns one of gateBudgetMs.
|
|
888
916
|
*/
|
|
889
|
-
buildGateDeps(parentSessionID?: string, inFlight?: Set<string>, prepared?: PreparedVerification, deadline?: Deadline): GateDeps;
|
|
917
|
+
buildGateDeps(parentSessionID?: string, inFlight?: Set<string>, prepared?: PreparedVerification, deadline?: Deadline, forceLowPriority?: boolean, creatorSessionID?: string | null): GateDeps;
|
|
890
918
|
/**
|
|
891
919
|
* 2.2.3: the idle-TTL sweep's hook into the plugin's one S5 batch coordinator (batch.ts B11):
|
|
892
920
|
* evicts windows with no live member and batches whose seam hung past BATCH_STALE_GRACE_MS.
|
|
@@ -935,11 +963,14 @@ function errorText(err: unknown): string {
|
|
|
935
963
|
|
|
936
964
|
export function createVerificationWiring(deps: {
|
|
937
965
|
client: any;
|
|
966
|
+
childRunner?: ChildSessionRunner;
|
|
938
967
|
/** Project root; relative paths in checks resolve against it. */
|
|
939
968
|
directory: string;
|
|
940
969
|
getConfig: () => RouterConfig;
|
|
941
970
|
/** Default: console.warn, no debug output. */
|
|
942
971
|
logger?: WiringLogger;
|
|
972
|
+
/** Record each grader's creator before its first prompt, independently of its backend parent. */
|
|
973
|
+
onChildSessionCreated?: (sid: string, creatorSid: string | null) => void;
|
|
943
974
|
/** Test seams of the S5 batch coordinator (clock, timers, platform, maximum window size). */
|
|
944
975
|
batch?: Omit<BatchCoordinatorOptions, "logger">;
|
|
945
976
|
/** Test seams of the pending registry (clock, random source). */
|
|
@@ -1006,6 +1037,8 @@ export function createVerificationWiring(deps: {
|
|
|
1006
1037
|
/** QA-3.1-3: dispatches starting together share their snapshot and capture (createSharedFlight). */
|
|
1007
1038
|
const sharedSnapshots = createSharedFlight<TreeSnapshot>();
|
|
1008
1039
|
const sharedCaptures = createSharedFlight<DispatchReference>();
|
|
1040
|
+
/** The gate-time snapshot of observeChange, shared the same way (keyed by priority, cwd and digest paths). */
|
|
1041
|
+
const sharedGateSnapshots = createSharedFlight<TreeSnapshot>();
|
|
1009
1042
|
|
|
1010
1043
|
const abs = (p: string): string => (isAbsolute(p) ? p : join(directory, p));
|
|
1011
1044
|
|
|
@@ -1150,6 +1183,10 @@ export function createVerificationWiring(deps: {
|
|
|
1150
1183
|
}
|
|
1151
1184
|
}
|
|
1152
1185
|
disposed.add(sid);
|
|
1186
|
+
if (deps.childRunner) {
|
|
1187
|
+
try { await deps.childRunner.dispose(sid); } catch { /* best-effort cleanup */ }
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1153
1190
|
try {
|
|
1154
1191
|
await client.session.abort({ path: { id: sid } });
|
|
1155
1192
|
} catch {
|
|
@@ -1162,11 +1199,48 @@ export function createVerificationWiring(deps: {
|
|
|
1162
1199
|
}
|
|
1163
1200
|
};
|
|
1164
1201
|
|
|
1202
|
+
const notifyChildCreated = (sid: string, creatorSid: string | null): void => {
|
|
1203
|
+
try {
|
|
1204
|
+
deps.onChildSessionCreated?.(sid, creatorSid);
|
|
1205
|
+
} catch (error) {
|
|
1206
|
+
logger.warn("[verify] child-session hook failed", { error: errorText(error) });
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1165
1210
|
const dispatchGrader = async (
|
|
1166
1211
|
req: GraderRequest,
|
|
1167
1212
|
parentSessionID?: string,
|
|
1168
1213
|
inFlight?: Set<string>,
|
|
1214
|
+
creatorSessionID: string | null = parentSessionID ?? null,
|
|
1169
1215
|
): Promise<{ sessionID: string; text: string }> => {
|
|
1216
|
+
if (deps.childRunner) {
|
|
1217
|
+
const cfg = getConfig();
|
|
1218
|
+
const controller = new AbortController();
|
|
1219
|
+
let sid: string | undefined;
|
|
1220
|
+
try {
|
|
1221
|
+
return await withTimeout(deps.childRunner.run({
|
|
1222
|
+
parentSessionID,
|
|
1223
|
+
cwd: req.cwd,
|
|
1224
|
+
model: tierModel(cfg, req.tier) ?? undefined,
|
|
1225
|
+
system: req.system,
|
|
1226
|
+
prompt: req.prompt,
|
|
1227
|
+
signal: controller.signal,
|
|
1228
|
+
async onCreated(sessionID) {
|
|
1229
|
+
sid = sessionID;
|
|
1230
|
+
graderSessions.add(sessionID);
|
|
1231
|
+
inFlight?.add(sessionID);
|
|
1232
|
+
notifyChildCreated(sessionID, creatorSessionID);
|
|
1233
|
+
},
|
|
1234
|
+
}), graderTimeoutMs(req.tier, cfg.enforcement?.verify?.graderTimeoutMs), "grader prompt");
|
|
1235
|
+
} finally {
|
|
1236
|
+
controller.abort();
|
|
1237
|
+
if (sid) {
|
|
1238
|
+
graderSessions.delete(sid);
|
|
1239
|
+
inFlight?.delete(sid);
|
|
1240
|
+
await disposeChildSession(sid);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1170
1244
|
// Scope the grader session to the producer's working directory when one was
|
|
1171
1245
|
// declared. Naming the directory in the prompt is not enough: the grader
|
|
1172
1246
|
// has real tools, and an unscoped session resolves every read and command
|
|
@@ -1180,6 +1254,7 @@ export function createVerificationWiring(deps: {
|
|
|
1180
1254
|
if (!sid) return { sessionID: "", text: "" };
|
|
1181
1255
|
graderSessions.add(sid);
|
|
1182
1256
|
inFlight?.add(sid);
|
|
1257
|
+
notifyChildCreated(sid, creatorSessionID);
|
|
1183
1258
|
try {
|
|
1184
1259
|
const cfg = getConfig();
|
|
1185
1260
|
const model = tierModel(cfg, req.tier) ?? undefined;
|
|
@@ -1208,6 +1283,8 @@ export function createVerificationWiring(deps: {
|
|
|
1208
1283
|
graderTimeoutMs(req.tier, cfg.enforcement?.verify?.graderTimeoutMs),
|
|
1209
1284
|
"grader prompt",
|
|
1210
1285
|
);
|
|
1286
|
+
const responseError = graderPromptResponseError(res);
|
|
1287
|
+
if (responseError) throw responseError;
|
|
1211
1288
|
return { sessionID: sid, text: extractAssistantText(res) };
|
|
1212
1289
|
} finally {
|
|
1213
1290
|
graderSessions.delete(sid);
|
|
@@ -1251,6 +1328,7 @@ export function createVerificationWiring(deps: {
|
|
|
1251
1328
|
prepared?: PreparedVerification,
|
|
1252
1329
|
deadline?: Deadline,
|
|
1253
1330
|
forceLowPriority = false,
|
|
1331
|
+
creatorSessionID: string | null = parentSessionID ?? null,
|
|
1254
1332
|
): GateDeps => {
|
|
1255
1333
|
const cfg = getConfig();
|
|
1256
1334
|
const resolved = resolveVerifyBudget(cfg);
|
|
@@ -1329,12 +1407,13 @@ export function createVerificationWiring(deps: {
|
|
|
1329
1407
|
},
|
|
1330
1408
|
checker: {
|
|
1331
1409
|
dispatchGrader: (req: GraderRequest) =>
|
|
1332
|
-
dispatchGrader(req, parentSessionID, inFlight),
|
|
1410
|
+
dispatchGrader(req, parentSessionID, inFlight, creatorSessionID),
|
|
1333
1411
|
ladder: ["fast", "medium", "heavy"],
|
|
1334
1412
|
minGraderTier: cfg.enforcement?.verify?.minGraderTier ?? null,
|
|
1335
1413
|
},
|
|
1336
1414
|
require: cfg.enforcement?.verify?.require,
|
|
1337
1415
|
strictUnverifiable: cfg.enforcement?.verify?.strictUnverifiable,
|
|
1416
|
+
canonicalPath,
|
|
1338
1417
|
};
|
|
1339
1418
|
};
|
|
1340
1419
|
|
|
@@ -1385,8 +1464,20 @@ export function createVerificationWiring(deps: {
|
|
|
1385
1464
|
const options = digests === undefined
|
|
1386
1465
|
? { lowPriority }
|
|
1387
1466
|
: { lowPriority, digestPaths: digests === "unavailable" ? [] : [...digests.keys()] };
|
|
1467
|
+
// QA-3.1-3 at the finish: parallel finishes share one gate-time snapshot per key, and a run
|
|
1468
|
+
// only serves finishes that asked before it started (createSharedFlight), so each still sees
|
|
1469
|
+
// the tree as it was after its own producer returned. Unshared, 20 parallel deferred finishes
|
|
1470
|
+
// spawned 140 git processes and hit DEFERRED_FINISH_MS on a 4-core Windows runner.
|
|
1471
|
+
const digestKey = options.digestPaths === undefined
|
|
1472
|
+
? "all"
|
|
1473
|
+
: createHash("sha256").update([...options.digestPaths].sort().join("\0")).digest("hex");
|
|
1474
|
+
const key = `${lowPriority ? "low" : "normal"}\0${base}\0${digestKey}`;
|
|
1388
1475
|
snapshot = bound > 0 && !controller.signal.aborted
|
|
1389
|
-
? await withTimeout(
|
|
1476
|
+
? await withTimeout(
|
|
1477
|
+
sharedGateSnapshots(key, shared => snapshotTree(base, shared, options), controller.signal),
|
|
1478
|
+
bound,
|
|
1479
|
+
"grade fingerprint",
|
|
1480
|
+
)
|
|
1390
1481
|
: undefined;
|
|
1391
1482
|
} catch {
|
|
1392
1483
|
snapshot = undefined; // Explicit unavailable disclaimer, never a raw tree.
|
package/tiers.json
CHANGED
|
@@ -45,9 +45,11 @@
|
|
|
45
45
|
"presets": {
|
|
46
46
|
"anthropic": {
|
|
47
47
|
"fast": {
|
|
48
|
-
"model": "anthropic/claude-sonnet-5",
|
|
48
|
+
"model": "anthropic/claude-sonnet-5-5",
|
|
49
|
+
"variant": "low",
|
|
50
|
+
"effort": "low",
|
|
49
51
|
"costRatio": 1,
|
|
50
|
-
"description": "Sonnet 5 for exploration, search, and simple reads",
|
|
52
|
+
"description": "Sonnet 5.5 low for exploration, search, and simple reads",
|
|
51
53
|
"steps": 30,
|
|
52
54
|
"whenToUse": [
|
|
53
55
|
"Codebase exploration and search",
|
|
@@ -57,11 +59,11 @@
|
|
|
57
59
|
]
|
|
58
60
|
},
|
|
59
61
|
"medium": {
|
|
60
|
-
"model": "anthropic/claude-
|
|
61
|
-
"variant": "
|
|
62
|
-
"effort": "
|
|
62
|
+
"model": "anthropic/claude-sonnet-5-5",
|
|
63
|
+
"variant": "medium",
|
|
64
|
+
"effort": "medium",
|
|
63
65
|
"costRatio": 5,
|
|
64
|
-
"description": "
|
|
66
|
+
"description": "Sonnet 5.5 medium for implementation, refactoring, and tests",
|
|
65
67
|
"steps": 50,
|
|
66
68
|
"whenToUse": [
|
|
67
69
|
"Feature implementation",
|
|
@@ -99,10 +101,10 @@
|
|
|
99
101
|
]
|
|
100
102
|
},
|
|
101
103
|
"medium": {
|
|
102
|
-
"model": "openai/gpt-6-
|
|
103
|
-
"variant": "
|
|
104
|
+
"model": "openai/gpt-6.1-sol-fast",
|
|
105
|
+
"variant": "xhigh",
|
|
104
106
|
"costRatio": 5,
|
|
105
|
-
"description": "GPT-
|
|
107
|
+
"description": "GPT-6.1 Sol Fast (xhigh) for implementation and standard coding",
|
|
106
108
|
"steps": 50,
|
|
107
109
|
"whenToUse": [
|
|
108
110
|
"Feature implementation",
|
|
@@ -154,7 +156,7 @@
|
|
|
154
156
|
"heavy": {
|
|
155
157
|
"model": "github-copilot/claude-fable-5-1",
|
|
156
158
|
"costRatio": 20,
|
|
157
|
-
"description": "Claude Fable 5 via GitHub Copilot for architecture, complex debugging, and security",
|
|
159
|
+
"description": "Claude Fable 5.1 via GitHub Copilot for architecture, complex debugging, and security",
|
|
158
160
|
"steps": 120,
|
|
159
161
|
"whenToUse": [
|
|
160
162
|
"Architecture decisions",
|
|
@@ -247,9 +249,9 @@
|
|
|
247
249
|
"hybrid": {
|
|
248
250
|
"fast": {
|
|
249
251
|
"model": "openai/gpt-6-luna-fast",
|
|
250
|
-
"variant": "
|
|
252
|
+
"variant": "medium",
|
|
251
253
|
"costRatio": 1,
|
|
252
|
-
"description": "GPT 6 Luna (
|
|
254
|
+
"description": "GPT 6 Luna (medium) for exploration, search, and simple reads",
|
|
253
255
|
"steps": 30,
|
|
254
256
|
"whenToUse": [
|
|
255
257
|
"Codebase exploration and search",
|
|
@@ -260,9 +262,9 @@
|
|
|
260
262
|
},
|
|
261
263
|
"medium": {
|
|
262
264
|
"model": "openai/gpt-6-astra-fast",
|
|
263
|
-
"variant": "
|
|
265
|
+
"variant": "high",
|
|
264
266
|
"costRatio": 5,
|
|
265
|
-
"description": "GPT-6 Astra Fast (
|
|
267
|
+
"description": "GPT-6 Astra Fast (high) for implementation and standard coding",
|
|
266
268
|
"steps": 50,
|
|
267
269
|
"whenToUse": [
|
|
268
270
|
"Feature implementation",
|
|
@@ -272,10 +274,11 @@
|
|
|
272
274
|
]
|
|
273
275
|
},
|
|
274
276
|
"heavy": {
|
|
275
|
-
"model": "anthropic/claude-
|
|
276
|
-
"variant": "
|
|
277
|
+
"model": "anthropic/claude-opus-5-5",
|
|
278
|
+
"variant": "xhigh",
|
|
279
|
+
"effort": "xhigh",
|
|
277
280
|
"costRatio": 20,
|
|
278
|
-
"description": "Claude
|
|
281
|
+
"description": "Claude Opus 5.5 xhigh for architecture, complex debugging, and security",
|
|
279
282
|
"steps": 120,
|
|
280
283
|
"whenToUse": [
|
|
281
284
|
"Architecture decisions",
|