Repository navigation
feat(evals): config v2 with local overrides and one .env loader - #3088
Merged
miguelg719 merged 7 commits intoOct 12, 2026
Merged
Conversation
evals.config.json gains v2 sections (defaults.harness/successMode, benchmarks, harnesses, providers, verifier, campaign) that resolve to env overrides under the existing flag → env → config precedence. 'evals config set' now writes the gitignored evals.config.local.json; --shared edits the tracked file and never leaks local overrides into it. cli.ts loads .env through loadEvalsEnv() (cwd first, then packages/evals/.env), which records provenance for the doctor. Browserbase credentials are preflighted once per run, and bench runs print the judge, success mode and trajectory persistence in the header.
This was referenced Oct 1, 2026
Contributor
There was a problem hiding this comment.
1 issue found across 25 files
Confidence score: 5/5
- The first
--sharedtest inpackages/evals/tests/tui/config.test.tsdoesn't verify_metais stripped because its seed has no_metafield. Add_metato the seed so the assertion covers that behavior.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/evals/tests/tui/config.test.ts">
<violation number="1" location="packages/evals/tests/tui/config.test.ts:142">
P3: The first `--shared` test claims to verify the tracked file is written "without _meta", but the tracked seed contains no `_meta` field, so the assertion passes regardless of the `{ _meta, ...shared }` stripping in `updateConfig`. Add `_meta` to the tracked seed so the `readTracked` assertion actually verifies the marker is dropped from a shared write (and the v1-carried-marker preservation path in `updateConfig` is also worth covering).</violation>
</file>
Architecture diagram
sequenceDiagram
participant User as Developer / CLI User
participant CLI as evals CLI (cli.ts)
participant EnvLoader as loadEvalsEnv()
participant EnvFiles as .env Files (cwd + package)
participant ConfigCmd as evals config (config.ts)
participant ConfigFiles as evals.config.json + local
participant Parser as resolveRunOptions()
participant Runner as evals run / Runner
Note over User,Runner: Runtime Configuration & Environment Flow
User->>CLI: Invoke evals command
CLI->>EnvLoader: loadEvalsEnv()
EnvLoader->>EnvFiles: Read cwd/.env (wins) then package/.env
EnvFiles-->>EnvLoader: Key-value pairs + provenance
EnvLoader->>CLI: Merge into process.env (shell exports win)
User->>CLI: evals config set <key> <value>
CLI->>ConfigCmd: Handle config command
ConfigCmd->>ConfigFiles: Read tracked + local config
alt Local scope (default)
ConfigCmd->>ConfigFiles: Write override to evals.config.local.json
else --shared flag
ConfigCmd->>ConfigFiles: Write to tracked evals.config.json
end
ConfigCmd-->>User: Confirmation message
User->>CLI: evals config providers set openai concurrency 6
CLI->>ConfigCmd: Handle section subcommand
ConfigCmd->>ConfigFiles: Validate + write providers.openai.concurrency to local file
User->>CLI: evals run <target>
CLI->>ConfigCmd: Read merged config (tracked + local)
ConfigCmd-->>CLI: Effective config (defaults, sections)
CLI->>Parser: resolveRunOptions(flags, config, env)
Parser->>ConfigFiles: Apply defaults + section values
alt Env twin present
Parser->>Parser: Env var wins over config value
else No env twin
Parser->>Parser: Use config value as env override
end
Parser-->>CLI: Resolved options + envOverrides
CLI->>Runner: runEvals(options)
Runner->>Runner: Preflight Browserbase credentials (if env=browserbase)
alt Missing credentials
Runner-->>CLI: Throw error before planning
else Credentials OK
Runner->>Runner: Build run matrix + resolve verifier model
Runner-->>CLI: Run header with concurrency, judge, success mode
CLI-->>User: Progress + results
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- config path local now reaches handleConfig through the command tree. - --shared is rejected for config core/tracing instead of silently writing a personal override. - Integers must be safe; maxUnverifiableCriteria accepts 0; judge ids need non-empty provider and model segments. - harnesses.<h>.models is rejected (and ignored in resolution) for harnesses that pick models per task category, e.g. stagehand. - A local file whose defaults is not an object fails with a clear error. - README/help/config output name the env-first defaults exceptions (EVAL_SUCCESS_MODE, STAGEHAND_BROWSER_TARGET); verifier help shows the value shapes. - Tests cover loader provenance, force reload, env-over-config widths, rejected writes not persisting, and the _meta strip on shared writes.
|
…ig-env # Conflicts: # packages/evals/framework/runner.ts # packages/evals/tests/tui/run.test.ts
akeimach
approved these changes
Oct 9, 2026
miguelg719
added a commit
that referenced
this pull request
Oct 12, 2026
## Stack 3 of 4 in the evals TUI overhaul. Base: #3088. #3087 concurrency · #3088 config v2 + env · **→ #3089** · #3090 run experience ## Summary **`evals doctor --harness a,b [--probe]`** prints a probe matrix with one row per harness, plus the judge, Browserbase and the env files. Each failing row prints the exact command that fixes it. - **Per harness:** binary or runtime resolvable, provider key present, key validity (with `--probe`: one request to the provider's models endpoint, so a dead key shows up here instead of as a silent `sdk_error` mid-run), and one extra per harness: `CODEX_HOME` writable for codex, Node heap for the in-process harnesses (mastra, pi) at concurrency ≥ 5. fx and cursor are listed as not probed yet. - **Judge:** the resolved verifier model and its key. With `--probe` it also checks that the model is still served; a retired judge would otherwise fail every criterion and make the run exit as dead-judge. - **Browserbase:** both credentials. With `--probe` it also looks up the project with the key (401/403 means the key was rejected, 404 means the project wasn't found). - **Env files:** which `.env` files were loaded and which keys they shadowed (from the #3088 loader). A shadowed key always warns. - **Verdict:** only requested harnesses (`--harness`, or `defaults.harness`) can fail it, and when one is requested, the judge and Browserbase rows can too. The rest of the matrix is informational. - **`--probe`** is now a public, documented flag. It was hidden before.  ## Test plan - [x] `vitest packages/evals/tests`: 882 passing. New: `doctorHarnesses.test.ts`, with probes stubbed and covering each row kind, verdict narrowing and fix hints. - [x] tsc, `fmt:check` <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a probe matrix to `evals doctor` that checks each harness's binary, provider keys, key validity (with `--probe`), and harness-specific extras, plus the judge model and Browserbase project. Each failing row prints the exact command that fixes it, and `--probe` is now a public, documented flag. **Details** - `evals doctor --harness a,b [--probe]` probes every executable harness (stagehand through gemini_cua): binary or runtime resolvability, key presence for every provider in the harness's model matrix (in the planner's order), key validity via one request to each provider's model endpoint, and extras such as heap size for in-process harnesses or `CODEX_HOME` writability for codex. `fx` and `cursor` are not probed yet. - Also checks the resolved verifier model (env or config, and with `--probe` that it's still served on each provider), both Browserbase credentials plus project lookup with `--probe` (a rejected key reads as 401/403, an unknown project as 404, and 429/5xx as a rate limit or outage to retry rather than a bad key), and reports which `.env` files were loaded and which keys they shadowed. - Only requested harnesses (`--harness`, `defaults.harness`, or `--harness all` to make every row count) can fail the verdict; when one is requested, the verifier and Browserbase rows can too. Everything else is informational. Shadowed env keys always warn. <sup>Written for commit 329b2ae. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/browserbase/stagehand/pull/3089?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/3089?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3089&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. -->
miguelg719
added a commit
that referenced
this pull request
Oct 12, 2026
…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. -->
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
2 of 4 in the evals TUI overhaul. Base: #3087.
#3087 concurrency · → #3088 · #3089 doctor · #3090 run experience
Summary
Personal settings no longer go in the tracked config file, and there is now one
.envloader.Config v2
evals.config.jsongainsversion: 2and the sectionsdefaults.harness/defaults.successMode,benchmarks.<suite>.limit,harnesses.<h>.{models,tool},providers.<p>.concurrency,verifier.{model,maxUnverifiableCriteria}andcampaign.tag.flag → env → local → tracked → default).defaults.*keeps its existing order: flag, then local, then tracked, then the ambientEVAL_*vars. The help,evals configand README now state both rules.evals.config.local.json(gitignored) holds personal overrides.evals config set …and the first-run marker write there.--sharededits the tracked file and can't leak local overrides into it.config harnesses | providers | verifier | campaign.build-climoves a pre-v2 dist config's personal edits intodist/cli/evals.config.local.json. Values equal to the old tracked defaults are not treated as edits, so dist installs pick up the newconcurrency: 3instead of pinning the old 10.Env
loadEvalsEnv()(evalsEnv.ts) replaces the two inlinedotenv.configcalls incli.ts, with the same order: the cwd.envfirst, thenpackages/evals/.env, and shell exports always win.promotePackageEnvis removed: with one loader it could never fire.Run header and preflight
Test plan
vitest packages/evals/tests: 866 passing. New or updated:config.test.ts(merge, diff,--sharedisolation, v1 read),evalsEnv.test.ts,parse.test.ts(config sections → env overrides, env twins win),run.test.ts(Browserbase preflight, config widths in the header), andcli.test.ts(writes land in the local file; the tracked file is untouched).fmt:checkevals config …against a scratch worktree (output above).Summary by cubic
Personal settings now live in a gitignored local config file, and the CLI loads
.envthrough one loader, so the doctor reports exactly what the runner loaded.Config v2
evals.config.jsonbecomes v2;evals config setwrites personal overrides to the gitignoredevals.config.local.json, and--sharededits the tracked file without leaking local overrides;--sharedis rejected forcore/tracing, which stay personal-only.defaults.harness/successMode,benchmarks,harnesses,providers,verifier,campaign) only apply when their env twin is unset;EVAL_SUCCESS_MODEandSTAGEHAND_BROWSER_TARGETbeat the config by exception.config harnesses | providers | verifier | campaign;config path localprints the gitignored file.maxUnverifiableCriteriaaccepts 0), judge ids need provider and model segments,harnesses.<h>.modelsis rejected for harnesses that pick models per task category (e.g.stagehand), and a malformed localdefaultsfails loudly.build-climigrates pre-v2 personal edits fromdistinto the local file without pinning old defaults.Env and run header
loadEvalsEnv()replaces the two inlinedotenv.configcalls, loading cwd.envfirst, thenpackages/evals/.env, with shell exports always winning; it records provenance for the doctor.Written for commit 25519c2. Summary will update on new commits.