Skip to content

Commit 2429e10

Browse files
committed
Merge remote-tracking branch 'origin/v2/feat/4863-skills-infrastructure' into v2/feat/4864-ts-workspace-gate
Signed-off-by: cliffhall <[email protected]>
2 parents 01c0597 + e10b992 commit 2429e10

5 files changed

Lines changed: 62 additions & 1 deletion

File tree

‎docs/skill-authoring.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ A chained case names the ordered skills one run should load:
223223

224224
```json
225225
{
226-
"prompt": "Write an integration test that exercises tool listing against a real server.",
226+
"prompt": "Write an integration test that exercises tool listing end to end.",
227227
"chain": ["testing", "test-servers"]
228228
}
229229
```

‎scripts/lib/npm-scripts.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ export function scriptChainRuns(scripts, entry, target) {
153153
.map((part) => unwrapGateLease(part.trim()))) {
154154
if (segment === `npm run ${target}`) return true;
155155
const tokens = segment.split(/\s+/);
156+
// An intermediate hop must be as unmasked as the target itself: in
157+
// `npm run stage || true` (or `| tee`) the stage's failure is swallowed,
158+
// so a target reached through it gates nothing (Copilot, #4895).
159+
if (segment.includes("|")) continue;
156160
if (tokens[0] === "npm" && tokens[1] === "run" && tokens[2]) {
157161
queue.push(tokens[2]);
158162
}

‎scripts/skill-eval.mjs‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,15 @@ async function pool(items, n, fn) {
787787
return out;
788788
}
789789

790+
/**
791+
* Whether an env-supplied count is usable as a run, turn or worker count.
792+
*
793+
* @param {number} value
794+
*/
795+
export function isPositiveInteger(value) {
796+
return Number.isInteger(value) && value > 0;
797+
}
798+
790799
/**
791800
* Whether a measured rate clears its bar.
792801
*
@@ -906,6 +915,22 @@ async function main() {
906915
);
907916
process.exit(1);
908917
}
918+
// The turn budget is also Copilot's external stop condition, so a non-numeric
919+
// value would silently remove the cap on metered calls (`turnOffset >= NaN`
920+
// is never true); RUNS and CONCURRENCY fail the same quiet way (Copilot,
921+
// #4895).
922+
for (const [name, value] of [
923+
["CHAIN_MAX_TURNS", CHAIN_MAX_TURNS],
924+
["RUNS", RUNS],
925+
["CONCURRENCY", CONCURRENCY],
926+
]) {
927+
if (!isPositiveInteger(value)) {
928+
console.error(
929+
`skills:eval — ${name} must be a positive integer (got ${process.env[name] ?? value}).`,
930+
);
931+
process.exit(1);
932+
}
933+
}
909934
if (!AGENTS.includes(AGENT)) {
910935
console.error(
911936
`skills:eval — AGENT must be one of ${AGENTS.join(", ")} (got \`${AGENT}\`).`,

‎scripts/skill-eval.test.mjs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,3 +1053,11 @@ test("a rejected Copilot run leaves the in-flight set", async () => {
10531053
);
10541054
assert.equal(stopLiveCopilotRuns(), 0);
10551055
});
1056+
1057+
test("isPositiveInteger accepts only usable counts (#4895)", async () => {
1058+
const { isPositiveInteger } = await import("./skill-eval.mjs");
1059+
for (const ok of [1, 3, 14]) assert.equal(isPositiveInteger(ok), true, ok);
1060+
for (const bad of [0, -1, 1.5, Number.NaN, Number("abc"), Infinity]) {
1061+
assert.equal(isPositiveInteger(bad), false, String(bad));
1062+
}
1063+
});

‎scripts/verify-skills.main.test.mjs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,3 +770,27 @@ test("scriptChainRuns follows npm's implicit pre/post hooks", () => {
770770
true,
771771
);
772772
});
773+
774+
test("scriptChainRuns does not follow a masked intermediate hop (#4895)", () => {
775+
const T = "verify:skills:cli";
776+
for (const gate of ["npm run stage || true", "npm run stage | tee log"]) {
777+
assert.equal(
778+
scriptChainRuns(
779+
{ "local:gate": gate, stage: `npm run ${T}` },
780+
"local:gate",
781+
T,
782+
),
783+
false,
784+
gate,
785+
);
786+
}
787+
// The unmasked hop is still followed.
788+
assert.equal(
789+
scriptChainRuns(
790+
{ "local:gate": "npm run stage", stage: `npm run ${T}` },
791+
"local:gate",
792+
T,
793+
),
794+
true,
795+
);
796+
});

0 commit comments

Comments
 (0)