Repository navigation
Apply the shared eval contract across existing harnesses - #2903
Conversation
…ls/consolidation-13-harness-contract-adoption
…ls/consolidation-13-harness-contract-adoption
…ls/consolidation-13-harness-contract-adoption
|
…ls/consolidation-13-harness-contract-adoption
There was a problem hiding this comment.
All reported issues were addressed across 51 files
Architecture diagram
sequenceDiagram
participant O as Operator (CI/Dev)
participant R as Eval Runner (externalRunner)
participant B as Step Budget Resolver
participant E as Env Config
participant A as Tool Adapter (per-harness)
participant S as Agent SDK (per-harness)
participant T as Trajectory Adapter
participant V as Verifier
Note over R: Shared Eval Contract - Budget, System Prompt, Reasoning, Evidence
O->>R: runHarness(plan, model, toolSurface)
R->>E: Read EVAL_<HARNESS>_MAX_STEPS
E-->>R: raw budget
R->>B: resolveStepBudget(dataset, harnessDefault)
B-->>R: stepBudget + unit (turns/tool_calls/agent_steps)
Note over R: System Prompt Policy
alt Native channel available (claude, deepagents, mata, pi)
R->>S: runSession(prompt, nativeSystemPrompt)
S-->>R: System prompt appended/preset preserved
else Caller-owned SDK (codex)
R->>S: runSession(prompt + EVAL_SYSTEM_PROMPT prefix)
end
Note over R: Tool Surface Mounting
R->>A: prepareAdapter(toolSurface)
alt stagehand_facade (default)
A->>S: Mount MCP/bridge runtime
S-->>A: browser Session info + captureEvidence + sessionLoss API
else stagehand_facade_legacy (explicit override)
A-->>R: Explicit historical surface
end
A-->>R: Adapter (browserSession, evidence)
Note over R: Budget Enforcement
R->>S: Execute session (maxSteps, budgetUnit)
S-->>R: Streamed events (tool_calls, reasoning, usage)
alt Step budget exhausted
S-->>R: max_turns / step_budget status
R-->>V: No final answer (gate fires)
else Session completes
S-->>R: terminal message (committed turn only)
end
Note over R: Evidence & Session Loss
R->>A: captureEvidence() / browserSessionLoss()
alt CDP/browser disconnected
A-->>R: SessionLoss info
R-->>V: Record browser_session_lost, fail closed
else Success continues
A-->>R: ProbeEvidence
end
Note over R: Reasoning and Trajectory
S-->>R: Events (reasoning blocks, text, tool calls)
R->>T: Adapt to normalized trajectory
alt codex: rollout usage recovery when aborted
R->>E: Read isolated CODEX_HOME rollout JSONL
E-->>R: Recovered usage (reported=true)
end
alt Eve reasoning (step-index pairing)
T->>T: Pair reasoning.completed with stepIndex
else Pi thinking precedence
alt EVAL_PI_THINKING set
R->>S: thinkingLevel = explicit override
else Model suffix present
R->>S: thinkingLevel = suffix (e.g. :high)
else SDK default
R->>S: thinkingLevel = medium
end
end
T-->>R: Trajectory (steps + reasoning + finalAnswer)
Note over R: Verification and Result
R->>V: Verify(trajectory, rubric)
V-->>R: VerifierError or outcome
R-->>O: TaskResult (budget unit, usage presence, evidence, finalAnswer)
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…ls/consolidation-13-harness-contract-adoption # Conflicts: # packages/evals/tests/framework/claudeCodeToolAdapter.test.ts
…ls/consolidation-13-harness-contract-adoption
e30b9a7 to
e526cd9
Compare
…ls/consolidation-13-harness-contract-adoption
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
# Conflicts: # packages/evals/tests/framework/claudeCodeRunner.test.ts # pnpm-lock.yaml
…ls/consolidation-13-harness-contract-adoption
…REASONING_EFFORT
fx 0.0.11 changed its session layout: events.jsonl is now a flat
schema_version 3 stream ({event: {assistant|tool_call|tool_result|...}})
written only when the turn completes, the in-flight turn lives in
recovery.json, and tool outputs live in tool-results/ artifacts. The
harness still parsed the old {kind, payload} records, so every run
recorded 0 steps and the verifier saw no browser evidence.
- fx-sdk: parse the v3 stream (legacy records still supported), tail
recovery.json for live observations and as a fallback for runs killed
mid-turn, and inline tool-result / screenshot artifacts into steps.
- Final answer: prefer ask final_output (the final response alone) over
the joined narration in ask output.
- Add EVAL_FX_REASONING_EFFORT (auto|none|minimal|low|medium|high|xhigh|max),
passed as --effort and recorded as requestedReasoningEffort. fx silently
ignores unknown efforts, so they are rejected up front.
- Pass --model explicitly and map dashed Anthropic ids onto gateway catalog
ids (claude-sonnet-5-5 -> claude-sonnet-5.5): for ids outside the catalog
fx sends no reasoning parameter and no maxOutputTokens. Model and effort
are also merged into the run's settings.json so session.json records them.
There was a problem hiding this comment.
All reported issues were addressed across 17 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…2893) Bounds capture and RPC/batch waits. Two consecutive capture deadlines are recoverable; a third latches terminal session loss, while a successful tool call resets the counter. Late completion cannot overwrite newer snapshot IDs. Terminal loss rejects queued calls without dispatch. Actions are never automatically replayed. Regressions cover bounded timeout inputs, late completion, counter reset, screenshot transport and first-loss handling. `experimentalBatch` keeps its single `timeout` option (the callback deadline the browser-side executor enforces). The client bounds the whole round trip at `timeout` plus a 15-second batch grace (`CALLBACK_BATCH_CLIENT_GRACE_MS`), because the executor's timeout is cooperative and can be reported late. A batch that gets no response by then rejects with `StagehandBatchTimeoutError`; RPC response deadlines throw `RPCResponseTimeoutError`. Earlier revisions also exposed that local deadline as a `clientTimeoutMs` option. Nothing passed it, so it is removed; the default it produced is unchanged. The facade now calls `page.snapshot()` with `timeout: 0`. Snapshot gained a 20-second default on main, which fired before the facade's 120-second capture deadline, so a slow snapshot failed as an ordinary tool error and never counted toward terminal session loss. Preserves provider/session/age/timeout diagnostics through the host, checks screenshot byte limits before decoding, and isolates failures in diagnostic observers. The typed RPC timeout error lives in a focused public module, keeping internal RPC helpers outside the SDK public-field contract. Validation: 120 focused tests and 47 SDK AST/release guards, SDK/core/eval typechecks, SDK build/publint, and merged ownership/capture regression checks. At `b14e4ec95`: 345 SDK unit tests and 156 facade unit tests pass, with SDK and facade typechecks and the format check clean. Stack base: `main`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/integrations/core/src/facade/tools.ts`](https://github.com/browserbase/stagehand/blob/b14e4ec95e40a44fb9c0ec87383b060a10d4fab6/packages/integrations/core/src/facade/tools.ts) - [`packages/sdk-ts/src/batch.ts`](https://github.com/browserbase/stagehand/blob/b14e4ec95e40a44fb9c0ec87383b060a10d4fab6/packages/sdk-ts/src/batch.ts) - [`packages/integrations/core/tests/facade-tools.test.ts`](https://github.com/browserbase/stagehand/blob/b14e4ec95e40a44fb9c0ec87383b060a10d4fab6/packages/integrations/core/tests/facade-tools.test.ts) The CLI startup fix is now included in the parent (#2892), so this PR focuses on capture/RPC deadlines and recovery. Current main is incorporated, preserving both the timeout exports and the runtime-compatibility exports. Readiness: CI is running on `b14e4ec95e`; it last passed on `65d9c911b7` ([run](https://github.com/browserbase/stagehand/actions/runs/36969426716)). The one cubic comment (snapshot timeout) is fixed and resolved. Human review status is unchanged. Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
Adds configurable single-flight CDP heartbeat with bounded waits and lifecycle cleanup. Sanitized CDP_DROP diagnostics retain transport failure context without logging raw payloads or credentials. Automatic reconnect is excluded. Error followed by close records the first failure once; heartbeat timers are unrefed and cleared during shutdown. Nested transport causes are retained in a bounded, sanitized CDP_DROP diagnostic, without changing terminal behavior. Validation: 49 CDP tests, 44 SDK AST guards and SDK typecheck/format checks; CDP lifecycle/heartbeat/drop-diagnostic unit tests. Stack base: `evals/consolidation-03-capture-recovery`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/sdk-ts/src/cdpClient.ts`](https://github.com/browserbase/stagehand/blob/67467cc25e39b6fa77355f7a847971338f0c85c2/packages/sdk-ts/src/cdpClient.ts) - [`packages/sdk-ts/tests/cdpHeartbeat.test.ts`](https://github.com/browserbase/stagehand/blob/67467cc25e39b6fa77355f7a847971338f0c85c2/packages/sdk-ts/tests/cdpHeartbeat.test.ts) Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
…accounting (#2902) Defines one eval-owned autonomy policy and a shared result contract for external harnesses. Records policy channel/version, effective budget and unit, requested configuration, browser identity, execution reason, normalized usage and trace/timing metadata. Unknown usage and subscription costs remain unavailable. Astra estimates also remain unavailable until per-request context-tier accounting exists. Other supported direct-provider estimates include the dated catalog source. Generic task JSON is preserved in results and verifier trajectories. Failed facade calls remain failures regardless of tool-output text; runner-owned telemetry determines run-level session loss. PR13 wires browser identity and budget helpers into existing adapters. Validation: isolated shared-runner changes passed all 896 eval tests and eval typecheck. The complete repaired stack passed 30 build/typecheck tasks and 29 unit-test tasks, including 999 eval tests. Fresh CI passed on this PR’s current head. Stack base: `evals/consolidation-04-cdp-diagnostics`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/evals/framework/evalSystemPrompt.ts`](https://github.com/browserbase/stagehand/blob/2761befd8b28ca7809fc8b63da572282e2a36afc/packages/evals/framework/evalSystemPrompt.ts) - [`packages/evals/framework/harnesses/externalRunner.ts`](https://github.com/browserbase/stagehand/blob/2761befd8b28ca7809fc8b63da572282e2a36afc/packages/evals/framework/harnesses/externalRunner.ts) - [`packages/evals/framework/usageNormalization.ts`](https://github.com/browserbase/stagehand/blob/2761befd8b28ca7809fc8b63da572282e2a36afc/packages/evals/framework/usageNormalization.ts) Readiness: [CI passed](https://github.com/browserbase/stagehand/actions/runs/36970179071) on `2761befd8b`. Human review status is unchanged. Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
) Replace Cursor CLI execution with the Cursor SDK on the shared Stagehand facade mount, and retain the runnable integration contributed in #2771. The eval harness and documented example share one SDK session implementation for settings isolation, tool events, cancellation, and cleanup. Stack base: the harness contract adoption PR (`evals/consolidation-13-harness-contract-adoption`). This existing #2889 takes the planned Cursor replacement position; no additional Cursor PR is needed. The example keeps its docs, icon, MCP/stdio entrypoint, isolated workspace, and SIGINT/SIGTERM handling. It now consumes the shared SDK instead of maintaining a second agent lifecycle. The shared SDK accepts an explicit API key for hosts that supply an isolated environment. Validation: 64 focused tests pass (28 SDK, 19 example, 17 eval boundary); SDK/dependency and eval CLI/ESM builds, three package typechecks, scoped format/lint, and changeset validation pass. No new live browser/model validation is claimed here. Original contribution: @antonvishal, [#2771](#2771), source head `7b1d52d117c92bbda79a4b3cce6775ff60154712`, approved and claimed by @miguelg719. Contributor ancestry is preserved through normal merges. Follow-up integration changes are maintained manually on this internal branch as part of the consolidation stack; do not trigger an external-source mirror refresh for these follow-ups. <!-- external-contributor-pr:owned source-pr=2771 source-sha=7b1d52d117c92bbda79a4b3cce6775ff60154712 claimer=miguelg719 --> Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907. --------- Co-authored-by: Vishal Anton <[email protected]> Co-authored-by: miguel <[email protected]>
Provides one typed bridge from native computer-use adapters to the canonical facade on the runner-owned browser. The bridge centralizes MCP results, screenshots, evidence capture, and failure decoding; provider protocols remain in their own adapters. An internal callback envelope preserves strings such as `"42"` and `"null"` as strings while also preserving JSON values and `undefined`. Malformed action results and incomplete action batches fail explicitly. Visible facade pages also expose their read-only Stagehand `pageId`, so native tab tools can use the shared visible context without reaching into the hidden keeper tab. Tool and transport failures use fixed typed diagnostics. Runner RPC deadlines now raise a typed `StagehandFacadeTimeoutError` carrying `timeoutMs`; the CUA adapter preserves that duration while keeping arbitrary transport-error text generic. Confirmed session loss still takes precedence. Only the runner-owned browser-loss getter can produce terminal session loss, so page content and model-written error strings cannot stop a run by impersonating that signal. Validation: 23 bridge and transport tests pass, including the compiled facade/MCP fixture, an actual expired RPC, preserved timeout duration, generic handling of spoofed timeout text, and confirmed session loss. Eval typecheck, build prerequisites, and formatting pass. Stack base: `external-contributor-pr-2771`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/evals/framework/cuaToolAdapter.ts`](https://github.com/browserbase/stagehand/blob/c520664a201ebba1d3b2929f69be9152d6416b63/packages/evals/framework/cuaToolAdapter.ts) - [`packages/evals/tests/framework/cuaToolAdapter.test.ts`](https://github.com/browserbase/stagehand/blob/c520664a201ebba1d3b2929f69be9152d6416b63/packages/evals/tests/framework/cuaToolAdapter.test.ts) Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
Adds Claude native browser use through the shared CUA bridge and canonical facade. Native tool instructions remain separate from internal mount instructions, and the shared autonomy policy is injected once through the native system channel. Includes package, build, and CI registration. Retains thinking, tool-result blocks, usage presence, and screenshot evidence. API history can discard older screenshots without mutating verification events. Unmatched calls carry a missing-result failure instead of appearing successful. Diagnostic logs contain tool name/status/duration; original tool inputs stay in session evidence, and abort diagnostics are sanitized. Tab operations use the canonical visible context and readonly `page.pageId`. Keeper pages cannot enter tab inventory or be selected/closed; legitimate visible blank pages remain available. Explicit `tab_id` actions refresh active identity before executing. A first reference action without cached tab state adds one inventory call to obtain real IDs. Typed canonical session-loss errors or runner-owned telemetry stop execution; page error text alone cannot impersonate browser loss. Drag uses the SDK `dragAndDrop` primitive. Separate held-button down/up gestures and modifier clicks receive actionable unsupported errors; complete drag and ordinary clicks are supported. Partial toolset configuration preserves member defaults, literal Space is accepted, `find` text is capped, and transcript clipping preserves surrogate pairs. Validation: **72 tests pass across 8 files**, including **55 Claude SDK tests**, native eval/runner/mount tests, and the compiled facade/MCP fixture. Tests execute generated snippets through actual canonical `StagehandFacadeTools` and SDK `Page`/`BrowserContext` objects over in-memory RPC. Claude SDK and full eval typechecks, matching core/Claude SDK builds, and scoped formatting pass. Generated test artifacts under dist/.turbo/node_modules leave the task cache inputs and hash unchanged. Provider responses are scripted; these checks do not establish live browser gestures, model performance, or disconnect recovery. Stack base: `evals/consolidation-15-shared-cua-bridge`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/integrations/claude-cua-sdk/src/executor.ts`](https://github.com/browserbase/stagehand/blob/ac0acaffa0d3f05f94d4eef6b8c57a9898b52f73/packages/integrations/claude-cua-sdk/src/executor.ts) - [`packages/integrations/claude-cua-sdk/src/session.ts`](https://github.com/browserbase/stagehand/blob/ac0acaffa0d3f05f94d4eef6b8c57a9898b52f73/packages/integrations/claude-cua-sdk/src/session.ts) - [`packages/evals/framework/claudeCuaRunner.ts`](https://github.com/browserbase/stagehand/blob/ac0acaffa0d3f05f94d4eef6b8c57a9898b52f73/packages/evals/framework/claudeCuaRunner.ts) Review fixes: Refresh visible tabs after coordinate and ref actions so popups appear in the same tool result while keeper tabs stay hidden. Missing page IDs now raise a typed facade error. Diagnostic tests assert member names, success status, and duration alongside secret redaction. Updated tests cover the real SDK/facade and MCP boundaries; all three review threads are resolved after passing CI. Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
Adds Gemini native computer use through the same CUA bridge and canonical facade. System instructions and cancellation use the SDK configuration; normalized coordinates map to browser coordinates. Includes package, build, CI registration, and the shared harness guide. Stores the actual model-visible tool response and screenshot against its call ID, with optional fields for older records and no duplicate per-action captures. Confirmed runner-owned browser loss or a typed core facade loss is terminal; arbitrary error text, including agent-marked errors, remains recoverable. Missing, blocked, truncated, and malformed provider responses fail as SDK errors, and partial tool calls from those responses are not executed. Every function-call batch is validated before any member executes. Arbitrary model/resource identifiers are passed to the provider, with only the optional `google/` alias removed. Drag uses the existing SDK `dragAndDrop` primitive. Hotkey arrays execute as one chord, wait honors the requested seconds, and the current scroll action uses its documented default while retaining the legacy action's default. Budgets use `EVAL_GEMINI_CUA_MAX_TURNS`. Explicit empty answers remain empty, unfinished calls remain failed, and the last model-visible image is retained when terminal capture is unavailable. That fallback is the last captured frame, not a fresh terminal screenshot. Transcript clipping preserves Unicode pairs. Validation: 72 Gemini SDK/eval tests across seven files pass, including scripted terminal-response cases and generated executor code exercised against the actual SDK Page and RPC schemas over an in-memory transport. The earlier combined Claude/Gemini/shared suite, including the compiled facade/MCP fixture, passed 101 tests across 14 files before this Gemini follow-up. Gemini SDK and full eval typechecks and the Gemini SDK build pass; parent propagation and final combined validation are separate checks. These are local contract checks; live provider performance and semantic judge compatibility remain separate gates. Stack base: `evals/consolidation-16-claude-cua`. Review this PR relative to its immediate predecessor. Reviewer entry points: - [`packages/integrations/gemini-cua-sdk/src/executor.ts`](https://github.com/browserbase/stagehand/blob/edc3c35f46976a8321d20cabbebd496027d99073/packages/integrations/gemini-cua-sdk/src/executor.ts) - [`packages/integrations/gemini-cua-sdk/src/session.ts`](https://github.com/browserbase/stagehand/blob/edc3c35f46976a8321d20cabbebd496027d99073/packages/integrations/gemini-cua-sdk/src/session.ts) - [`packages/evals/framework/harnesses/geminiCuaAdapter.ts`](https://github.com/browserbase/stagehand/blob/edc3c35f46976a8321d20cabbebd496027d99073/packages/evals/framework/harnesses/geminiCuaAdapter.ts) Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
## Stack Top-of-stack child of #2906 (`evals/consolidation-17-gemini-cua`). Review against that immediate parent, not `main`. ## Summary Port the remaining focused Codex/Stagehand facade hardening from the experimental Codex worktree without replacing the consolidation stack's newer shared runtime. - Add opt-in facade JSONL tool logging: request/session IDs, actual arguments/code, paired starts/ends, timing, errors, bounded result previews and browser readiness. Never write logs to MCP stdout; redact known credentials and omit image payloads. - Escape Unicode line separators in text tool results, addressing the stream parsing failure observed in the Hostelworld benchmark traces. - Share isolated HOME/CODEX_HOME creation between the SDK example and evals; do not inherit operator plugins/config/thread context. Preserve file-based auth. - Abort unexpected MCP servers, await observation capture, and match evidence by tool-call ID so unrelated calls/missing final captures do not shift screenshots. - Add optional bounded SDK failure artifacts and keep binary payloads out of telemetry without mutating original events. - Document the difference between Codex event logs and facade server logs, privacy limitations, authentication, and runnable logging commands. This remains the existing Codex SDK harness with the Stagehand facade, not a new native OpenAI computer-use adapter. Preserve the parent's terminal session-loss semantics, shared facade API, HardBench dataset, verifier and usage contracts. The older experimental `state`/`nodeRepl`/`reset` surface and reconnect implementation are not copied wholesale into the newer shared runtime. The original dirty worktree remains untouched. ## Validation - 220 focused tests pass across 23 files (core facade, Codex SDK, eval adapters). - 2 standalone Codex example tests pass. - Built stdio regression verifies the JSONL file is created and contains paired request IDs and error results while the MCP client remains responsive. - Integration packages and eval ESM/CLI builds; core/Codex/example/evals typechecks. - Targeted lint: no errors; warnings remain in existing patterns and diagnostic stringification. `git diff --check` passes. - No paid model or HardBenchmark rerun; no benchmark score improvement claimed. ## Operational notes Logging remains opt-in. Logs/error artifacts may contain sensitive model/page content despite best-effort redaction and must be reviewed before sharing. Unexpected-server detection aborts observed calls; it is not a security sandbox. Keychain-only login is not copied into isolated profiles. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Hardens Codex facade runs with isolated `HOME`/`CODEX_HOME` profiles, opt-in tool logging, and evidence keyed to tool-call IDs so unmatched or unrelated calls no longer misplace screenshots. **New Features** - Adds opt-in JSONL facade tool logging with request/session IDs, arguments, timing, errors, and bounded result previews; logs go only to file or stderr, never MCP stdout, with known credentials redacted and image payloads omitted. - Saves bounded SDK failure artifacts to `STAGEHAND_CODEX_DIAGNOSTICS_DIR` or `EVAL_CODEX_DIAGNOSTICS_DIR`; a failed diagnostic write never masks the original SDK failure. - Shares isolated `HOME`/`CODEX_HOME` creation between the SDK example and evals via a common helper in `@browserbasehq/stagehand-integrations-codex-sdk`; only file-based `auth.json` is copied, never plugins, config, stray `CODEX_*` env, or inherited thread context, and the example now runs in a temporary working directory and warns Codex to use only the mounted browser tools. **Bug Fixes** - Matches probe evidence by tool-call ID so missing final captures no longer shift screenshots onto the wrong step. - Aborts on unexpected MCP servers (detection only, not a sandbox). - Escapes Unicode line separators in text tool results, fixing the stream parsing failure seen in Hostelworld traces. <sup>Written for commit bdc69f2. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/2907?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. --> Current open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.
…3090) ## Stack 4 of 4 in the evals TUI overhaul. Base: #3089. #3087 concurrency · #3088 config v2 + env · #3089 doctor · **→ #3090** ## Summary **A 6-wide HardBench run used to render as one row** that kept flipping between running, passed and failed. Every suite names all its cases `agent/<suite>`, and the board keyed rows by task × model, so every in-flight case and every trial overwrote the same row. Concurrency looked like 1 whatever `-c` said. **Before** (6 in flight): ``` Task Model Result ⣾ agent/hardbenchmark openai/gpt-5.4-mini running ``` **After:**  ### Live board - **Row identity:** progress events carry a row key (cell + case + trial) and a case label: short id, domain and question, read from `id|task_id`, `web|website` and `ques|confirmed_task` (`framework/caseIdentity.ts`). - **One row per case in flight:** `id domain · question · phase · elapsed`. - Phases (`session` → `agent` → `verify`) are reported from inside the harness and target code through an AsyncLocalStorage row context (`framework/rowContext.ts`). - Elapsed time turns yellow once a row outlasts the p75 of finished rows. - **Status bar:** progress, ✓ / ✗ / ⏱ counts, elapsed time and ETA, plus the queue line from #3087 (`running · queued · openai 6/6 · throttled`). Queued rows are counted there and never take a row. - **Recent:** the last few finishes with their outcome kind (`max_turns`, `sdk_error`, `gated`, `ungraded`) and session URL. - **Keys:** `esc` stop, `v` logs off → all → one, `?` help. They work in argv mode and the REPL, and the REPL no longer echoes keystrokes onto the board. - **Non-TTY** (CI, pipes): one line per event, with no cursor escapes. ### Logs - **Every case writes its own file:** `.trajectories/<run>/logs/<id>-<site>__<provider>-<model>.log`. Default runs used to drop all output. - **Console output** from inside a row goes to that row's file instead of over the board. - **`-v`** streams the lines above the board, attributed by case id; **`--follow <id>`** streams one case. - **`--json`** writes only the summary object to stdout; the header, board and logs go to stderr.  ### Summary - **Headline:** suite · runs · duration · tokens, plus cost when the harness reports it. - **Per-cell table** (harness × tool × model): pass rate, `max_turns`, `sdk_error`, `gated` (the judge passed it, a deterministic gate such as `no_browser_use` failed it), `ungraded`, `retried`. - **Failures:** infra failures first, with reason and session URL; rubric fails listed by case id. - **Links:** the experiment URL, the trajectory group and the log directory.  - **Dead judge:** when the judge graded nothing (a retired model, a bad key), every row fails closed, so the pass rate says nothing about the agent. The run now says so and exits 1:  ### Also - `evals run --help` lists each harness's tool surfaces (default starred) and the suites, from a registry (`framework/benchSuites.ts`) that parse and the planner now share. - The `--preview` header lists every constant column, so a single-cell run still names its tool surface. - The README run section is rewritten around the new screenshots, replacing `run.gif`. ## Notes - **Screenshots** are rendered from the real `ProgressRenderer` and summary code with fixture events and a fixed clock (ANSI → HTML → Playwright), not mocked up. - **#2903** (isolated `CODEX_HOME`) touches `benchHarness.ts`, `runner.ts` and `run.test.ts`. A trial merge conflicted in 6 hunks, all mechanical. ## Test plan - [x] `vitest packages/evals/tests`: 954 passing. New: `caseIdentity`, `rowLog`, `runSummary`, `progress` (board layout, p75 colouring, non-TTY output, `--json` routing to stderr), `resultsSummary`, `benchSuites`, `help`. Also extended `runnerProgressEvents` (distinct row keys across cases × trials, phases landing on the right concurrent row, per-row log files) and `run.test` (`v` cycling, `--follow`, dead judge exit 1). - [x] tsc, `fmt:check` - [x] Live `evals run b:hardbenchmark --harness codex --tool stagehand_facade -e browserbase`: the board showed one row per case with phases and the queue line. (That run's facade calls were cancelled by a local `~/.codex/config.toml` `approvals_reviewer` setting; #2903's isolated `CODEX_HOME` fixes that and it's unrelated to this PR.) <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic The evals run experience gets a case-level live board, per-case log files, and an end-of-run summary. A suite run used to collapse every in-flight case into one row (all cases share the task name `agent/<suite>`), so concurrency looked like 1 regardless of `-c`; now each case in flight gets its own row. - Board rows are keyed by case id, domain, question, and trial, show the current phase (`session` → `agent` → `verify`) and elapsed time, and list the latest finishes with their outcome kind and session URL; queued rows only appear in the status line. - Every case writes its own log file under `.trajectories/<run>/logs/`; `-v` streams all case logs above the board, `--follow <id>` streams one, and the `v`/`esc`/`?` keys work in both the REPL and argv modes. Filenames keep the model provider and get `~2`/`~3` suffixes on collision; a filesystem error disables that row's file instead of failing the row. - Runs end with a per-cell table (pass rate, `max_turns`, `sdk_error`, `gated`, `ungraded`, `retried`), infra failures with session URLs, and a dead-judge banner (exit 1) when the judge graded nothing. - `--json` emits only the summary to stdout; non-TTY output is one line per event with no cursor escapes. The board draws on stderr and sizes to that stream, Ctrl/Meta chords stay off it so Ctrl+C still interrupts, and the preview header names an overridden model once. - `evals run --help` lists each harness's tool surfaces and the suites from a shared registry that discovery also reads, so a listed suite always gets discovered. The README run section is rewritten around screenshots rendered from the real renderer, replacing `run.gif`. <sup>Written for commit be4fc36. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3090?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/browserbase/stagehand/3090?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3090&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
Applies the shared eval contract to Claude Code, Codex, Deepagents, Eve, FX, Mastra, and Pi. The autonomy policy uses an additive native system channel where available and one task prefix otherwise, preserving each harness's stock instructions.
Forwards session loss, retained evidence, usage-presence flags, and the actual budget unit into the shared runner. Pi reasoning follows explicit override, model suffix, then SDK default; Codex forwards the requested reasoning effort even with a caller-owned SDK. Pi aliases use the canonical model for token-price computation, and console diagnostics survive normal log persistence. Eve rejects malformed provider/model IDs before execution. FX totals count cached input once: 1,000 input tokens, including 600 cached, plus 200 output and 50 reasoning tokens total 1,250. Native Anthropic thinking blocks are retained as reasoning without appearing in visible Deepagents output.
Validation: 88 focused Codex/Eve/Pi TypeScript tests across six files and 32 Deepagents Python tests pass. Eight FX runner tests also pass, including the cached-input total regression. A separate 12-test Eve run passes with both budget overrides set in the invoking environment. The final consolidated build and workspace typechecks pass with the FX correction, along with all 1,006 eval tests and 769 runtime tests. Existing Pi loader regressions cover suffix/override precedence. Provider responses are local fixtures; this does not establish live model performance or disconnect recovery.
Uses
@openai/codex-sdk0.153.4 with its bundled CLI, which supportsmax,ultra, andpersistentreasoning effort. The allowlist is checked against the SDK type, and invalid effort is rejected before browser startup. NoEVAL_CODEX_PATHoverride is needed for these values.Validation for the SDK update: 30 Codex runner/adapter/bridge tests and 26 SDK session tests pass, with eval and SDK typechecks. A live smoke run at
maxcompleted in 14 seconds using the bundled CLI and local Chrome: the agent used the mounted facade, returned the Example Domain heading and IANA link, and produced browser evidence.Stack base:
evals/consolidation-12-shared-runner-contract. Review this PR relative to its immediate predecessor.Reviewer entry points:
packages/evals/framework/codexRunner.tspackages/evals/framework/piRunner.tspackages/integrations/deepagents/runner/run_eval.pypackages/evals/framework/fxRunner.tsCurrent open stack: #2893 → #2894 → #2902 → #2903 → #2889 → #2904 → #2905 → #2906 → #2907.