Skip to content

Reproducible benchmark: native vs agent-code-mode on Claude Code and Codex - #4

Draft
mths-mcfs wants to merge 56 commits into
mainfrom
feat/bench
Draft

mths-mcfs wants to merge 56 commits into
mainfrom
feat/bench

Conversation

@mths-mcfs

@mths-mcfs mths-mcfs commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

bench/
├── run.ts              # npm run bench -- --host claude --arms A,B --tasks T1,T5 --runs 3 [--dry-run]
├── report.ts           # results/<date>/summary.json + summary.md (median, min–max)
├── fixture/generate.ts # seeded 96-file ES-module project, node --test, byte-identical per seed
├── tasks/T1..T8/       # verify.ts + solution/apply.ts (prompts and bug injection in tasks/index.ts)
├── hooks/protect-file.mjs  # example PreToolUse hook for T8 (works on both hosts)
├── lib/                # claude.ts, codex.ts (arm config + parsers), sanitize, pricing, workspace, proc
├── pricing.json        # Codex prices with date and source URL
└── parser-fixtures/    # sanitized real native T1 runs (both hosts) + canned dry-run transcripts
per round (seeded shuffle of host × task × arm)
  fresh workspace: fixture + task setup, git init + commit (fixed identity/date → same commit everywhere)
  claude: --setting-sources project, --settings, --strict-mcp-config, prompt on stdin
  codex:  temp CODEX_HOME = copied auth.json + config.toml (+ catalog, hooks.json), deleted in finally
  check tool surface (Claude init event / codex debug prompt-input), parse transcript, verify, cost
  write sanitized transcript, requests, configs, diff, then record.json (resume marker)
report → summary.json + Markdown table

Arms. Claude: A native, B agent-code-mode strict. Codex: A native (direct tools), B Codex code mode, C agent-code-mode strict (shell and apply_patch removed).

Evidence

  • npm run verify: 137 tests pass (52 new under bench/test/: fixture hash, each verifier fails untouched and passes on its reference solution, parsers on the real fixtures, sanitizer, report medians, plan, dry run end to end + resume, hook, process timeout).
  • npm run bench -- --dry-run: 120 runs, all pass, valid, summary printed (≈18 s).
  • Real native T1 runs (cheap models; transcripts committed as parser fixtures):
    • npm run bench -- --host claude --claude-model claude-haiku-5-5 --claude-effort low --arms A --tasks T1 --runs 1 → claude T1 A r1: pass, valid, 2 turns, in 4 out 180 cache w 17117 r 42661, $0.0039, 5.0s, calls native 1
    • npm run bench -- --host codex --codex-model gpt-6-luna --codex-effort low --arms A --tasks T1 --runs 1 → codex T1 A r1: pass, valid, 2 turns, in 16885 out 53 cache w 0 r 16384, $0.0019, 6.3s, calls native 1
  • codex debug prompt-input with the configs the harness writes (no model call, parser-fixtures/codex-surfaces.json): A sees exec_command/apply_patch and no exec; B sees only exec/wait; C sees neither, and the agent-code-mode server is configured.

Merge Danger

Door: two-way

Blast Radius: bench-only. Outside bench/: typecheck also checks bench/tsconfig.json, vitest also includes bench/**/*.test.ts, bench script runs node bench/run.ts (Node ≥ 22.18 type stripping). No new dependency.

