Skip to content

Commit 98af7a3

Browse files
fix(evals): context-handoff cases share morphConfig with the other Morph evals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent c3678db commit 98af7a3

3 files changed

Lines changed: 32 additions & 12 deletions

File tree

‎evals/mcp-tool-use/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pnpm mcp-tool-use --model claude-opus-5-5 --out runs/opus
1414

1515
- `ANTHROPIC_API_KEY` in the repo root `.env` pays for Claude models and the Haiku shell simulator.
1616
- Codex models (`gpt-*` in `MODELS` in `run.ts`) go through a CLIProxyAPI server, set up as the `vibeproxy` model provider in `~/.codex/config.toml`. Keep the proxy under about 12 samples in flight across all runs.
17-
- `--model morph-kimik31 --shell-model morph-dsv41flash` runs both through Morph's Anthropic-compatible API with `MORPH_API_KEY` and never reads an Anthropic key. Morph limits uncached input tokens per minute, so pass `--concurrency 1`.
17+
- `--model morph-kimik31 --shell-model morph-dsv41flash` runs both through Morph's Anthropic-compatible API with `MORPH_API_KEY`, else the `morph` provider in OpenCode's config, and never reads an Anthropic key. Morph limits uncached input tokens per minute, so pass `--concurrency 1`.
1818
- `--shell-model` picks the model that plays the shell: `claude-haiku-5-5` by default, or `gpt-6.1-terra` / `gpt-6-luna` through the same proxy, so Codex runs need no Anthropic key. Prefer Terra: Luna often contradicts the case's world (it calls named checkouts missing or files empty). Compare runs only when they used the same shell model.
1919
- Flags: `--case <ids>`, `--cases <file.ndjson>`, `--samples <n>` (default 2, and a 3rd when the first 2 disagree), `--concurrency <n>` (samples in flight, default 8), `--max-steps <n>`, `--effort <level>`, `--dry-run` (prints request bodies, no model calls), and `--context` (prints the size of T3's text and schemas, no key needed).
2020
- `--baseline <results.jsonl> --stop-on-regression` stops as soon as a case that passed every baseline sample fails. Use it to test one copy change against a baseline run.

‎evals/mcp-tool-use/run.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import {
8080
CLAUDE_PROVIDER,
8181
makeClaudeQueryOptions,
8282
} from "../../apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts";
83-
import { morphProxyConfig, proxyConfig } from "../shared/proxy.ts";
83+
import { morphConfig, proxyConfig } from "../shared/proxy.ts";
8484
import { changeRequestsCreatedBy } from "../../apps/server/src/orchestration-v2/PullRequestSyncReactor.ts";
8585
import {
8686
decideGitHubArguments,
@@ -2778,7 +2778,7 @@ const main = Effect.gen(function* () {
27782778
apiKey,
27792779
model: flags.model,
27802780
...(morph
2781-
? { proxy: morphProxyConfig() }
2781+
? { proxy: morphConfig() }
27822782
: codex || !isPricedModel(flags["shell-model"])
27832783
? { proxy: proxyConfig() }
27842784
: {}),

‎evals/shared/proxy.ts‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,32 @@ print(json.dumps({'url': p['base_url'].rstrip('/'), 'headers': h}))
3232
),
3333
);
3434

35-
/** Morph's Anthropic-compatible API, so a run never reaches a paid provider API. */
36-
export const morphProxyConfig = () => {
37-
const key = process.env.MORPH_API_KEY;
38-
if (!key) throw new Error("Set MORPH_API_KEY to run on a Morph model.");
39-
return {
40-
url: "https://api.morphllm.com/v1",
41-
headers: { "x-api-key": key, Authorization: `Bearer ${key}` },
42-
};
43-
};
35+
/**
36+
* Morph's free OpenAI-compatible API, for evals that should not spend on paid models. The key is
37+
* `MORPH_API_KEY`, else the `morph` provider in OpenCode's config (`$XDG_CONFIG_HOME` or `~/.config`).
38+
*/
39+
export const morphConfig = () =>
40+
decodeProxyConfig(
41+
JSON.parse(
42+
NodeChildProcess.execFileSync(
43+
"python3",
44+
[
45+
"-c",
46+
`
47+
import json, os, pathlib
48+
key = os.environ.get('MORPH_API_KEY')
49+
url = os.environ.get('MORPH_BASE_URL', 'https://api.morphllm.com/v1')
50+
if not key:
51+
home = pathlib.Path(os.environ.get('XDG_CONFIG_HOME') or pathlib.Path.home() / '.config')
52+
# OpenCode writes literal control characters inside strings, which strict parsing rejects.
53+
settings = json.loads((home / 'opencode' / 'opencode.json').read_text(), strict=False)['providers']['morph']['settings']
54+
key, url = settings.get('apiKey'), settings.get('baseURL', url)
55+
if not key:
56+
raise SystemExit('no morph key')
57+
print(json.dumps({'url': url.rstrip('/'), 'headers': {'Authorization': 'Bearer ' + key}}))
58+
`,
59+
],
60+
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] },
61+
),
62+
),
63+
);

0 commit comments

Comments
 (0)