Skip to content

Commit f3d1fff

Browse files
committed
fix: keep sanitized reasoning optional
Do not coerce a missing manifest reasoning label to an empty string.
1 parent 3df4035 commit f3d1fff

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

packages/evals/__tests__/runner.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,23 @@ describe("hermetic eval replay", () => {
535535
}
536536
}),
537537
);
538+
539+
it.effect("accepts a sanitized report when reasoning is omitted from the manifest", () =>
540+
Effect.gen(function* () {
541+
const paths = yield* fixturePaths;
542+
const replay = yield* runHermeticEvalReplay({
543+
suitePath: paths.suite,
544+
observationsPath: paths.observations,
545+
});
546+
const { reasoning: _reasoning, ...manifest } = replay.manifest;
547+
const report = yield* makeSanitizedEvalRunReport({
548+
...replay,
549+
manifest,
550+
});
551+
552+
assert.isFalse(Object.hasOwn(report, "reasoning"));
553+
}),
554+
);
538555
it.effect("rejects sanitized reports with incomplete replay coverage", () =>
539556
Effect.gen(function* () {
540557
const paths = yield* fixturePaths;

packages/evals/src/report.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const SanitizedEvalRunReportSchema = Schema.Struct({
3333
candidate: SafeRunLabelSchema,
3434
target: SafeRunLabelSchema,
3535
model: SafeRunLabelSchema,
36-
reasoning: SafeRunLabelSchema,
36+
reasoning: Schema.optional(SafeRunLabelSchema),
3737
repetitions: PositiveIntSchema,
3838
startedAt: UtcTimestampSchema,
3939
cleanChat: Schema.Literal(true),
@@ -52,7 +52,7 @@ const SanitizedRunMetadataSchema = Schema.Struct({
5252
candidate: SafeRunLabelSchema,
5353
target: SafeRunLabelSchema,
5454
model: SafeRunLabelSchema,
55-
reasoning: SafeRunLabelSchema,
55+
reasoning: Schema.optional(SafeRunLabelSchema),
5656
accountClass: SafeRunLabelSchema,
5757
startedAt: UtcTimestampSchema,
5858
});
@@ -62,7 +62,7 @@ export const assertSanitizedRunMetadata = (labels: {
6262
readonly candidate: string;
6363
readonly target: string;
6464
readonly model: string;
65-
readonly reasoning: string;
65+
readonly reasoning?: string;
6666
readonly accountClass: string;
6767
readonly startedAt: string;
6868
}): Effect.Effect<void, SanitizedEvalRunReportError> =>
@@ -72,7 +72,7 @@ export const assertSanitizedRunMetadata = (labels: {
7272
labels.candidate,
7373
labels.target,
7474
labels.model,
75-
labels.reasoning,
75+
...(labels.reasoning === undefined ? [] : [labels.reasoning]),
7676
labels.accountClass,
7777
labels.startedAt,
7878
].flatMap((value) =>
@@ -157,9 +157,9 @@ export const makeSanitizedEvalRunReport = (
157157
candidate: source.manifest.candidate,
158158
target: source.manifest.target,
159159
model: source.manifest.model,
160-
reasoning: source.manifest.reasoning ?? "",
161160
accountClass: source.manifest.account_class,
162161
startedAt: source.manifest.started_at,
162+
...(source.manifest.reasoning === undefined ? {} : { reasoning: source.manifest.reasoning }),
163163
});
164164
const aggregate = yield* sanitizeEvalReplay(source);
165165
return yield* Schema.decodeUnknownEffect(SanitizedEvalRunReportSchema, {
@@ -169,14 +169,14 @@ export const makeSanitizedEvalRunReport = (
169169
schemaVersion: "v1",
170170
candidate: source.manifest.candidate,
171171
model: source.manifest.model,
172-
reasoning: source.manifest.reasoning,
173172
repetitions: source.manifest.repetitions,
174173
runId: source.manifest.run_id,
175174
target: source.manifest.target,
176175
startedAt: source.manifest.started_at,
177176
cleanChat: source.manifest.clean_chat,
178177
accountClass: source.manifest.account_class,
179178
aggregate,
179+
...(source.manifest.reasoning === undefined ? {} : { reasoning: source.manifest.reasoning }),
180180
}).pipe(
181181
Effect.mapError(
182182
() =>

0 commit comments

Comments
 (0)