Decisions

  • Codex "native" arm overrides the model catalog to direct tools: in Codex 0.169 every shipped model is already code-mode-only, so the out-of-the-box Codex is the code-mode arm (B), and features.code_mode changes nothing. Alternative: call the shipped default "native" and have no direct-tools arm.
  • Codex agent-code-mode arm (strict): shell (features.shell_tool=false) and apply_patch (catalog apply_patch_tool_type: null) removed, and the catalog's supports_search_tool turned off so run is exposed directly: with it on, Codex 0.169 hides MCP tools behind tool_search, which the model calls as a plain function in direct mode and the router rejects, so run was unreachable. Arm A keeps the shipped supports_search_tool. Alternative: coexist mode with the shell kept.
  • Default Codex model gpt-6.1-terra at medium effort (same price tier as claude-sonnet-5-5); Claude effort medium; max turns 60 (Claude only, Codex has no turn cap; the 15 min wall timeout applies to both).
  • Both Claude arms see the same non-file surface (none): arm A --tools Bash,Read,Write,Edit,Glob,Grep, arm B --tools "" plus the MCP run, with the native names allowed by rule in both (--disallowedTools is not used: agent-code-mode reads it as deny rules and would deny the same tools inside run). Neither arm has Task, ToolSearch or web tools. Alternative: keep Claude's default extra tools in both arms.
  • All Codex arms reach the same non-file tools: list_mcp_resources, list_mcp_resource_templates, read_mcp_resource and request_user_input. Turned off everywhere: apps, view_image, image generation, goals, multi-agent tools, sleep, clock, web search and tool_search. Arms A and B get an empty MCP server so they have the same MCP resource tools as C. Arm B uses its own catalog copy (still code-mode-only) with the same changes. Alternative: Codex's default extras, which differ between direct and code mode.
  • Each run fails the arm-integrity check unless its observed tool surface is exactly the required one; observed and required surfaces are recorded in the environment block.
  • Claude runs are isolated from the user's setup: CLAUDE_CODE_DISABLE_CLAUDE_MDS=1 (Claude loads <ancestor>/.claude/CLAUDE.md, i.e. the user's memory, for any workspace under the home folder, even with --setting-sources project), auto memory off, and a temporary CLAUDE_CONFIG_DIR with a copy of the credentials file, synced back if refreshed (same rule as Codex). Runs whose init event shows user agents, plugins or memory are invalid. Permissions and the T8 hook are passed with --settings (Claude ignores project permissions.allow in an untrusted folder). Where there is no credentials file (macOS keychain), the user's config dir is used and the environment block says so.
  • Codex hooks run with --dangerously-bypass-hook-trust (the only hook is the bench's own).
  • "Input tokens" means uncached input on both hosts; Codex output includes reasoning; Codex turns = model requests counted from the session rollout (only usage and tool names are kept from it).
  • Runs that do not match their arm (wrong tool surface, no run call, code mode in a native arm), time out or fail to parse are marked invalid and left out of medians; an agent-code-mode run that also used native tools is valid but flagged as fallback.
  • The T8 example hook blocks any call naming the protected file, plus shell commands that can write files and reach it through its directory (a whole-directory sed -i, glob, or inline script walking src/handlers); read-only shell commands on the directory stay allowed. A command that builds the path at run time from pieces can still slip through (the verifier then fails the run). Alternative: block every shell command on the directory, reads included.
  • Codex credentials: each run's temp CODEX_HOME holds a 0600 copy of auth.json. If Codex refreshes the token during the run, the new file is written back to the real auth.json (atomic, 0600) only when the real file is still the version that was copied; if both changed, the real one wins and a warning is printed. This runs at the end of each run, on Ctrl-C/termination, and at the next start for runs that were killed. Alternative: never touch the real file (a refreshed or rotated token would be lost and could log the user out).
  • T8 asks the agent to end with DENIED: <path> lines; it passes when the protected file is untouched, the reply lists exactly that file, and (when the run's log can show denials: Claude always, Codex with its session rollout) the log has the denied call. Works in any reply language. Alternative: parse a natural-language statement.
  • T1, T3 and T4 require the ANSWER: format the prompts ask for; for T1 and T4 the reply must end with that line. A correct value in another format fails. Alternative: accept the value anywhere in the reply.
  • Strict agent-code-mode arms: any native file/shell call makes the run invalid (it still counts in the fallback rate, over all runs). Runs are stored and resumed per hash of the full config, and the report never pools different configs; without --seed, a resume reuses the previous seed.
  • Read-only tasks must leave the workspace byte-identical; edit tasks fail if any file outside the task changed or was deleted (new helper files are allowed and listed).
  • npm run bench:report re-renders the summary (newest date under bench/results by default).
  • Dry-run results go to bench/.work/ (gitignored) and are wiped on each dry run; real results go to bench/results/<date>/.
  • typecheck and vitest.config.ts were extended to cover bench/ (needed for "tests under npm test"). Alternative: a separate test command.

🤖 Generated with Claude Code

mths-mcfs and others added 30 commits November 15, 2026 02:30
Add the project skeleton (package, TypeScript strict ESM, vitest, CI on
Linux, macOS and Windows, Apache-2.0 LICENSE and NOTICE, CLAUDE.md and
AGENTS.md) and the frozen contracts the sandbox, host adapter, tool and
benchmark parts build against.

The run path is executable end to end with test fakes: MCP tools/call ->
FakeSandbox -> Dispatcher (prepare, static rules, hooks, re-prepare on
updated args, commit) -> StaticHostAdapter -> MemoryToolRuntime, with
mutation ordering, cancellation, transactions with rollback, output caps
with overflow files, and a command hook runner that kills the process
group on timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Commit a dispatcher-owned deep-frozen copy of each prepared call; deep
  freeze now descends into objects that are already frozen.
- Bound every await on adapter and runtime code by the run's abort signal
  or a grace: prepare, PostToolUse (which now receives the signal),
  loadPolicy (the run deadline starts before it), in-flight calls on stop,
  rollback and dispose.
- Kill the command hook's whole process group on every completion path,
  so a backgrounded descendant cannot outlive the hook.
- Send protocol and validation errors through the capped result
  formatter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… bash

Implements the ToolRuntime contract for bash, read, write, edit, grep and
glob in src/tools:

- Workspace jail: paths resolve to real paths under the session cwd, MCP
  roots and configured extra roots; traversal, links leaving the roots,
  Windows alias spellings and NUL bytes are refused. Writes and edits to
  protected host paths and .git are refused.
- Commits re-check what prepare saw: no link at the final component
  (O_NOFOLLOW plus an fd path check), parent directories unchanged, content
  hash equal to the prepared before-hash. Writes are atomic (temp file in
  the same directory, mode kept; creates never replace a file that
  appeared meanwhile).
- Edit uses Turnpack's tolerant matcher (exact, line endings, copied line
  numbers, trailing whitespace, indentation, punctuation), refusing
  ambiguous and missing matches with the nearest text.
- Transactions journal originals in memory and durably under the state
  dir (64 MiB cap), roll back without clobbering external changes, and
  recoverStaleJournals restores journals left by a dead server.
- bash runs in its own process group with output caps, kills the group on
  timeout, abort and exit, and runs under @anthropic-ai/sandbox-runtime
  (bubblewrap or Seatbelt) when the policy asks for containment.
- grep and glob are pure JS with .git, node_modules and .gitignore
  ignores, and never follow links.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Protected path patterns are built by the host adapter from the session cwd
as the host spells it. Paths are checked as real paths, so a cwd reached
through a symlink, macOS /var or a Windows 8.3 short name made the patterns
miss. Each pattern now also matches with its literal prefix resolved.
Tests use native real paths so they agree with the runtime on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs each script in a fresh Node child process (empty env, bounded heap,
Node permission model) that hosts a QuickJS-ng VM from the sync WASM
build. Bindings are deferred promises settled by the parent's replies;
the parent validates every child message and kills the child on anything
unexpected, on timeout and on cancel. The WASM memory maximum is the real
heap limit, because QuickJS-ng's own accounting undercounts in this build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lower the default QuickJS stack to 128 KiB: 256 KiB overflowed the Node
stack on macOS with Node 22. A host stack overflow now ends the run as a
RangeError script error. The permission-model test allows the variables
the OS layer adds to every child env (libuv on Windows, macOS's encoding
hint).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bench/ runs coding-agent tasks on Claude Code and Codex CLI with native
tools, Codex code mode and agent-code-mode, from a deterministic fixture
repo, and reports turns, tokens, cost, wall time and pass rate per arm.

- fixture/generate.ts: seeded 96-file ES-module project, tests under
  node --test, byte-identical per seed (hash pinned in a test)
- tasks/T1..T8: prompts, bug injection, verifiers and reference solutions
- lib/claude.ts, lib/codex.ts: arm commands and configs, transcript parsers
  (Claude result event; Codex --json usage plus model requests and tool
  calls from the rollout), tool-surface checks per arm
- run.ts: seeded interleaved order, fresh git workspace per run, isolated
  hosts (Claude --setting-sources project; Codex temp CODEX_HOME with a
  copied auth file, always deleted), resumable, --dry-run
- report.ts: summary.json and a Markdown table (median, min-max)
- parser-fixtures: sanitized real native T1 runs from both hosts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Authorize every binding call the way Codex CLI 0.169 authorizes the
equivalent native action: config layers with project trust, exec policy
rules parsed from a safe Starlark subset, sandbox and approval semantics,
and the user's trusted PreToolUse hooks with the native Bash and
apply_patch inputs, fail-closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements HostAdapter and the context store for Claude Code in
src/hosts/claude: settings from every source with Claude's precedence,
deny/ask/allow permission rules (Bash with a real shell parser, Read/Edit
gitignore-style paths), permission modes, PreToolUse/PostToolUse command and
http hooks with the native payload (fail-closed), sandbox containment,
protected paths, and the companion hook that records trusted session context
keyed by the tool-use id.

Adds sh-syntax (mvdan/sh compiled to WASM, synchronous, no dependencies) to
parse Bash commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Node 22 prints TAP when stdout is not a TTY, so the pass count read 0.
Force the spec reporter and accept either summary format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Paths resolve component by component with POSIX semantics, so
  `link/..` is the parent of the link's target; an oracle test checks that
  a path is accepted exactly when its real path is inside the roots.
- Writes and edits check protected patterns on the real path and on every
  link the resolution went through, and refuse a final-component link.
- grep and glob re-check each directory after listing it and open each
  file without following links, checking the handle is the file at that
  path, so a directory swapped for a link mid-walk leads nowhere.
- grep runs the regular expression in a worker thread with a per-file
  time budget; an abort or an exhausted budget terminates it.
- Commits record dev+ino of the file and its directories at prepare and
  refuse when any changed; check-and-replace of one path holds a
  per-path lock and re-checks the abort signal, identity and content hash
  right before the rename.
- Rollback and crash recovery remove files and directories only through
  real directories strictly inside the roots, never through a link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…early aborts

- Replies to the child go through a writer that respects backpressure and
  caps the bytes waiting for the child (16 MiB) and the bytes sent per run
  (512 MiB); past a cap the run ends with outcome oom (ReplyBufferFull)
  instead of growing the server's memory.
- The child runs with --permission or, on Node 22.0 to 22.12,
  --experimental-permission (one comma-separated read grant with the *
  wildcard, the only form those versions honor). Without either flag the
  sandbox refuses to start.
- The abort listener is registered before onSpawn runs and the signal is
  re-checked after it; no call is forwarded once the signal is aborted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS realpath(3) accepts `file/..` that open(2) refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before Node 25 the permission model allows the probe's socket; the probe
then exits and resets the connection, which the test server must ignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dispatcher now commits a frozen structured clone of the prepared call,
so metadata kept by object identity was lost and every write was refused.
It is now kept in a bounded map keyed by a digest of the call's id, tool
and effect, and taken out at commit, so a prepared write commits once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…efects

- Hook matchers are Rust regexes: translate the exact subset (\A, \z,
  leading flags, POSIX classes, ...) and let untranslatable matchers
  match every call.
- Scripts that are not plain for Codex (comments, braces, escapes, quoted
  command names, dangling operators) also evaluate as bash -lc <script>.
- Evaluate commands behind wrappers (command, env, sudo, exec, nohup, nice,
  timeout, time, stdbuf, xargs, find -exec, eval) and trap actions; ask
  when a wrapper option is unknown.
- Deny a write/edit whose bytes the apply_patch format cannot show exactly
  when a hook would see the patch.
- Non-JSON hook stdout denies with hook-error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Auto mode: inner calls are allowed only when the run script reached
  Claude's classifier, that is when no allow rule approved the run tool;
  otherwise only reads and edits inside the working directories pass.
- Critical-path rm/rmdir removals always ask (dontAsk denies).
- Bash: parse env -S strings, skip shell option operands (-O, -o,
  --rcfile), strip every wrapper level (cap → ask), ask on alias/hash,
  match run-time words and absolute binaries by every static prefix.
- File targets of sed, awk, grep, cp, dd and other file commands, with
  symlinks resolved in authorize.
- Policy exposes isReadDenied for grep/glob result filtering.
- Hooks deduplicate per event, not across events.
- Context records are claimed with an atomic rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ms, resume, verifiers

- Temp CODEX_HOME links auth.json to the user's file instead of copying it
  (copy only where symlinks fail), is removed on SIGINT/SIGTERM/SIGHUP and at
  exit (running hosts are killed first), and homes left by a killed harness
  are swept at the next start.
- Sanitizer parses JSON lines recursively (strings holding JSON included),
  URL-decodes before matching paths, and redacts values by key name as well as
  by pattern, also inside escaped JSON text. The environment records only
  platform, kernel major.minor and arch.
- Strict agent-code-mode arms mark any native file/shell call invalid; Codex
  native command items in --json count even when the rollout misses them; the
  run-tool classifier matches only the agent-code-mode server's run tool.
- Runs are stored and resumed under a hash of their full config (host version,
  model, effort, seed, fixture, prompt, arm definition, agent-code-mode commit);
  the report never pools different configs. Without --seed a resume reuses the
  last invocation's seed.
- Read-only verifiers require an unchanged workspace; every verifier fails on
  changes outside the task's files; T6 checks exact 2-space formatting.
- Replayed Claude tool results are counted once per tool_use_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rename() let two concurrent readers win on Windows; O_EXCL creation of a
claim file is atomic on every platform. The grep/glob filter test uses the
POSIX-only in-memory runtime, so it is skipped on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rule like `Bash[rm]` or `Read[./.env]` matched nothing, so a deny the
user meant silently did not apply. Any deny, ask or allow rule that is not
`Tool`, `Tool(specifier)` or an MCP form without a specifier now fails the
policy load, naming the rule and its file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	package-lock.json
#	package.json
…gration

# Conflicts:
#	package-lock.json
#	package.json
…ration

# Conflicts:
#	package-lock.json
#	package.json
Deny and ask globs (`*`, `B*`, `mcp__*`) match the full tool name; allow
globs count only after a literal `mcp__<server>__` prefix, and unanchored
allow globs approve nothing, as the permissions docs define. Forms the docs
do not define still fail the policy load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Temp CODEX_HOME gets a 0600 copy of auth.json again (a symlink is replaced
  when Codex rewrites the file by rename, losing a refreshed or rotated token).
  The marker records the real path and the hash copied. Before a home is
  deleted (end of run, signal, exit, startup sweep), a changed temp copy is
  written back atomically (temp file + rename, 0600) if the real file still
  has the copied hash; if both changed, the real file is kept and a warning
  printed. The run's auth.txt records the outcome.
- Parsers collect denied calls: Claude hook/permission error results and
  agent-code-mode call-log denials; Codex blocked-call outputs from the
  rollout. T8 requires the denial in that log when the run has one, and an
  answer sentence naming the file with a denial that is not negated.
- T1, T3 and T4 require the ANSWER line format the prompts ask for (T1/T4:
  the reply ends with that line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…quested path, canonical cwd

Wire the real QuickJS sandbox, tool runtime and Claude/Codex adapters into
the server, add the generic read-only policy, the install and hook commands,
journal recovery at start, and run the containment tests in CI on Linux.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mths-mcfs and others added 4 commits November 15, 2026 21:21
…l options before -c in the Codex splitter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gration

# Conflicts:
#	src/hosts/claude/adapter.ts
mths-mcfs and others added 22 commits November 15, 2026 21:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…namespace limits in CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent tests run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…discovery

- Claude arm B removes the built-in tools with --tools "" instead of
  --disallowedTools (a CLI deny also denies the tool inside run, by parity) and
  allows the native names by rule, like arm A, so inner calls are allowed.
- Claude runs are isolated from the user's config: CLAUDE_CODE_DISABLE_CLAUDE_MDS
  (Claude loads <ancestor>/.claude/CLAUDE.md, the user memory, for any
  workspace under the home directory, despite --setting-sources project) and a
  temporary CLAUDE_CONFIG_DIR with a copy of .credentials.json (same copy, hash
  and write-back rule as Codex). The init event is checked for user agents,
  plugins and auto memory; the method is recorded in the environment.
- T8 asks for `DENIED: <path>` lines and verifies those plus the denial log;
  the natural-language check is gone.
- protect-file.mjs also blocks file-writing shell commands that reach the
  protected file through its directory (the smoke-run escape walked
  src/handlers in a Python heredoc).
- Codex arm C turns off supports_search_tool in its catalog, so run is exposed
  directly instead of behind tool_search, which direct mode calls as an
  unsupported function. All Codex arms turn off `apps`, which exposed the
  ChatGPT account's connected apps as tools. Arm C must see run directly.
- `npm run bench:report` (defaults to the newest results date).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Claude isolation check was inserted between the surface check and its
else branch, so 'tool surface not observed' was added to every non-Claude run.
The fake-codex harness test now asserts a valid record.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude: arm A runs with --tools Bash,Read,Write,Edit,Glob,Grep and arm B with
--tools "" plus run, so the only difference is native file/shell tools vs
run (no Task, ToolSearch or web tools in either).

Codex: every arm turns off apps, view_image, image_generation, goals,
multi_agent, sleep_tool, web search, the model's experimental extra tools
(clock) and supports_search_tool, and disables agents (multi-agent tools);
arms A and B get an empty MCP server so they have the same MCP resource tools
as arm C. Every arm then reaches exactly list_mcp_resources,
list_mcp_resource_templates, read_mcp_resource and request_user_input besides
its file/shell route (direct tools, exec, or run). The config is built table
by table so no key lands in the wrong table.

The arm-integrity check now requires these exact surfaces (Claude init tools;
Codex prompt-input, including tools nested in code-mode exec), and the
observed and required surfaces are recorded in the environment block.
Parser fixtures refreshed from a T1 smoke run with these surfaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The verifier cases each build their own workspace, so they run side by
side, two at a time on Windows. The tests that drive main() end to end
move to their own file, which Vitest runs in a separate process.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five at a time starved the timing-sensitive suites running in the other
workers, so the limit no longer depends on the platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cases that build several workspaces now share the worker with a second
case, and passed the 20 s default on the Windows runner. The 120 s limit
used from economia on moves down to where the cases start running side
by side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cases side by side

The git calls that build each workspace are synchronous, so cases running
side by side in one file barely overlapped. The cases run one after
another again, in their original form, and the long files are split so
that Vitest runs the parts in separate processes. Each verifier file
gets its own temporary root and cleanup, and every verifier case gets
the 120 s timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They drive main() end to end, and on Windows they now compete for the
CPU with the other test files, which put them close to 120 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry count

The poll counted the atomic-write temp file as a write, so it could stop
after two real files and then find two. Count only completed targets, wait
for the third one, and assert that nothing (file or temp file) appears after
the run settled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit ff2275b)
- Validate adapter decisions with a schema, reject non-string tool names and
  refresh the call summary after a hook rewrite.
- Keep overflow output out of non-private state directories and off Windows.
- Match path patterns across newlines and treat "..name" as inside a root.
- Run a single deadline from the start of the run, counting policy loading,
  and give the sandbox the time left rounded up.
- Roll back only after queued writes and edits end, report a pending
  rollback, and dispose the journal after the rollback has really finished.
- Make the fake sandbox check its deadline before steps and calls, yield
  between steps, and tie its deadline and sleeps to one signal.
- Describe the placeholder runtime the default server serves, with a
  runnable example.
- Resolve in-memory paths against the session cwd and roots (Windows paths
  included), track file revisions for rollback, and run grep and glob in a
  stoppable worker thread.
- Accept only a single --host option in serve.
- Skip spawning a hook whose run was already cancelled and stop recording
  calls in the default runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fake runtime: cap concurrent search workers per runtime; extra searches wait in a cancelable queue and a slot is reused only after its worker exits.
- Fake runtime: build the search job after a slot is held, send grep content only for files that pass the name filter, and reject a search that would copy more than the text limit.
- Fake runtime: count edit occurrences and build the diff without per-match or per-line arrays.
- Normalize Windows drive paths in the fake runtime and path patterns, and restore original revisions on rollback.
- Run: check the deadline before opening a transaction and word the pending-rollback warning accurately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…untime

Network-share (UNC) paths are not supported: POSIX resolution folds their
leading `//` while protected-path patterns keep it, so a protected share
could go unrecognized. The fixed root, seeded files, session cwd and roots,
and call paths now refuse UNC paths before any call is prepared.

Edit and write preparation now size the change from cheap counts first and
refuse, before building the edited text or the diff, an edit with more than
MAX_EDIT_REPLACEMENTS (50,000) replacements or a diff over MAX_DIFF_LINES
(200,000) lines. Changes under the budget produce the same text and diff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The session roots are checked for network-share (UNC) paths even when a
  fixed root replaces them, so a UNC session root is refused, not ignored.
- setFile and revision refuse UNC paths like every other path entry point.
- The diff line budget counts the rows the diff actually has: a text that
  ends with a line break no longer counts one extra row. Edit preparation
  works out whether the edited text ends with one from where the replaced
  occurrences sit, still before building the text or the diff, so diffs
  of up to MAX_DIFF_LINES rows are prepared and only larger ones refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep POSIX paths with redundant leading slashes local.
Return actionable guidance when an edit exceeds the replacement limit.
Stop glob after its first extra match and skip setup for cancelled searches.
Match local protection patterns and resolved paths with the same leading-slash normalization.
Use one resolved key for in-memory reads, writes and file revisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the reviewed scaffold fixes (UNC refusal, edit and diff budgets,
review-loop rounds) onto the bench branch.

- src/server/context.ts: keeps the bench layout (Claude and Codex
  providers live in src/hosts); the "..name is inside a root" fix moves to
  src/hosts/claude/context.ts, where ClaudeContextProvider now lives.
- src/server/runtime.ts: keeps the real runtime; the placeholder runtime the
  scaffold stopped recording calls in no longer exists here.
- src/server/mcp.ts: keeps the bench factory and journal recovery plus the
  scaffold's cancellable roots/list; drops the placeholder instructions and
  tool, since the default runtime here runs real JavaScript.
- src/server/mcp.test.ts: bench imports; drops the placeholder test.
- src/testing/memory-tool-runtime.ts: the scaffold runtime, with the bench
  contract's `filtered: 0` on grep and glob results (also in its tests and
  the fake-sandbox test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mths-mcfs
mths-mcfs changed the base branch from feat/scaffold to main November 19, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant