skillfit 0.10.0 → 0.10.1

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.
Files changed (51) hide show
  1. package/README.md +10 -2
  2. package/README.zh-CN.md +10 -2
  3. package/dist/cli.js +19 -13
  4. package/dist/commands/bench.js +99 -91
  5. package/dist/commands/eval-component.js +8 -1
  6. package/dist/commands/eval-export.js +32 -6
  7. package/dist/commands/eval-export.test.js +165 -8
  8. package/dist/commands/eval-interruption.test.js +238 -0
  9. package/dist/commands/eval-preflight.js +61 -0
  10. package/dist/commands/eval-preflight.test.js +239 -0
  11. package/dist/commands/eval-report.js +44 -13
  12. package/dist/commands/eval-report.test.js +2 -2
  13. package/dist/commands/eval.js +81 -59
  14. package/dist/harness/eval-audit.js +3 -1
  15. package/dist/harness/eval-budget.test.js +4 -2
  16. package/dist/harness/eval-component.test.js +6 -6
  17. package/dist/harness/executors/api.js +10 -1
  18. package/dist/harness/executors/api.test.js +43 -0
  19. package/dist/harness/executors/cli.js +24 -3
  20. package/dist/harness/experiment-session.js +60 -9
  21. package/dist/harness/experiment-session.test.js +43 -1
  22. package/dist/harness/input-snapshot.js +150 -0
  23. package/dist/harness/interruption.js +48 -0
  24. package/dist/harness/interruption.test.js +31 -0
  25. package/dist/harness/runner.js +53 -15
  26. package/dist/harness/trigger.js +20 -4
  27. package/docs/bench-check-json.md +8 -1
  28. package/docs/eval-case-preflight.md +110 -0
  29. package/docs/eval-component.md +28 -0
  30. package/docs/eval-costs.md +9 -0
  31. package/docs/evaluation-input-snapshots.md +124 -0
  32. package/docs/evaluation-interruption.md +89 -0
  33. package/docs/evaluation-reports.md +49 -0
  34. package/docs/experiment-workflow.md +9 -2
  35. package/docs/first-real-eval.md +5 -2
  36. package/docs/growth-roadmap-2026-10.md +15 -10
  37. package/docs/metrics.md +31 -0
  38. package/docs/plans/2026-10-16-case-workflow-and-release.md +19 -0
  39. package/docs/releases/0.10.0-ci-registry-install.json +140 -0
  40. package/docs/releases/0.10.0-feature-smoke.json +22 -0
  41. package/docs/releases/0.10.0-feature-smoke.mjs +62 -0
  42. package/docs/releases/0.10.0-signatures.txt +7 -0
  43. package/docs/releases/0.10.0-verification.json +76 -0
  44. package/docs/releases/0.10.0.md +44 -8
  45. package/docs/releases/0.10.1-feature-smoke.mjs +95 -0
  46. package/docs/releases/0.10.1.md +38 -0
  47. package/docs/replay-packages.md +14 -5
  48. package/docs/schemas/eval-preflight.schema.json +57 -0
  49. package/docs/schemas/eval-result.schema.json +11 -0
  50. package/docs/sharing-results.md +5 -2
  51. package/package.json +1 -1
@@ -1,11 +1,12 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
3
  import { dirname, join, resolve } from 'node:path';
4
4
  import { MOCK_MARKER_FILE, RUN_GROUP_PATTERN } from './constants.js';
5
5
  import { assertInstalledSkillFixtures, assertSkillRevisionTargets, installSkillResources, installedSkillDestination } from './installed-skill.js';
6
6
  import { collectInstalledSkillFingerprint } from './bundle.js';
7
7
  import { judgePair } from './judge.js';
8
8
  import { killTree, treeSpawnOptions } from './kill-tree.js';
9
+ import { evaluationSignal, throwIfEvaluationInterrupted } from './interruption.js';
9
10
  import { assertInputModeSupported, buildTaskPrompt, snapshotRepoFiles } from './prompt.js';
10
11
  import { buildWarnings, verdictFor, } from './report.js';
11
12
  import { mcnemarExactP, pairedDeltaBootstrapCI, pairedScoreBootstrapCI } from './stats.js';
