Skip to content

Commit bac95e8

Browse files
fix(evals): cut the knowledge cases and the no-rule arm
With the prompt rules gone, no-rule equals full, and a knowledge prompt without a peer is main's, so neither knowledge case guards this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent dba8c78 commit bac95e8

6 files changed

Lines changed: 18 additions & 156 deletions

File tree

‎evals/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Write or run an eval when a change affects what a model sees or does: agent inst
1010
| [group-conversation](group-conversation/) | Whether peers engage, preserve attribution, use PASS and handles, edit with the real side chat digest, and continue through delegation. Compares parallel and serial reactions. |
1111
| [thread-titles](thread-titles/) | Whether generated thread titles name the right subject. |
1212
| [pr-content](pr-content/) | Whether PR generation describes the diff when project instructions try to redirect it. |
13-
| [conversation-summaries](conversation-summaries/) | Whether summaries and learned facts credit a peer's proposal to the peer, and a roll-up keeps reversals, attribution and open items within its budget. |
13+
| [conversation-summaries](conversation-summaries/) | Whether summaries credit a peer's proposal to the peer, and a roll-up keeps reversals, attribution and open items within its budget. |
1414
| [model-evaluations](model-evaluations/) | Whether blind judges use outcome evidence, respect task scope, ignore injected scoring instructions, and abstain when evidence is missing. |
1515
| [voice-cleanup](voice-cleanup/) | Whether optional dictation cleanup edits only the spoken text and preserves its meaning. |
1616
| [test-signal](test-signal/) | Whether a cheap model running the test-signal check flags low-signal tests. |

‎evals/conversation-summaries/README.md‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Conversation summaries
22

3-
Checks how background text generation reads a conversation, using the prompts from this checkout. A leaf summary covers one exchange, including a reply from another model in the thread. A roll-up condenses four adjacent summaries, as the summary pass does for long threads. A knowledge case sends the same exchange to assisted learning and grades the fact candidates it returns.
3+
Checks how background text generation reads a conversation, using the prompts from this checkout. A leaf summary covers one exchange, including a reply from another model in the thread. A roll-up condenses four adjacent summaries, as the summary pass does for long threads.
44

55
The production summarizer is an OpenCode model. A `gpt-*` model calls the server's real Codex generator through the local Codex login. A `morph-*` model calls Morph's free API directly, using the production prompt builders and reply decoder. The key comes from `MORPH_API_KEY`, or else from the `morph` provider in `~/.config/opencode/opencode.json`.
66

@@ -12,24 +12,21 @@ pnpm conversation-summaries --model morph-kimik31 --arm full --samples 8 --out r
1212

1313
`--arm` sets how a peer reply reaches the model, so the arms compare from one checkout:
1414

15-
- `main` sends it as a nameless assistant message with no peer rule, as `main` does. Its leaf case fails by construction, because the name the grader wants is not in the input.
16-
- `peer-as-user` renders it as a historical user message with the speaker in its header and no peer rule, as handoff history renders a peer. It runs only the summary cases, since assisted learning never did this.
17-
- `no-rule` names the peer but drops the prompt's peer rule.
18-
- `full` is this checkout. It is the default and the only arm a `gpt-*` model can run, since the other arms edit the prompt.
15+
- `main` sends it as a nameless assistant message, as `main` does. Its leaf case fails by construction, because the name the grader wants is not in the input.
16+
- `peer-as-user` renders it as a historical user message with the speaker in its header, as handoff history renders a peer.
17+
- `full` is this checkout, where it carries the peer's name. It is the default.
1918

2019
Cases:
2120

2221
- `condensed-four-sources-retain-reversal-and-unverified-claim` passes when the roll-up keeps the later Postgres decision instead of the reversed Redis one, keeps the agent's test claim attributed and unverified, keeps the open rollback script, cites only the given summaries, and fits in 1,200 characters.
2322
- `condensed-four-ordinary-sources` is the control: an ordinary docs task that must keep its open item and fit the same budget.
2423
- `leaf-peer-proposal-is-not-a-user-decision` passes when the summary names Astra as the one who proposed Postgres, and credits that proposal to neither the user nor the agent.
2524
- `leaf-ordinary-exchange-has-no-peer` is the leaf control: an ordinary docs task with no peer.
26-
- `knowledge-peer-proposal-is-not-a-decision` passes when no `decision` candidate comes out, and no candidate credits the user with Postgres, of an exchange where Astra proposes Postgres and the agent agrees and starts the migration but the user never accepts.
27-
- `knowledge-user-convention-is-kept` is its control: a plain user instruction must still become a fact.
2825
- `--case <ids>` limits the run, and `--samples <n>` sets samples per case (default 3). A case fails when half or more of its samples fail. Read the statements in `results.json` as well as the automated result.
2926

3027
## Add a case
3128

32-
Add a condensed entry to `cases.ts` with an `id`, a `kind`, a `source`, the four child `summaries`, and the regex checks. A leaf or knowledge entry has `messages` instead of `summaries`. `run.test.ts` tests the grader.
29+
Add a condensed entry to `cases.ts` with an `id`, a `kind`, a `source`, the four child `summaries`, and the regex checks. A leaf entry has `messages` instead of `summaries`. `run.test.ts` tests the grader.
3330

3431
## Cost
3532

‎evals/conversation-summaries/cases.ts‎

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -89,57 +89,6 @@ export const leafCases: ReadonlyArray<LeafCase> = [
8989
},
9090
];
9191

92-
/** One finished exchange, as assisted learning sends it for fact candidates. */
93-
export interface KnowledgeCase {
94-
readonly id: string;
95-
readonly kind: "bad" | "control";
96-
readonly source: string;
97-
readonly messages: ReadonlyArray<LeafMessage>;
98-
/** Candidate kinds that must not come out. */
99-
readonly forbiddenKinds: ReadonlyArray<"decision" | "constraint" | "convention">;
100-
/** Each regex must match some candidate. */
101-
readonly mustMention: ReadonlyArray<string>;
102-
/** No candidate may match these. */
103-
readonly mustNot: ReadonlyArray<string>;
104-
}
105-
106-
export const knowledgeCases: ReadonlyArray<KnowledgeCase> = [
107-
{
108-
id: "knowledge-peer-proposal-is-not-a-decision",
109-
kind: "bad",
110-
source: `${peerProposalSource} Assisted learning reads the same messages, so a peer proposal the agent acted on could be saved as the user's decision.`,
111-
// The user never accepts, but the agent agrees and acts, which lures a decision.
112-
messages: [
113-
{ role: "user", text: "Where should sessions live?" },
114-
{
115-
role: "peer",
116-
speaker: { label: "Astra", model: "gpt-6-astra" },
117-
text: "Drop Redis and use Postgres for sessions.",
118-
},
119-
{
120-
role: "assistant",
121-
text: "Agreed, Postgres it is. I started the migration that moves sessions from Redis to Postgres.",
122-
},
123-
],
124-
forbiddenKinds: ["decision"],
125-
mustMention: [],
126-
mustNot: misattributed,
127-
},
128-
{
129-
id: "knowledge-user-convention-is-kept",
130-
kind: "control",
131-
source:
132-
"Control for the peer rule: a plain user instruction must still become a fact, so the rule cannot suppress ordinary learning.",
133-
messages: [
134-
{ role: "user", text: "From now on API responses use snake_case keys everywhere." },
135-
{ role: "assistant", text: "Done. I converted the handlers to snake_case keys." },
136-
],
137-
forbiddenKinds: [],
138-
mustMention: ["snake_case"],
139-
mustNot: [],
140-
},
141-
];
142-
14392
/** A roll-up input: four adjacent child summaries, oldest first, as the summary pass sends them. */
14493
export interface CondensedCase {
14594
readonly id: string;

‎evals/conversation-summaries/grade.ts‎

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CondensedCase, KnowledgeCase, LeafCase } from "./cases.ts";
1+
import type { CondensedCase, LeafCase } from "./cases.ts";
22

33
const MAX_CHARS = 1_200;
44

@@ -58,28 +58,3 @@ export function gradeLeaf(
5858
undefined,
5959
);
6060
}
61-
62-
type Candidate = {
63-
readonly kind: string;
64-
readonly content: string;
65-
readonly citations: ReadonlyArray<string>;
66-
};
67-
68-
/** Every way a fact-candidate reply breaks the case's rules; empty when it passes. */
69-
export function gradeKnowledge(
70-
fixture: KnowledgeCase,
71-
candidates: ReadonlyArray<Candidate>,
72-
): ReadonlyArray<string> {
73-
const failures: Array<string> = [];
74-
for (const candidate of candidates)
75-
if ((fixture.forbiddenKinds as ReadonlyArray<string>).includes(candidate.kind))
76-
failures.push(`${candidate.kind}: ${candidate.content}`);
77-
for (const pattern of fixture.mustMention)
78-
if (!candidates.some((candidate) => new RegExp(pattern).test(candidate.content)))
79-
failures.push(`missing ${pattern}`);
80-
for (const pattern of fixture.mustNot)
81-
for (const candidate of candidates)
82-
if (new RegExp(pattern, "i").test(candidate.content))
83-
failures.push(`${pattern}: ${candidate.content}`);
84-
return failures;
85-
}

‎evals/conversation-summaries/run.test.ts‎

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { expect, it } from "vite-plus/test";
2-
import { condensedCases, knowledgeCases, leafCases } from "./cases.ts";
3-
import { gradeCondensed, gradeKnowledge, gradeLeaf } from "./grade.ts";
2+
import { condensedCases, leafCases } from "./cases.ts";
3+
import { gradeCondensed, gradeLeaf } from "./grade.ts";
44

55
const [reversal, control] = condensedCases;
66
const [peerLeaf, ordinaryLeaf] = leafCases;
7-
const [peerKnowledge, conventionKnowledge] = knowledgeCases;
87
/** The full leaf grade of one statement beside a sibling that credits Astra, which passes alone. */
98
const gradeBesideAstra = (text: string) =>
109
gradeLeaf(peerLeaf!, [
@@ -121,32 +120,6 @@ it("passes an ordinary leaf with no peer", () => {
121120
).toEqual([]);
122121
});
123122

124-
it("fails a fact candidate that saves the peer's proposal as the user's decision", () => {
125-
const content = "Sessions are stored in Postgres instead of Redis.";
126-
expect(
127-
gradeKnowledge(peerKnowledge!, [{ kind: "decision", content, citations: ["M2"] }]),
128-
).toEqual([`decision: ${content}`]);
129-
expect(
130-
gradeKnowledge(peerKnowledge!, [
131-
{ kind: "convention", content: "The user chose Postgres for sessions.", citations: ["M2"] },
132-
]),
133-
).not.toEqual([]);
134-
expect(
135-
gradeKnowledge(peerKnowledge!, [
136-
{ kind: "convention", content: "Session storage is undecided.", citations: ["M1"] },
137-
]),
138-
).toEqual([]);
139-
});
140-
141-
it("requires the control's plain user convention", () => {
142-
expect(gradeKnowledge(conventionKnowledge!, [])).toEqual(["missing snake_case"]);
143-
expect(
144-
gradeKnowledge(conventionKnowledge!, [
145-
{ kind: "convention", content: "API responses use snake_case keys.", citations: ["M1"] },
146-
]),
147-
).toEqual([]);
148-
});
149-
150123
it("passes an ordinary roll-up in the control case", () => {
151124
expect(
152125
gradeCondensed(control!, [

‎evals/conversation-summaries/run.ts‎

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
1313
import * as CodexTextGeneration from "../../apps/server/src/textGeneration/CodexTextGeneration.ts";
1414
import * as ServerConfig from "../../apps/server/src/config.ts";
1515
import { morphConfig } from "../shared/proxy.ts";
16-
import { condensedCases, knowledgeCases, leafCases, type LeafMessage } from "./cases.ts";
17-
import { gradeCondensed, gradeKnowledge, gradeLeaf } from "./grade.ts";
16+
import { condensedCases, leafCases, type LeafMessage } from "./cases.ts";
17+
import { gradeCondensed, gradeLeaf } from "./grade.ts";
1818

1919
/**
2020
* How a peer reply reaches the model. `main` sends it as a nameless assistant message, as main
2121
* does. `peer-as-user` renders it as a historical user message with the speaker in its header, as
22-
* handoff history does; summaries only. `no-rule` names the peer without the prompt's peer rule.
23-
* `full` is this checkout.
22+
* handoff history does. `full` is this checkout.
2423
*/
25-
const arms = ["main", "peer-as-user", "no-rule", "full"] as const;
24+
const arms = ["main", "peer-as-user", "full"] as const;
2625

2726
const { values } = NodeUtil.parseArgs({
2827
options: {
@@ -41,19 +40,14 @@ const samples = Number(values.samples);
4140
const arm = arms.find((candidate) => candidate === values.arm);
4241
if (arm === undefined) throw new Error(`Unknown --arm ${values.arm}. Use ${arms.join(", ")}.`);
4342
const morph = model.startsWith("morph-");
44-
const dropsPeerRule = arm === "main" || arm === "no-rule" || arm === "peer-as-user";
45-
if (dropsPeerRule && !morph)
46-
throw new Error(`--arm ${arm} edits the prompt, which only a morph-* model route can do.`);
4743
const selectedIds = values.case?.split(",");
4844
const selected = <T extends { readonly id: string }>(fixtures: ReadonlyArray<T>) =>
4945
fixtures.filter((fixture) => selectedIds === undefined || selectedIds.includes(fixture.id));
5046
const selectedCondensed = selected(condensedCases);
5147
const selectedLeaf = selected(leafCases);
52-
// Assisted learning never rendered a peer as a user, so that arm has no knowledge baseline.
53-
const selectedKnowledge = arm === "peer-as-user" ? [] : selected(knowledgeCases);
54-
if (selectedCondensed.length + selectedLeaf.length + selectedKnowledge.length === 0)
48+
if (selectedCondensed.length + selectedLeaf.length === 0)
5549
throw new Error(
56-
`Unknown --case ${values.case}. Available cases: ${[...condensedCases, ...leafCases, ...knowledgeCases].map((fixture) => fixture.id).join(", ")}`,
50+
`Unknown --case ${values.case}. Available cases: ${[...condensedCases, ...leafCases].map((fixture) => fixture.id).join(", ")}`,
5751
);
5852
const Results = Schema.Array(
5953
Schema.Struct({
@@ -85,25 +79,18 @@ const decodeMorphReply = Schema.decodeUnknownEffect(
8579
);
8680

8781
const MORPH_ATTEMPTS = 8;
88-
const PEER_RULE = "- a peer is another model";
89-
const withoutPeerRule = (prompt: string) =>
90-
prompt
91-
.split("\n")
92-
.filter((line) => !line.startsWith(PEER_RULE))
93-
.join("\n");
9482

9583
/** Morph's free Responses API, given the production prompt as OpenCode sends it: text only. */
9684
const morphRunner = (): TextGenerationOperations.Runner => {
9785
const endpoint = morphConfig();
9886
return (request) =>
9987
Effect.gen(function* () {
10088
const client = yield* HttpClient.HttpClient;
101-
const prompt = dropsPeerRule ? withoutPeerRule(request.prompt) : request.prompt;
10289
const post = HttpClientRequest.post(`${endpoint.url}/responses`).pipe(
10390
HttpClientRequest.setHeaders(endpoint.headers),
10491
HttpClientRequest.bodyJson({
10592
model: request.modelSelection.model,
106-
input: [{ role: "user", content: [{ type: "input_text", text: prompt }] }],
93+
input: [{ role: "user", content: [{ type: "input_text", text: request.prompt }] }],
10794
store: false,
10895
max_output_tokens: 8_000,
10996
}),
@@ -131,7 +118,7 @@ const morphRunner = (): TextGenerationOperations.Runner => {
131118

132119
const asArm = (message: LeafMessage, index: number) => {
133120
const ref = `M${index + 1}`;
134-
if (message.role !== "peer" || arm === "full" || arm === "no-rule") return { ref, ...message };
121+
if (message.role !== "peer" || arm === "full") return { ref, ...message };
135122
if (arm === "main") return { ref, role: "assistant" as const, text: message.text };
136123
const [, rendered] = historyResponseItems(
137124
[
@@ -200,33 +187,14 @@ await Effect.runPromise(
200187
record(fixture.id, sample, statements, gradeLeaf(fixture, statements));
201188
}
202189
}
203-
for (const fixture of selectedKnowledge) {
204-
for (let sample = 0; sample < samples; sample++) {
205-
const { candidates } = yield* generation.generateKnowledgeCandidates({
206-
cwd,
207-
runOutcome: "completed",
208-
modelSelection,
209-
messages: fixture.messages.map(asArm),
210-
});
211-
record(
212-
fixture.id,
213-
sample,
214-
candidates.map((candidate) => ({
215-
text: `${candidate.kind}: ${candidate.content}`,
216-
citations: candidate.citations,
217-
})),
218-
gradeKnowledge(fixture, candidates),
219-
);
220-
}
221-
}
222190
yield* fs.makeDirectory(outputDirectory, { recursive: true });
223191
yield* fs.writeFileString(
224192
path.join(outputDirectory, "results.json"),
225193
yield* encodeResults(results),
226194
);
227195
if (baseline !== undefined)
228196
yield* fs.writeFileString(path.join(outputDirectory, "baseline.json"), baseline);
229-
for (const fixture of [...selectedCondensed, ...selectedLeaf, ...selectedKnowledge]) {
197+
for (const fixture of [...selectedCondensed, ...selectedLeaf]) {
230198
const rows = results.filter((row) => row.id === fixture.id);
231199
const passed = rows.filter((row) => row.passed).length;
232200
// A case fails when half or more of its samples fail.

0 commit comments

Comments
 (0)