@@ -28,6 +29,9 @@ function applyOverlay(overlayDir, runDir) {
28
29
  const VERIFIER_TIMEOUT_MS = 2 * 60 * 1000;
29
30
  const MAX_PROCESS_OUTPUT_BYTES = 8 * 1024 * 1024;
30
31
  function runProcess(command, args, cwd, timeoutMs) {
32
+ const signal = evaluationSignal();
33
+ if (signal?.aborted)
34
+ return Promise.resolve({ exitCode: null, output: '', error: signal.reason.message });
31
35
  return new Promise((resolvePromise) => {
32
36
  let child;
33
37
  try {
@@ -43,15 +47,47 @@ function runProcess(command, args, cwd, timeoutMs) {
43
47
  let bytes = 0;
44
48
  let timedOut = false;
45
49
  let overflow = false;
50
+ let stopping = false;
51
+ let settled = false;
52
+ let drainTimer;
53
+ const finish = (result) => {
54
+ if (settled)
55
+ return;
56
+ settled = true;
57
+ clearTimeout(timer);
58
+ clearTimeout(drainTimer);
59
+ signal?.removeEventListener('abort', onAbort);
60
+ resolvePromise(result);
61
+ };
62
+ const result = (code) => ({
63
+ exitCode: signal?.aborted || timedOut || overflow ? null : code,
64
+ output: timedOut ? `${output}\n[timed out after ${timeoutMs}ms]` : output,
65
+ error: signal?.aborted ? signal.reason.message : overflow
66
+ ? `output exceeded ${MAX_PROCESS_OUTPUT_BYTES} bytes` : timedOut ? `timed out after ${timeoutMs}ms` : null,
67
+ });
68
+ const stop = () => {
69
+ if (stopping || settled)
70
+ return;
71
+ stopping = true;
72
+ killTree(child);
73
+ drainTimer = setTimeout(() => {
74
+ child.stdin?.destroy();
75
+ child.stdout.destroy();
76
+ child.stderr.destroy();
77
+ child.unref();
78
+ finish(result(null));
79
+ }, 2000);
80
+ };
81
+ const onAbort = () => stop();
46
82
  const timer = setTimeout(() => {
47
83
  timedOut = true;
48
- killTree(child);
84
+ stop();
49
85
  }, timeoutMs);
50
86
  const take = (chunk) => {
51
87
  bytes += chunk.length;
52
88
  if (bytes > MAX_PROCESS_OUTPUT_BYTES) {
53
89
  overflow = true;
54
- killTree(child);
90
+ stop();
55
91
  return;
56
92
  }
57
93
  output += chunk.toString('utf8');
@@ -63,18 +99,14 @@ function runProcess(command, args, cwd, timeoutMs) {
63
99
  child.stdin?.on('error', () => { });
64
100
  child.stdin?.end();
65
101
  child.on('error', (error) => {
66
- clearTimeout(timer);
67
- resolvePromise({ exitCode: null, output, error: error.message });
102
+ finish({ exitCode: null, output, error: error.message });
68
103
  });
69
104
  child.on('close', (code) => {
70
- clearTimeout(timer);
71
- const limited = overflow ? `output exceeded ${MAX_PROCESS_OUTPUT_BYTES} bytes` : null;
72
- resolvePromise({
73
- exitCode: timedOut || overflow ? null : code,
74
- output: timedOut ? `${output}\n[timed out after ${timeoutMs}ms]` : output,
75
- error: limited ?? (timedOut ? `timed out after ${timeoutMs}ms` : null),
76
- });
105
+ finish(result(code));
77
106
  });
107
+ signal?.addEventListener('abort', onAbort, { once: true });
108
+ if (signal?.aborted)
109
+ onAbort();
78
110
  });
79
111
  }
80
112
  export async function gitInit(dir) {
@@ -118,6 +150,7 @@ export async function engagementError(output, verifierKind, runDir, gitInitializ
118
150
  return ENGAGEMENT_ERROR;
119
151
  }
120
152
  export async function runTrial(plan, taskId, condition, trial) {
153
+ throwIfEvaluationInterrupted();
121
154
  const { bench, executor } = plan;
122
155
  const target = condition === 'baseline' && plan.baselineTarget ? plan.baselineTarget : plan.target;
123
156
  if (plan.baselineTarget) {
@@ -165,6 +198,7 @@ export async function runTrial(plan, taskId, condition, trial) {
165
198
  installNativeDiffTool(runDir);
166
199
  }
167
200
  const gitInitialized = await gitInit(runDir);
201
+ throwIfEvaluationInterrupted();
168
202
  const taskPromptText = readFileSync(join(bench.dir, task.prompt), 'utf8');
169
203
  const prompt = buildTaskPrompt(taskPromptText, snapshot, condition === 'treatment' && !plan.skillInstallDir ? target.payload : null,
170
204
  // Workspace configuration experiments must let the agent use its configured tools and inspect
@@ -444,6 +478,7 @@ async function judgeTaskTrials(plan, taskId, outcomes) {
444
478
  writeFileSync(join(taskDir, `judge-trial-${trial}.json`), `${JSON.stringify({ trial, seed, ...result }, null, 2)}\n`, 'utf8');
445
479
  }
446
480
  catch (error) {
481
+ throwIfEvaluationInterrupted();
447
482
  plan.log?.(`Judge failed for ${task.id} trial ${trial}: ${error.message}`);
448
483
  }
449
484
  }
@@ -593,9 +628,10 @@ export async function runExperiment(plan) {
593
628
  throw new Error(`trials must be an integer between 1 and 20, got ${plan.trials}`);
594
629
  }
595
630
  const groupDir = join(plan.runsRoot, plan.runGroup);
596
- if (existsSync(groupDir) && !(plan.session?.groupDir === resolve(groupDir) &&
597
- readdirSync(groupDir).join() === '_plan.json')) {
598
- throw new Error(`Run group directory already exists: ${groupDir}`);
631
+ if (existsSync(groupDir)) {
632
+ if (plan.session?.groupDir !== resolve(groupDir))
633
+ throw new Error(`Run group directory already exists: ${groupDir}`);
634
+ plan.session.assertPrepared();
599
635
  }
600
636
  mkdirSync(groupDir, { recursive: true });
601
637
  if (plan.skillInstallDir)
@@ -618,6 +654,7 @@ export async function runExperiment(plan) {
618
654
  // provider drift or rate-limit degradation would land entirely on one arm.
619
655
  for (let trial = 1; trial <= plan.trials; trial++) {
620
656
  for (const condition of pairConditions(pairOrder, taskIndex, trial)) {
657
+ throwIfEvaluationInterrupted();
621
658
  const before = budgetEvent('before-call', task.id, condition, trial);
622
659
  if (before)
623
660
  assertSpendingCanContinue(before);
@@ -627,6 +664,7 @@ export async function runExperiment(plan) {
627
664
  allOutcomes[condition].push(outcome);
628
665
  budgetObservations.push(outcome);
629
666
  const after = budgetEvent('after-call', task.id, condition, trial);
667
+ throwIfEvaluationInterrupted();
630
668
  // A reached line prevents the next call; incomplete or failed evidence stops even
631
669
  // after the final scheduled call. One in-flight invocation may cross a stop line.
632
670
  if (after && (after.incomplete.length || after.reason === 'EXECUTION_FAILED'))
@@ -1,12 +1,15 @@
1
- import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
1
+ import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
2
2
  import { dirname, join, resolve } from 'node:path';
3
3
  import { MOCK_MARKER_FILE, RUN_GROUP_PATTERN } from './constants.js';
4
4
  import { collectInstalledSkillFingerprint, collectSkillBundle } from './bundle.js';
5
5
  import { OUTPUT_CONTRACT } from './prompt.js';
6
6
  import { engagementError, gitInit, runVerifier, verifierFailure, verifierLogFor } from './runner.js';
7
7
  import { wilson95 } from './stats.js';
8
+ import { throwIfEvaluationInterrupted } from './interruption.js';
9
+ import { ExecutorFailure } from './types.js';
8
10
  import { verdictFromOutput } from './verifier-summary.js';
9
11
  async function runTriggerTrial(plan, taskId, trial, installedSkill) {
12
+ throwIfEvaluationInterrupted();
10
13
  const task = plan.bench.tasks.find((t) => t.id === taskId);
11
14
  if (!task)
12
15
  throw new Error(`Unknown task: ${taskId}`);
@@ -18,6 +21,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
18
21
  cpSync(join(plan.bench.dir, task.fixture), runDir, { recursive: true });
19
22
  rmSync(join(runDir, MOCK_MARKER_FILE), { force: true });
20
23
  const gitInitialized = await gitInit(runDir);
24
+ throwIfEvaluationInterrupted();
21
25
  const taskPromptText = readFileSync(join(plan.bench.dir, task.promptTrigger ?? task.prompt), 'utf8');
22
26
  const prompt = `${[taskPromptText.trimEnd(), OUTPUT_CONTRACT].join('\n\n')}\n`;
23
27
  writeFileSync(join(runDir, '_prompt.txt'), prompt, 'utf8');
@@ -43,6 +47,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
43
47
  let rawOutput = null;
44
48
  let error = null;
45
49
  let tokens = null;
50
+ let failedUsage;
46
51
  let triggered = null;
47
52
  try {
48
53
  if (!gitInitialized && task.verifierKind === 'command') {
@@ -57,6 +62,13 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
57
62
  }
58
63
  catch (executorError) {
59
64
  error = executorError.message;
65
+ if (executorError instanceof ExecutorFailure) {
66
+ output = executorError.result.output;
67
+ rawOutput = executorError.result.rawOutput ?? null;
68
+ tokens = executorError.result.tokens ?? null;
69
+ triggered = executorError.result.skillTriggered ?? null;
70
+ failedUsage = executorError.result.usageStatus ?? 'unknown';
71
+ }
60
72
  }
61
73
  if (error === null) {
62
74
  error = await engagementError(output, task.verifierKind, runDir, gitInitialized);
@@ -100,6 +112,7 @@ async function runTriggerTrial(plan, taskId, trial, installedSkill) {
100
112
  checks,
101
113
  error,
102
114
  tokens,
115
+ ...(failedUsage ? { usageStatus: failedUsage } : {}),
103
116
  };
104
117
  writeFileSync(join(runDir, '_result.json'), `${JSON.stringify({
105
118
  schemaVersion: 1,
@@ -229,9 +242,10 @@ export async function runTriggerExperiment(plan) {
229
242
  throw new Error('Trigger mode requires a real CLI executor with trigger detection; the mock executor cannot invoke skills.');
230
243
  }
231
244
  const groupDir = join(plan.runsRoot, plan.runGroup);
232
- if (existsSync(groupDir) && !(plan.session?.groupDir === resolve(groupDir) &&
233
- readdirSync(groupDir).join() === '_plan.json')) {
234
- throw new Error(`Run group directory already exists: ${groupDir}`);
245
+ if (existsSync(groupDir)) {
246
+ if (plan.session?.groupDir !== resolve(groupDir))
247
+ throw new Error(`Run group directory already exists: ${groupDir}`);
248
+ plan.session.assertPrepared();
235
249
  }
236
250
  const installedSkill = collectInstalledSkillFingerprint(plan.skill.sourceDir);
237
251
  if (collectSkillBundle(plan.skill.sourceDir, plan.skill.name).sha256 !== plan.skill.sha256) {
@@ -247,8 +261,10 @@ export async function runTriggerExperiment(plan) {
247
261
  for (const task of eligible) {
248
262
  const records = [];
249
263
  for (let trial = 1; trial <= plan.trials; trial++) {
264
+ throwIfEvaluationInterrupted();
250
265
  plan.log?.(`Running ${task.id} / installed / trial ${trial}…`);
251
266
  records.push(await runTriggerTrial(plan, task.id, trial, installedSkill));
267
+ throwIfEvaluationInterrupted();
252
268
  }
253
269
  taskSummaries.push(summarizeTriggerTask(task.id, task.shouldTrigger ?? false, task.triggerClass, records));
254
270
  }
@@ -91,7 +91,7 @@ inspect coverage notes and warnings before deciding what the bench establishes.
91
91
  | `ORACLE` | Reference repair executes and passes the verifier with full named checks, or warns when no oracle is registered |
92
92
  | `MOCK_COVERAGE` | Why mock probes are unavailable or not applicable |
93
93
  | `MOCK_MARKER` | A present mock marker must parse |
94
- | `MOCK_BASELINE`, `MOCK_TREATMENT` | Observed mock-arm results, retained as informational checks |
94
+ | `MOCK_BASELINE`, `MOCK_TREATMENT` | Observed mock-arm results or omitted-arm notes; process failures are `FAIL` in source after 0.10.0 |
95
95
  | `FIXTURE_SIZE` | Existing fixture-size check and 64 KiB warning |
96
96
  | `TRIGGER_LABEL` | An unlabeled task is skipped in trigger mode |
97
97
  | `NEGATIVE_CONTROLS` | Existing negative-control coverage and 30% target |
@@ -101,6 +101,13 @@ or `EMPTY_OUTPUT`: those gates deliberately test unsolved/absent work. Read the
101
101
  gate status before interpreting process evidence. A verifier that cannot start
102
102
  never counts as reproducing a failure.
103
103
 
104
+ Source after npm 0.10.0 identifies omitted mock arms as `INFO` with null evidence,
105
+ and treats a mock verifier without an exit verdict as a hard failure. A functioning
106
+ verifier's ordinary pass/fail on supplied mock output remains informational.
107
+ Standalone no-oracle status remains `WARN`; automatic
108
+ [eval preflight](eval-case-preflight.md) separately classifies unmeasured evidence
109
+ as `UNKNOWN`. The version 1 JSON shape and status vocabulary are unchanged.
110
+
104
111
  ## Exit status and acceptance
105
112
 
106
113
  - **0:** validation completed without failed gates; warnings may still exist.
@@ -0,0 +1,110 @@
1
+ # Offline case gates before evaluation
2
+
3
+ This behavior is included in 0.10.1. The immutable npm 0.10.0 archive predates it.
4
+ See the [release record](releases/0.10.1.md) for publication status.
5
+
6
+ Every live `eval` runs the existing offline `bench check` probes before creating
7
+ the native run directory or dispatching its first agent/judge call. This covers
8
+ inject, installed Skill revisions, rules/MCP configuration experiments, trigger
9
+ mode and JSON requests. There is no force/skip flag. Invalid plans, exhausted
10
+ call ceilings and existing run groups are rejected before probing.
11
+
12
+ Only the selected tasks are probed. Trigger mode further limits probes to tasks
13
+ with a `shouldTrigger` label, matching the actual dispatch population. The full
14
+ bench must still load, and its full content hash stays pinned. A broken verifier
15
+ on a structurally valid, unselected task does not block a selected task.
16
+
17
+ ## What blocks execution
18
+
19
+ The gate reuses `bench check` diagnostics and disposable copies:
20
+
21
+ - Command task: the untouched fixture must fail its verifier.
22
+ - Output task: missing and empty `_output.md` must be rejected.
23
+ - Registered oracle: its command must succeed and the repaired fixture must pass
24
+ the verifier with every reported named check passing.
25
+ - Verifier/oracle processes without an exit verdict, malformed mock markers and
26
+ other incomplete local checks fail closed. An ordinary mock output that fails
27
+ a functioning verifier is informational, since it can represent a negative
28
+ example; a crashed/timed-out mock probe is a hard failure.
29
+ - Bench, candidate and baseline fingerprints must remain equal to the preview's
30
+ inputs after all probes. Changes or unreadable inputs block execution.
31
+
32
+ On any `FAIL`, zero agent/judge calls are dispatched and no run directory or
33
+ quality verdict is created. Human output includes gate codes, reasons and
34
+ remedies. Request JSON returns `kind: "skillfit.eval-error"`,
35
+ `error.code: "CASE_PREFLIGHT_FAILED"`, `casePreflight.status: "blocked"` and all
36
+ diagnostics; exit code is 2. Keep that JSON if the failed check needs archiving.
37
+
38
+ ## Warning, unknown and not applicable
39
+
40
+ `casePreflight.checks` uses these statuses:
41
+
42
+ | Status | Meaning | Blocks calls? |
43
+ | --- | --- | --- |
44
+ | `FAIL` | A required gate failed or could not finish | Yes |
45
+ | `WARN` | Observed concern: large fixture, facet-count bounds, weak/missing negative controls | No |
46
+ | `UNKNOWN` | Evidence was not obtained: no oracle, absent output mock coverage, omitted mock arm, live difficulty not measured | No |
47
+ | `INFO` | Context or inapplicable check, such as text mock probes for file-edit tasks | No |
48
+ | `PASS` | This particular offline gate passed | No |
49
+
50
+ `ORACLE` without a reference repair is `UNKNOWN` here; standalone `bench check`
51
+ keeps its version 1 `WARN` contract. `MOCK_COVERAGE` for command tasks is `INFO`
52
+ because text mock answers do not implement file edits. A `LIVE_DIFFICULTY`
53
+ unknown is always present: offline probes neither calibrate a live agent nor
54
+ establish Skill benefit or generalization. Missing optional facets do not become
55
+ a fabricated graded signal. A nonzero untouched-fixture exit alone does not
56
+ prove the intended defect caused the failure; review it and supply an independent
57
+ oracle. Checks execute trusted local bench code, not a sandbox for untrusted code.
58
+
59
+ `status: "ready"` means zero hard failures in this offline scope. Warnings and
60
+ unknowns remain explicit in `summary`; ready does not authorize adoption. The
61
+ existing statistical, complete-cost and independence requirements stay unchanged,
62
+ and `automaticUpgrade` remains false. This gate makes no calibration or repair
63
+ calls and does not retry, add tasks or expand the declared budget.
64
+
65
+ ## Preview, records and cost
66
+
67
+ `--dry-run` never executes verifiers/oracles or creates run files. Its machine
68
+ plan declares `casePreflight: {schemaVersion: 1, scope: "offline-case-integrity",
69
+ required: true, status: "pending"}`. A preview is not a passed case check. JSON
70
+ requests still require the matching preview hash before probes start; observed
71
+ probe output and elapsed time do not enter that hash, so harmless timing changes
72
+ cannot invalidate the approved plan.
73
+
74
+ After a successful gate, `_plan.json.details.casePreflight` freezes the complete
75
+ report before dispatch: selected IDs, full bench fingerprint, individual gate
76
+ codes/statuses, locations, remedies and bounded process evidence. The native
77
+ artifact index covers that plan. JSON assessment returns `casePreflight`, including
78
+ for stopped runs; incomplete/stopped evidence remains subject to the enclosing
79
+ `evidence.verified` field. A missing historical report is `null`, never an implied
80
+ pass. Offline reporting and portable replay preserve the original preflight;
81
+ they do not rerun it against current inputs or change historical records.
82
+
83
+ `casePreflight.cost` records **0 model calls** and observed offline wall time in
84
+ `durationMs`. This time includes local probes and fingerprint verification. It is
85
+ separate from primary-agent call durations, token totals and spending stop lines;
86
+ it is not a CPU, toolchain or dollar bill. Agent/judge budgets and all existing
87
+ cost coverage rules remain unchanged.
88
+
89
+ Ctrl+C/SIGTERM during probing terminates managed verifier/oracle process trees,
90
+ dispatches no agent and exits 130/143. Because the run has not started, no stopped
91
+ run directory is synthesized. Once dispatch preparation has created a native run,
92
+ the normal [interruption and retained-record contract](evaluation-interruption.md)
93
+ applies.
94
+
95
+ ## Reproduce offline
96
+
97
+ ```bash
98
+ npm test
99
+ node --test dist/commands/eval-preflight.test.js dist/commands/eval-interruption.test.js dist/commands/eval-export.test.js
100
+ ```
101
+
102
+ The tests use mock executors and local fake processes. They cover all delivery
103
+ modes, zero-call hard stops, separate warnings/unknowns, selected/trigger scope,
104
+ missing/empty outputs, oracle failures, process failure, malformed/partial mock
105
+ coverage, input mutation, unchanged previews, request JSON, interruption, and
106
+ portable retention. No real agent CLI or model API is called.
107
+
108
+ Machine contracts: [preflight schema](schemas/eval-preflight.schema.json),
109
+ [evaluation result schema](schemas/eval-result.schema.json),
110
+ [standalone bench-check JSON](bench-check-json.md).
@@ -11,6 +11,23 @@ Build the bench around the task being evaluated, with deterministic acceptance
11
11
  checks and an independent reference repair. Bundled and contributed benches are
12
12
  examples, not a universal test of every Skill. See the [authoring guide](bench-authoring.md).
13
13
 
14
+ In 0.10.1, execution requires an automatic offline
15
+ [case preflight](eval-case-preflight.md) after preview-hash confirmation and before
16
+ any agent/judge call. `plan.evaluation.casePreflight.status` is `pending`; preview
17
+ executes no verifier/oracle. Hard failures return `CASE_PREFLIGHT_FAILED` and a
18
+ structured `casePreflight` report with zero calls and no native run directory.
19
+ Warnings and unknowns remain separate and nonblocking. Successful probes are
20
+ frozen in the native plan and included in JSON assessment/replay; they do not
21
+ authorize adoption or alter statistical/cost requirements.
22
+
23
+ The same source build [seals original inputs](evaluation-input-snapshots.md)
24
+ before dispatch. Preview declares `plan.evaluation.inputSnapshot.status: "pending"`;
25
+ completed/stopped JSON assessment includes `inputSnapshot` with the plan-bound
26
+ index hash and local copy/storage cost. Native replay/export use sealed inputs
27
+ after originals change or disappear; a damaged archive cannot be overridden.
28
+ Historical runs return null and retain matching-root recovery. Snapshot copies
29
+ make zero model calls and do not change acceptance or incomplete-cost semantics.
30
+
14
31
  The [maintained evidence index](skill-evaluation-evidence.md) links all development
15
32
  and independent cohorts, their exact costs and offline replay packages. As of
16
33
  October 15, the debugging study totals 195 actual calls with seven historical
@@ -284,6 +301,17 @@ and retain/share an external copy of evidence hashes for provenance.
284
301
 
285
302
  ## Offline assessment and replay
286
303
 
304
+ Version 0.10.1 seals Ctrl+C/SIGTERM interruptions with available trial
305
+ receipts, `_interruption.json`, stopped `_session.json` and `_artifacts.json`.
306
+ Request execution preserves exit 130/143 and returns a stopped assessment after
307
+ sealing. Partial/unknown costs stay incomplete and ineligible; no automatic retry
308
+ or replacement occurs. See [the interruption contract](evaluation-interruption.md).
309
+ The npm 0.10.0 archive predates this fix.
310
+
311
+ Markdown and JSON accept the same manifest/run/package inputs and assessment
312
+ options in 0.10.1. Markdown also displays stopped/incomplete spending and the
313
+ separate acceptance decision. See [report inputs and states](evaluation-reports.md).
314
+
287
315
  ```bash
288
316
  node dist/cli.js report eval ./runs/revision-validation-001 --json
289
317
  node dist/cli.js report eval ./runs/revision-validation-001 --json --replay
@@ -45,6 +45,15 @@ is recorded as zero. Other executors can supply cache counts through the same
45
45
  optional `TokenUsage.cachedInput` field. Existing surfaces without such counts
46
46
  continue to report unknown cache coverage.
47
47
 
48
+ In 0.10.1, the Chat Completions API executor reads
49
+ `usage.prompt_tokens_details.cached_tokens` into `TokenUsage.cachedInput`, as
50
+ documented by the [official OpenAI API reference](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create).
51
+ It requires a nonnegative safe integer no greater than a valid input total.
52
+ An explicit zero is preserved; missing, malformed, fractional, negative or
53
+ incompatible cache counts remain unknown. Input already includes cached tokens;
54
+ uncached input is still computed by subtraction, with no double counting.
55
+ This fixes new receipts only; historical unknown cache usage is not backfilled.
56
+
48
57
  Each measure contains `knownTotal` and coverage counts `final`, `partial` and
49
58
  `unknown`, which sum to its population's run count. A successful stream with
50
59
  missing input/output usage on a completed turn retains available increments as
@@ -0,0 +1,124 @@
1
+ # Sealed evaluation inputs
2
+
3
+ This feature is included in 0.10.1; see its [release record](releases/0.10.1.md)
4
+ for publication status. Existing npm archives and historical evidence are unchanged.
5
+
6
+ New evaluation sessions copy and verify their inputs **before the first agent
7
+ or judge dispatch**. Editing, moving or deleting the original Skill or bench
8
+ afterward no longer prevents export or offline replay. This is a local evidence
9
+ archive; it makes zero model calls and does not rerun an evaluation.
10
+
11
+ ## When sealing happens
12
+
13
+ Live `eval` validates its declaration and runs [offline case gates](eval-case-preflight.md)
14
+ first. Its native session then exclusively claims a fresh output directory,
15
+ copies inputs, verifies their fingerprints and writes the frozen plan last.
16
+ A failed copy, changed source or inconsistent bench stops before dispatch and
17
+ removes only that session's newly claimed output. Existing outputs and sibling
18
+ runs are preserved. No partial snapshot is advertised as a completed run.
19
+
20
+ Preview remains read-only. In request JSON,
21
+ `plan.evaluation.inputSnapshot` is `{schemaVersion: 1, required: true,
22
+ status: "pending"}`; no input archive exists yet. Its policy is part of the
23
+ approved plan, while actual copy time is recorded only after execution starts.
24
+
25
+ Sealing also applies to sessions used by trigger mode and baseline calibration.
26
+ Their existing paired-export restrictions are unchanged. A separate global
27
+ configuration installation is never performed by this feature.
28
+
29
+ ## What is saved
30
+
31
+ | Native path | Contents |
32
+ | --- | --- |
33
+ | `_inputs/bench/` | Full pinned bench, including prompts, fixtures, verifiers, reference repairs and unselected tasks |
34
+ | `_inputs/target/` | Complete pinned target Skill or configuration experiment directory |
35
+ | `_inputs/baseline-skill/` | Previous complete Skill revision, when present |
36
+ | `_inputs/implementation/` | Compiled implementation used by the run |
37
+ | `_inputs/request.json` | Exact component request bytes, when present |
38
+ | `_inputs.json` | Version 1 snapshot inventory, fingerprints and directory/executable-file metadata |
39
+
40
+ The manifest identifies selected tasks as before; archiving the full bench keeps
41
+ its original content hash and all referenced files available. Empty directories
42
+ are retained. Executable permission bits are preserved on systems that support
43
+ them and checked on POSIX. Git metadata and the current run output are excluded;
44
+ symbolic links and unsupported file types are rejected. The archived bench must
45
+ load with the declared content hash before calls start. Keep Git metadata and
46
+ run outputs out of the task's input tree rather than relying on unrecorded files.
47
+
48
+ Only the listed project inputs are copied. Global configuration and globally
49
+ installed Skills keep their existing fingerprints/guards; their private contents
50
+ are not archived. External tools, installed dependencies outside these inputs,
51
+ credentials, operating-system state and server-side model identities are not
52
+ captured. Replay still needs Node.js 22+ and the verifier's external toolchains.
53
+
54
+ ## Integrity and runtime behavior
55
+
56
+ `_plan.json.inputSnapshot` binds `_inputs.json` by SHA-256. Every indexed copy is
57
+ checked against the pre-copy fingerprint and exact file/directory inventory.
58
+ The final `_artifacts.json` also covers snapshot files. The normal session checks
59
+ both original input drift and archive integrity between calls. Editing the
60
+ originals during a live evaluation still stops further dispatches; this feature
61
+ does not make a changing cohort valid. The saved snapshots retain the initially
62
+ declared inputs for inspecting or exporting that stopped run.
63
+
64
+ A missing, changed, linked or incomplete declared snapshot fails closed. Neither
65
+ matching current originals nor `--input-root` overrides bypass a damaged archive.
66
+ An updated outer artifact index cannot hide a change that disagrees with the
67
+ plan-bound snapshot inventory. Hashes establish byte consistency, not independent
68
+ publisher authentication; retain a trusted copy of evidence hashes for provenance.
69
+
70
+ JSON assessment returns `inputSnapshot` with its descriptor and cost. Historical
71
+ runs return `null`, not a fabricated archive. Stopped/incomplete reports retain
72
+ their existing `evidence.verified: false` semantics; a snapshot alone never makes
73
+ them completed, improves their cost coverage or authorizes adoption.
74
+
75
+ ## Export and replay after the originals change
76
+
77
+ ```bash
78
+ skillfit report eval ./runs/my-run --json --replay
79
+ skillfit report eval ./runs/my-run --export ./exports/my-run --json
80
+ skillfit report eval ./runs/my-run --export ./exports/my-run --yes --json
81
+ node ./exports/my-run/reproduce.mjs
82
+ ```
83
+
84
+ Native replay defaults to the sealed bench. Portable export defaults to sealed
85
+ inputs and the sealed implementation/request, so it works after original files
86
+ change or disappear. The native run directory itself can also be moved before
87
+ export. Explicit recovery roots still require exactly matching fingerprints;
88
+ the snapshot is validated first. Existing/nested export destinations remain
89
+ forbidden, and previews still write nothing.
90
+
91
+ Runs without `inputSnapshot` use the original matching-root recovery contract
92
+ described in [replay packages](replay-packages.md). New software does not rewrite
93
+ old plans, synthesize missing historical inputs or repair damaged evidence by
94
+ substituting newer files. Historical published evidence remains append-only.
95
+
96
+ ## Local overhead and privacy
97
+
98
+ `inputSnapshot.cost` records `modelCalls: 0`, observed `durationMs`, `files` and
99
+ `bytes`. Counts include the input payload and `_inputs.json`; bytes are apparent
100
+ file sizes, not filesystem allocation. Elapsed time covers snapshot copying and
101
+ verification, not later per-call guards or an external toolchain bill. Sealing
102
+ and integrity checks add local I/O and storage without changing primary-agent
103
+ token totals, call budgets, duration populations or statistical/adoption rules.
104
+ Per-call archive checks run within the existing trial timer where applicable;
105
+ `inputSnapshot.cost.durationMs` is only the one-time sealing interval.
106
+
107
+ Portable export preserves the unchanged native archive and also supplies the
108
+ portable input/runtime layout; it therefore contains additional copies. Its
109
+ existing byte/file preview includes those source copies. No automatic pruning
110
+ or redaction removes evidence. Snapshots can include repository data, reference
111
+ answers and private target resources: review the run/package before sharing.
112
+
113
+ ## Offline regression checks
114
+
115
+ ```bash
116
+ npm test
117
+ node --test dist/commands/eval-export.test.js dist/harness/experiment-session.test.js dist/harness/eval-component.test.js
118
+ ```
119
+
120
+ Tests use mock executors and local files. They cover archive presence before
121
+ dispatch, zero-call failure cleanup, source/archive drift, complete Skill/request
122
+ retention, changed/deleted originals, moved runs, stopped costs, portable replay,
123
+ legacy recovery, empty fixtures, executable files and corrupted/linked snapshots.
124
+ No real model API or agent CLI is called.
@@ -0,0 +1,89 @@
1
+ # Interrupt and retain an evaluation
2
+
3
+ This fix is included in 0.10.1; see the [release record](releases/0.10.1.md)
4
+ for publication status. The immutable npm 0.10.0 archive does not include it. It changes interruption
5
+ handling, not the statistical or adoption protocol.
6
+
7
+ ## Stop a live run
8
+
9
+ Press **Ctrl+C** once during a live evaluation. The same path handles `SIGTERM`.
10
+ It covers paired inject/installed evaluations, JSON request execution, trigger
11
+ evaluations and live `bench check --calibrate`. It also stops an active harness
12
+ verifier or judge. Previews and read-only reports install no interrupt handlers.
13
+
14
+ The source also cancels [offline case preflight](eval-case-preflight.md) before
15
+ dispatch. Its verifier/oracle trees stop with exit 130/143 and zero model calls;
16
+ because a native run has not started, no stopped run directory is synthesized.
17
+ Once a run directory exists, the retained-evidence contract below applies.
18
+
19
+ The runner stops subsequent dispatches, terminates managed CLI/process trees
20
+ and waits for output to close. POSIX uses the process group; Windows uses
21
+ `taskkill /T`. Pipe draining is bounded when a descendant retains a pipe. HTTP
22
+ executors abort their local request. The process then seals retained records and
23
+ exits **130 for SIGINT** or **143 for SIGTERM**, including request-based JSON
24
+ execution. Diagnostics go to stderr; JSON stdout remains one document.
25
+
26
+ Repeated signals during cleanup keep the first interruption and do not bypass
27
+ sealing. There is no automatic retry, replacement, partner invocation or expansion.
28
+ Wait for the command to finish rather than treating the first signal as an
29
+ immediate process exit. After sealing, signal handlers and cancellation context
30
+ are removed so later operations do not inherit a cancelled run.
31
+
32
+ ## Retained evidence
33
+
34
+ The native run directory keeps:
35
+
36
+ - `_plan.json` and `_calls.jsonl`: original declaration and actual dispatch events.
37
+ - In new source runs, `_inputs.json` and `_inputs/`: sealed inputs available even
38
+ if original Skill/bench/request paths later change or disappear.
39
+ - Existing per-trial output, transcripts and `_result.json`: settled final usage
40
+ stays final; recovered counters from an interrupted call stay partial; missing
41
+ usage stays unknown. Interruption is an execution error, not a graded failure.
42
+ - `_interruption.json`: version 1 signal name, receipt time, exit code and
43
+ `automaticRetry: false`.
44
+ - `_session.json`: stopped status, call counts and stop reason.
45
+ - `_artifacts.json`: inventory and hashes of retained files, including interruption
46
+ metadata. A stopped prefix does not acquire a completed efficacy verdict.
47
+
48
+ An interrupted judge additionally keeps `_interrupted-judge-<call>.json` with its
49
+ available output/usage or null when unavailable. Separate judge spending remains
50
+ outside the primary-agent cost totals; this record does not make that bill complete.
51
+ Trigger receipts retain interrupted output/tokens with partial/unknown status;
52
+ the existing paired JSON assessment/export contract is not extended to trigger
53
+ or judge runs by this fix.
54
+
55
+ Inspect a paired stopped run without another agent call:
56
+
57
+ ```bash
58
+ node dist/cli.js report eval ./runs/my-run --json
59
+ node dist/cli.js report eval ./runs/my-run --export ./exports/my-run --json
60
+ ```
61
+
62
+ Export uses [sealed inputs](evaluation-input-snapshots.md) for new source runs;
63
+ older runs still require matching recovered inputs. A fresh destination is required. A completed
64
+ export replays the same stopped status and cost coverage; it cannot authorize an
65
+ upgrade. Preserve this run, fix the cause and make a fresh bounded declaration if
66
+ further spending is authorized. Unused slots are not permission to continue.
67
+
68
+ Local cancellation cannot guarantee that a provider stops work already accepted
69
+ on its servers. Usage unavailable after HTTP cancellation remains unknown.
70
+ `SIGKILL`, power loss and storage failures can prevent sealing; a directory without
71
+ final session/index files remains incomplete. Built-in executors and managed local
72
+ processes participate in cancellation; unrelated services are outside that control.
73
+
74
+ ## Offline regression checks
75
+
76
+ ```bash
77
+ npm test
78
+ node --test dist/commands/eval-interruption.test.js dist/harness/interruption.test.js
79
+ ```
80
+
81
+ The tests inject fake Node CLI/process trees and a fake fetch implementation. They
82
+ check interrupted primary/verifier/judge work, trigger/calibration/request execution,
83
+ repeated signals, between-call interruption, partial and unknown costs, sealed
84
+ inventories, stopped-package replay, exit codes and handler/context cleanup.
85
+ POSIX integration tests deliver real OS signals to the harness. Windows tests emit
86
+ the corresponding Node signal event through an isolated harness because Node's
87
+ `child.kill('SIGINT')` forcibly terminates a Windows process; real Windows
88
+ `taskkill /T` still terminates the fake CLI and its descendant. These tests do not
89
+ establish physical-console event delivery or call any real model or agent CLI.