Skip to content

feat(benchmark): run benchmark suites as a default workflow - #1379

Closed
SaulMoro wants to merge 286 commits into
Tencent:mainfrom
SaulMoro:feat/1180-benchmark-suites
Closed

SaulMoro wants to merge 286 commits into
Tencent:mainfrom
SaulMoro:feat/1180-benchmark-suites

Conversation

@SaulMoro

@SaulMoro SaulMoro commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A team could not tell whether a tool, a model, its own assets or one of its workflows fixes its real tasks better. Now teamai benchmark run <suite> runs a suite from the team repo: every arm works the same tasks in fresh clones and is scored by a check it never sees. It is teamai's second default workflow, workflows/teamai-benchmark.yaml, which a team can replace, and the engine and drivers know nothing about benchmarks.

$ teamai benchmark run fix-auth --sandbox                       # local driver; done envelope on stdout, results on stderr
$ teamai benchmark run fix-auth --sandbox --member-aliases      # arm aliases from ~/.teamai/models/aliases.yaml over the team's
$ teamai benchmark run fix-auth --sandbox --fail-on-regression  # CI: also exit 1 when an arm dropped against teamai-reports
$ teamai benchmark try ../team/benchmarks/fix-auth/tasks/expired-token.yaml   # no agent, no run, no sandbox

An arm changes the tool, the model, the team assets or the workflow, and a matrix crosses them:

# benchmarks/fix-auth/suite.yaml
schemaVersion: v1alpha1
name: fix-auth
repo: https://github.com/acme/auth-service.git
defaults: { tool: claude, model: strong }
arms:
  - name: main                                    # the revision you pulled
  - name: next
    team: next                                    # a branch, tag or commit of the team repo
  - name: no-auth-tokens
    team: { without: [skills/auth-tokens] }       # the pulled revision without these team repo paths
  - name: plan-first
    workflow: plan-then-fix                       # a team workflow with inputs.task
repetitions: 3
timeout: 45m
parallel: 2                                       # 1 to 32 lanes; also bounded by workflows.max_parallel
trial: { timeout: 8m, budget: { tokens: 300000 } }
# benchmarks/onboarding-docs/suite.yaml: arms claude-pulled, claude-none, codex-pulled, codex-none
defaults: { tool: claude }
matrix:
  tool: [claude, codex]
  team: [pulled, none]
# benchmarks/fix-auth/tasks/expired-token.yaml
schemaVersion: v1alpha1
title: Reject expired refresh tokens
prompt: Refresh tokens past their expiry are still accepted. Fix it.
startingCommit: 3f2c9a7d1e0b4c6a8f5d2e1b0c9a8f7e6d5c4b3a
solutionCommit: 9a1d4e7c2b8f0a3d6e5c1b9f8a7d2e4c6b0a1f3e    # the reference solution: try passes there
check:
  run: npx vitest run test/auth/refresh.test.ts
  protect: ['test/**', 'package.json', 'package-lock.json']
  add:
    - test/auth/refresh.test.ts                                     # from solutionCommit; never in the agent's clone
    - { from: check-files/token.test.js, to: test/token.test.js }   # from the suite directory
source: { platform: claude-code, sessionId: 7c1e2b9a }    # provenance only

The default workflow, which a team's workflows/teamai-benchmark.yaml (or workflows/<ns>/teamai-benchmark.yaml) replaces, for example without strict:

schemaVersion: v1alpha1
name: teamai-benchmark
description: Run a benchmark suite. Every arm works the same tasks in fresh clones, judged by checks it never sees.
invoke: deny
inputs: { suite: string, aliases: string }
steps:
  - id: plan
    command: teamai benchmark plan "$SUITE" --aliases "$ALIASES"
    env: { SUITE: "{{ inputs.suite }}", ALIASES: "{{ inputs.aliases }}" }
    output: { definition: workflow, plan: json }
  - id: trials
    needs: [plan]
    workflow: { from: plan }
    requires: { isolation: sandbox, strict: true }
finally:
  - id: report
    command: teamai benchmark report
    output: { text: string, table: json }
outputs: { text: steps.report.outputs.text, table: steps.report.outputs.table }
teamai benchmark run fix-auth
├─ dry plan        the plan step's freeze, with no run: an invalid suite, an unresolvable ref or alias, a `without`
│                  path that changes nothing, a bad arm workflow, single-repo mode or user scope are refused, no run left
└─ workflow start teamai-benchmark --inputs '{"suite":"fix-auth","aliases":"team"}' --timeout 45m
   ├─ plan         teamai benchmark plan: freezes the team revision, aliases and scorers; fills the commit cache;
   │               prints one step per baseline and per trial
   ├─ trials       workflow: { from: plan }
   │  ├─ baselines.<task>                   clone → setup → teamai benchmark check --baseline
   │  └─ lane<k>.r<rep>.<task>.<arm>        clone + team install → setup → prompt or arm workflow → teamai benchmark check --trial
   └─ finally      teamai benchmark report: table, pairs, benchmark record (run directory, and teamai-reports with usage reporting on)
teamai benchmark run exits When
0 The run succeeded, whatever the trials scored; also when the record is still pending, and with --fail-on-regression when nothing comparable is published (with a notice)
1 The run failed, was cancelled or timed out (as workflow start); report failed or was cancelled; --fail-on-regression found an arm whose paired drop has its whole 95% interval below zero

The dashboard's Benchmarks page. These screenshots are from this PR's earlier revision; since then Compare also pairs arms that differ only in workflow, a without arm lists its paths, and the empty page suggests teamai benchmark run.

Compare: how much the team's assets add, trial by trial (onboarding-docs, a seeded workspace).

Compare tab: pulled team against no team assets

Team changes: one tool and model across the team revisions it ran on, with the files each changed.

Team changes tab: claude on three team revisions

Arms: every arm over time, as before.

Arms tab, fix-auth

Question Tab, panel What it showed
How much do our assets help on onboarding docs? Compare, by Team assets claude +41 pp · 95% +16 pp to +59 pp over 27 paired trials, −60% cost per passed trial
Do they help codex as much? Compare, Difference per pair of arms +15 pp, interval crosses zero: not separated
Did the auth-tokens skill help claude? Team changes 67%, 62%, 70% over three revisions, none told apart; 67ee2ce changed 3 files, session-fixation 1/12 to 3/12
Switch our auth fixes to claude? Arms, Leading arm claude 67% · 95% 57%–75% · not separated from codex
Which model is worth paying for on migrate-db? Arms, Pass rate against cost sonnet 73% at 0.31 USD a trial, opus 78% at 0.89 USD; the frontier joins haiku, sonnet, opus
Light theme, Cost axis, zh-CN, tablet and phone

Compare, light

Team changes, light

migrate-db, pass rate against cost per trial

Arms, zh-CN

Compare, tablet Team changes, tablet Compare, phone Team changes, phone Arms, phone
Generic workflow keys this adds, usable by any workflow
Key Contract
workflow: { from: <step> } Runs the definition a needed step printed; admitted when that step reports. A bundle may not hold from or prompt_file steps; a refused admission fails the producer invalid_output. A run with a from step is isolated
output types workflow, json A workflow bundle to admit; opaque data passed on whole
finally: Top-level read-only command steps that run on any end but a crash; the outcome is kept; workflow cancel ends them
done.outputs The run's top-level outputs, resolved after finally
workflow start --timeout The shorter of the definition's timeout and the flag; the skill driver supports it too
workspace: { clone: { commit, repo?, team } } A fresh clone teamai prepares at lease, offline, with the team installed at a revision, none, a ref or { without: [paths] }
tool: Leased only to a driver that lists it in can.tools; tool_unavailable when no driver of an alone run can take it
permissions: unattended Prompt steps only, under a strict sandbox floor; leased only to can.unattended; tools without a supported mode fail tool_unavailable
model: { name, effort? } Exact, never alias-resolved
on_limit: end_turn timeout, max_turns, budget end the turn from tool launch and keep the work; on a workflow step, an allowance its prompt turns spend; drivers opt in with can.end_turn
requires: { …, strict: true } Strict floor for isolation and network; withholds the credential list under a strict sandbox; a local-only run that cannot meet it is refused at start
scorers: { sampling: all } Every pass judged; replaces the generated-only required
Isolated run A run that opens a clone: never published, claimed or retried, no session publication, snapshots or member stats; record isolated: true
A step's teamai A command step that runs teamai … gets the CLI that runs the step first on its PATH
Benchmark record

workflows/runs/<run id>/benchmark.json in the scope's data directory, and benchmarks/runs/<run id>.json on teamai-reports when usage reporting is on. The released BenchmarkRecord shape, field for field (limits, scoringCost, baselines, arm alias and source), plus schemaVersion: 1, run, outcome, teamaiVersion, startedAt, finishedAt, username?, workflow: { name, origin, sourceHash }, arms[].team (pulled | ref | without (paths) | none, with its revision), arms[].workflow?, trials[].agent?, trials[].used? (loaded | unknown per skill), complete on tokens and cost, and skillChanges. Pairs are derived from trials[] when read. No prompts, commands, credential URLs, local paths or hidden check bytes. The workflow run record drops benchmark and gains isolated.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature causing existing behavior to change)
  • Documentation only
  • Refactor / internal cleanup

Test Plan

  • npx tsc --noEmit passes
  • npm run lint passes
  • npx vitest run passes, except the GitLab request-deadline tests, which fail the same way on main on this machine
  • Added/updated tests for the change
npm run build                                     ok
npx tsc --noEmit                                  ok
npm run lint                                      ok
npx vitest run --shard=1/2                        10954 passed, 3 failed, 4 skipped
npx vitest run --shard=2/2                        8993 passed, 1 failed, 20 skipped
  the 4 failures: gitlab-mr-timeout, gitlab-org-timeout, gitlab-mr-create-timeout;
  gitlab-mr-timeout and gitlab-org-timeout fail the same way on main (254fb92db) here
npm run test:e2e -- src/__tests__/e2e/benchmark- src/__tests__/e2e/workflow-from src/__tests__/e2e/dashboard-workflow-runs
                                                  21 files, 159 passed
npm run test:e2e -- src/__tests__/e2e/workflow-conformance.test.ts -t "through the CLI as <profile> "
                                                  local 63, skill 53, skill-bare 53 passed

The two commits after that add tests only. On them: npm run test:e2e -- src/__tests__/e2e/benchmark- 19 files, 166 passed; npx vitest run src/__tests__/benchmark-history.test.ts 20 passed; tsc and lint ok.

Real-CLI e2e record

The built dist/index.js in a throwaway HOME, with a real Claude login and default Claude settings (no permission allow list). A team repo with one skill, answer; a project whose node test.js fails; a suite with one task and two arms, pulled and team: { without: [skills/answer] }.

$ teamai --version
0.22.0
$ claude --version
2.1.312 (Claude Code)
$ date -u
2026-10-30T12:51:41Z
$ teamai init https://github.com/acme/team.git --provider git --agent claude --scope workspace && teamai pull
$ teamai benchmark run fix --sandbox; echo "exit: $?"
| Arm             | Tool   | Model (source)      | Team                          | Planned | Passed | Error | Pass rate   |
| pulled          | claude | tool default (team) | pulled 930a93c                | 1       | 1      | 0     | 100% (1/1)  |
| no-answer-skill | claude | tool default (team) | 930a93c without skills/answer | 1       | 1      | 0     | 100% (1/1)  |

| Arm             | Skill  | Change  | Loaded in this arm | Loaded in the defaults arm |
| no-answer-skill | answer | removed | 0/1                | 1/1                        |
exit: 0

(Columns that were all 0 are left out above.)

  • Both trial transcripts show permissionMode: bypassPermissions, from permissions: unattended under the strict sandbox. This run is the record behind Claude's unattended: ✓v cell in src/tools.ts.
  • The record is published on teamai-reports as benchmarks/runs/<run id>.json, and no clone is left in TMPDIR.
  • Not run here: Codex, CodeBuddy and OpenCode with real models, the gitlab and github providers, and Windows (the .cmd wrapper of a step's teamai). The e2e suite covers them with fake tools; real runs are left to CI.
Issue criteria and the tests that cover them
Issue # Test
#1180 1 e2e/benchmark-pull, benchmark-suite
#1180 2 e2e/benchmark-local (eight trials)
#1180 3 e2e/benchmark-team-assets, e2e/benchmark-local
#1180 4 e2e/benchmark-env
#1180 5 e2e/benchmark-checks
#1180 6 e2e/benchmark-checks
#1180 7 e2e/benchmark-models
#1180 8 benchmark-table
#1180 9 e2e/benchmark-judges
#1180 10 e2e/benchmark-local, benchmark-table
#1180 11 e2e/benchmark-lifecycle, e2e/benchmark-judges, e2e/benchmark-skill-loads
#1180 12 e2e/benchmark-driver-contract, workflow-engine
#1180 13 e2e/benchmark-pull (review --branch), review-branch
#1180 14 e2e/benchmark-local, e2e/benchmark-run, benchmark-table
#1180 15 e2e/benchmark-run
#1180 16 e2e/benchmark-lifecycle, e2e/benchmark-local, workflow-records, e2e/benchmark-ci-job
#1180 17 e2e/benchmark-parallel
#1180 18 e2e/benchmark-fail-on-regression
#1180 19 e2e/benchmark-try
#1180 20 e2e/benchmark-team-arms, e2e/benchmark-local
#1180 21 e2e/benchmark-models
#1181 1 e2e/benchmark-team-arms
#1181 2 e2e/benchmark-team-arms (team branch, frozen models and scorers)
#1181 3 e2e/benchmark-team-arms (team remote out of reach)
#1181 4 e2e/benchmark-local, e2e/benchmark-team-arms
#1181 5 e2e/benchmark-team-assets (run ends, run cancelled halfway)
#1181 6 benchmark-table, e2e/benchmark-team-arms
#1181 7 e2e/benchmark-team-arms (team branch, frozen models and scorers)
#1181 8 e2e/benchmark-driver-contract (team branch)
#1181 9 benchmark-history (run pairs and history)
#1181 10 benchmark-history
#1181 11 e2e/benchmark-skill-loads
#1181 12 benchmark-suite, benchmark-history
#1181 13 e2e/benchmark-workflow-arms
#1181 14 e2e/benchmark-workflow-arms
#1181 15 e2e/benchmark-workflow-arms
#1181 16 benchmark-team-without, e2e/benchmark-team-arms, e2e/benchmark-pull (review --branch)
#1181 17 e2e/benchmark-workflow-arms
#1400 1-4, 6 e2e/benchmark-limits, benchmark-table
#1400 5 review-branch, e2e/benchmark-pull
#1400 7 benchmark-suite, e2e/benchmark-local
#1401 1-4, 6 e2e/benchmark-checks, benchmark-suite
#1401 5 e2e/benchmark-pull (review --branch and run), review-branch, benchmark-suite
#1401 7 benchmark-suite, e2e/benchmark-local

Paths are under src/__tests__/.

Related Issues

Closes #1180, closes #1181, closes #1400, closes #1401. #1402 builds on teamai benchmark try, solutionCommit and check.add; #1469 on the generated scorer pins. Other features as default workflows: #1589.

Notes for Reviewers

  • Door: two-way for runs and the generic keys, which are additive. One-way for the suite and task schema, which is strict, so solutionCommit, check.add, trial, team (with without paths), matrix, arm workflow and parallel ship in this first release. workflow start --benchmark, --member-aliases and --try leave workflow start for teamai benchmark run|try|plan|check|report; they were never released.
  • Blast radius: the generic keys are opt-in, except what ordinary runs see:
    • prompts in different places now run in parallel up to workflows.max_parallel, as the guide already says;
    • a top-level run's outputs now reach done.outputs, including a null a step gave;
    • a command step that runs teamai … gets the running CLI first on its PATH.
    • teamai uninstall in a workspace whose hooks live in HOME now keeps HOME's built-in hooks while the user scope or another workspace on the machine still runs them, and removes only this workspace's team hooks.
  • Boundary: src/benchmark/ imports only src/workflow/'s public interface; the engine, protocol and drivers never import src/benchmark/. The teamai/workflow-boundaries lint rule fails closed on a new edge. The suites cache moved to src/benchmark/.
  • Changes since this PR's earlier revision:
    • A local benchmark without a sandbox is refused at start (requirement_unmet), where it used to print a notice, run every trial to not_run and exit 0.
    • A baseline's check.add files are written after setup, where they used to be written before. A run and teamai benchmark try share one order: clone, setup, restore check.protect (trial only), write check.add, check.
    • The error code benchmark_local is now isolated_run.
    • Where user scope also reaches the workspace, plan refuses every suite with team_ref_blocked and leaves no run (Q19), where trials used to settle not_run.
    • Benchmarks are refused in single-repo mode for every arm, with a benchmark-worded message.
    • --member-aliases stays on teamai benchmark run; the default workflow takes it as input aliases (team | member), and a team override without that input is refused under the flag.
    • Arm team: { without } takes team repo paths for any asset, namespaces included, in place of skill names. plan uses pull's resolvers and refuses a path that changes nothing: an inactive namespace, a shared path an active namespace replaces ("list X too"), a path tags leave out, a skill the member excludes, or nested paths. It is exact under skills/, rules/, agents/, claudemd/ and docs/; elsewhere a path only has to exist. An entry inside a shared file still needs a branch.
    • --fail-on-regression compares with the newest comparable record published on teamai-reports, leaving out this machine's pending queue, and exits 0 with a notice when there is none. parallel is 1 to 32, serial by default.
    • Arm workflows and a teamai-benchmark override resolve by namespace like any team workflow. Two active namespaces defining one name refuse at start with workflow_namespace_conflict.
    • Strict-sandbox trials run with permissions: unattended, including arm workflows. A team override without that floor keeps the tool's permission settings and reports it.
    • An arm workflow is refused at start when it takes an input besides task, has finally steps, runs workflow: { from }, or runs an agent while the arm sets no model (set model in the suite's defaults).
    • Every step in a clone gets back the team assets installed for it before it runs, so a continue step after another one sees them. A benchmark installs them for the arm's tool, through the new workspace.clone.team.selection.enabledAgents, even when the arm's workflow starts with a command.
    • A workflow arm's trial is classified by the steps its workflow ran: not_run when the tool could not launch, even after a first command ran, and error once a prompt was leased or the trial was cancelled after a lease, including an earlier loop pass.
    • A failed isolated run prints the command that starts a new run, with its --inputs.
  • Hand-back: a lease handed back to the same driver gets its grants from that driver's current can; its deadline, and an end_turn timeoutMs, count from the first lease, so a restart never extends a step.
  • Accepted risk: a turn lost to a driver restart is not charged to a workflow step's allowance. Each prompt's own lease is still capped from leasedAt, so the overrun is at most one prompt timeout per prompt.
  • External drivers: a benchmark needs TEAMAI_WORKFLOW_ATTEMPT from the lease env for its command steps, clone in can.workspace, can.env: true and can.isolation: sandbox for the strict sandbox, can.setup, can.unattended for unattended prompts, can.end_turn for trial limits, the arm's tool in can.tools, and the lease workspace as cwd.
  • Known limit: the skill driver's suggested start commands do not carry --timeout.
  • Departs from the issues: [feat] Run benchmark suites as workflows #1180 and [feat] Compare team asset sets in benchmarks #1181 are rewritten to this surface (original [feat] Run benchmark suites as workflows #1180 text kept in a comment). In [feat] Compare team asset sets in benchmarks #1181, pairs are any two arms that differ in exactly one of team, tool, model and workflow, not each arm against the defaults arm; the Compare tab and outputs.table.pairs carry the interval, and no arm is recommended. Skill loads are shown against the suite's defaults arm.
  • Start reading at workflows/teamai-benchmark.yaml, then src/benchmark/ (start, plan, trial, report, team-without), then the generic keys in src/workflow/.

@SaulMoro
SaulMoro force-pushed the feat/1180-benchmark-suites branch from 5959410 to 824495b Compare October 25, 2026 10:27
@SaulMoro SaulMoro assigned jeff-r2026 and unassigned jeff-r2026 Oct 25, 2026
@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Protected submodules can supply modified checks — src/workflow/benchmark/trial.ts:732. If setup initializes a tests submodule and the task uses protect: [tests], an agent can replace tests/check.js with an unconditional success. The superproject’s clean/checkout-index operations do not restore the submodule’s contents, and holds() accepts any directory for mode 160000. The modified check can therefore mark an unchanged, broken implementation passed. Reject protected gitlinks or restore and verify their contents recursively.

The PR description documents sufficient testing: it includes a built real-CLI verification record and representative E2E results. Deferred provider/agent coverage is not blocking.

Reviewed only the specified diff; ran no PR code.

@github-actions

Copy link
Copy Markdown
  • [P1 blocking] Normalize protected paths before checking submodules — src/workflow/benchmark/trial.ts:713. protect: ["./tests/check.js"] is accepted, but reachesInto() compares the initial . with tests and returns false. If setup initializes a tests submodule, the superproject’s listing and cleanup do not restore that nested file. An agent can replace it with unconditional success and receive passed without fixing the implementation. Normalize or reject dot components before matching.

  • [P1 blocking] Enforce the suite deadline during local tool execution — src/workflow/local-driver.ts:1054. The adapter receives only a signal triggered by terminal signals; lease.expiresAt is unused. With timeout: 30s and a hung tool, the driver remains awaiting adapter.run() and never calls next to reconcile the timeout, leaving the run and clone active indefinitely. Abort the launch at the lease deadline and reconcile afterward.

The earlier exact protect: [tests] submodule case is fixed; the dot-prefixed nested-path bypass above remains.

The PR description documents sufficient testing, including a built real-CLI run. Deferred provider/agent coverage is not blocking.

Reviewed only the specified diff; ran no PR code, builds, or installs.

@SaulMoro SaulMoro assigned jeff-r2026 and unassigned jeff-r2026 Oct 25, 2026
@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Update the timeout guidance — docs/guide/benchmarks.md:83 and docs/guide/zh-CN/benchmarks.md:83 still say running tools finish first and hung trials block until CI kills them. The local driver now aborts tools at the suite deadline and records the interrupted trial as error. Update both timeout bullets to match.

  • [P3 nit] Escaped globs bypass the submodule guard — src/workflow/benchmark/trial.ts:717. The accepted glob protect: ['te\sts/**'] matches tests/** in Git, but reachesInto() treats the backslash literally and misses a tests submodule. With that unusual spelling and an initialized submodule, modified checks remain unrestored and can yield a false passed. Reject backslashes or handle Git’s glob escaping.

Earlier findings: The exact-submodule case, dot-prefixed path bypass, and local-tool deadline omission are resolved in the current diff.

Testing: The PR description documents sufficient testing, including a built real-CLI run. Deferred provider/agent coverage is not blocking.

Reviewed only the specified diff; ran no PR code, builds, or installs.

@SaulMoro SaulMoro assigned jeff-r2026 and unassigned jeff-r2026 Oct 25, 2026
@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Apply the suite deadline to trial installation — src/workflow/benchmark/trial.ts:547. The installation subprocess uses a fixed ten-minute timeout rather than lease.expiresAt. If a 30s suite expires during a slow installation, next --prepare keeps awaiting it, delaying reconciliation, clone cleanup and the results table. Bound installation by the remaining suite time and propagate cancellation.

Earlier findings: All are resolved: protected-submodule handling, dot-prefixed paths, escaped globs, local-tool deadlines, and both languages’ timeout guidance.

Testing: The PR description includes sufficient built real-CLI verification. Deferred provider/agent coverage is not blocking.

Reviewed only the specified diff; ran no PR code, builds or installs.

@SaulMoro
SaulMoro force-pushed the feat/1180-benchmark-suites branch from 621a620 to 79b2e12 Compare October 25, 2026 22:22
@SaulMoro
SaulMoro force-pushed the feat/1180-benchmark-suites branch from e3d7f4a to f7a7737 Compare October 26, 2026 05:04
@SaulMoro
SaulMoro marked this pull request as ready for review October 26, 2026 06:29
@github-actions

Copy link
Copy Markdown
  • [P2 non-blocking] Apply the suite deadline to judging — src/workflow/scoring.ts:1165. With a 30s suite and a slow judge, the local driver awaits judgeLease() without passing the suite deadline, so it cannot call next to reconcile the timeout or print final results until judging finishes. Bound judging by the remaining suite time.

  • [P2 non-blocking] Handle malformed glob classes during validation — src/workflow/benchmark/suite.ts:112. A task with protect: ['test/['], add: ['test/check.js'] and a valid source.fix throws from new RegExp() inside the Zod transform. This interrupts suite validation instead of producing a per-file diagnostic. Validate the pattern or handle the regex error.

Earlier findings: All are resolved in the current diff, including the protected-submodule bypasses, local-tool deadline, bilingual timeout guidance and installation deadline.

Testing: The PR description documents sufficient built real-CLI verification. Deferred provider/agent coverage is not blocking.

Reviewed only the specified diff; ran no PR code, builds or installs.

@github-actions

Copy link
Copy Markdown

No new confident findings in the current diff.

Earlier findings: All are resolved, including the protected-submodule bypasses, local-tool deadline, bilingual timeout guidance, installation deadline, judging deadline, and malformed-glob validation crash.

Testing: The PR description documents sufficient testing, including built real-CLI verification. Coverage deferred to CI is not blocking.

Reviewed only the specified diff against the trusted base review criteria. Ran no PR code, builds, tests, or installs.

@STiFLeR7 STiFLeR7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary. Adds --benchmark to teamai workflow start: runs YAML-defined benchmark suites (tasks with a starting commit, an optional known-good fix, and a check or success-criteria judge) across tool/model "arms" and repetitions, each trial in an isolated clone with secrets stripped and git hooks/filters/fsmonitor neutered, scored and tabulated. Adds --try to validate one task file's check against its starting commit and fix before it joins a suite. Rebased on #1304, closes #1180.

Verified.

  • Secret stripping genuinely happens before any tool/driver launch and can't be reintroduced by a step's requires.env: negotiate() (src/workflow/requirements.ts:272-276) filters a step's requires.env to exclude every name in the trial's withhold list (stripped) before building the granted lease's envScope.provide — so provide and withhold are disjoint by construction, not just by call order in stepEnvironment (src/env-exec.ts:347-360). TRIAL_WITHHELD_ENV (terms.ts:24-26) is threaded into the plan, prompt/setup scope, and --try. Confirmed by reading e2e/benchmark-env.test.ts in full: none of the withheld names appear in setup/tool/check env even when the team env declares them, and no git hook/fsmonitor/clean filter in the clone sees them either.
  • Isolation is real: freshClone (trial.ts:482-504) git inits a fresh repo, fetches only startingCommit by SHA (never a branch ref) from the run's checkout or a commit cache, and detaches HEAD there — no git remote add is ever called, and a SHA-only fetch cannot pull descendant commits, so the fix commit is never reachable in the trial's clone during the prompt phase. check.add/restoreProtected only write fix-derived bytes in after the prompt's report is already committed, i.e. after the agent's tool process has exited.
  • check.add/source.fix verification is real, not a naive copy: writeAdded (trial.ts:799-823) and restoreProtected (trial.ts:699-751) read the source commit into a private index via read-tree, write with checkout-index --stdin, and verify every written path byte-for-byte against the commit's blob hash via holds() (trial.ts:840-853), including the executable bit and symlink-vs-file kind. Submodule paths are explicitly refused.
  • Path traversal is blocked at the schema level: RepoPathSchema (suite.ts:30-33) rejects empty/./.. segments, backslashes, and a leading :. check.add paths must additionally fall under a check.protect glob.
  • The per-copy lock genuinely serializes prepare/report/check/sweep on the same trial copy without serializing across different trials — confirmed via e2e/benchmark-trial-copy.test.ts (a second concurrent next --prepare gets busy rather than a corrupted/double clone; a killed report can be retried cleanly).
  • Judge-at-timeout doesn't double-score (e2e/benchmark-judges.test.ts: exactly one judge launch, run ends timeout, trial unscored); "Not logged in" doesn't corrupt subsequent trials (verified both by the PR's real-CLI evidence and the general error path in takePrompt/settle).
  • Spot-checked 3 of the Evidence table's test-file references against their actual bodies (benchmark-env.test.ts, benchmark-checks.test.ts, benchmark-judges.test.ts) — all three test exactly what their row claims, including several of the listed adversarial cases.
  • npx tsc --noEmit and npx oxlint --type-aware --deny-warnings --report-unused-disable-directives both ran clean on this branch.

Findings. None I can back with a concrete failure scenario or a cited rule violation. I specifically looked for races in the per-copy lock, double-scoring at judge timeout, "Not logged in" corrupting later trials, and path traversal via check.protect/check.add — all are handled and tested.

Not covered / unverified.

  • Could not execute npm run build or vitest myself in my environment (a sandbox policy against running an unreviewed PR's own code) — static tsc/oxlint are clean, but I don't have independent confirmation of the claimed 578 files, 16565 passed / 383 passed e2e numbers beyond reading the relevant test sources directly.
  • Didn't re-audit the pre-existing, unmodified src/update.ts file-lock internals (acquireLock/releaseLock) — treated as trusted existing infrastructure since this PR doesn't touch it.
  • Didn't review the other ~110 changed files outside src/workflow/benchmark/*.ts (pull/review/doctor wiring, dashboard, docs) at the same depth — focused the time on the new module and its safety-critical claims.
  • TRIAL_WITHHELD_ENV only covers git/CI credential-shaped names, not generic cloud credentials (AWS_*, NPM_TOKEN, etc.). Looks like a deliberate scope choice per terms.ts's own comment ("credentials a trial could push, publish or authenticate with") rather than an oversight — flagging it as a question rather than a finding, in case it's worth widening in a follow-up.

Verdict. Comment (approve-leaning, no blocking findings). The two most safety-critical claims — the secret-strip-wins-over-requires.env guarantee and the no-remote/ancestors-only clone isolation — both check out at the actual git-plumbing and negotiation-logic level, not just by the PR description, and the adversarial test cases listed genuinely exist and test what they claim.

@SaulMoro

Copy link
Copy Markdown
Collaborator Author

@STiFLeR7 thanks for the thorough review. You found nothing blocking, so could you approve it?

@STiFLeR7 STiFLeR7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed — nothing blocking. Approving.

…in the usage columns

A trial whose passes did not all state their tokens or cost records what
the others stated, with complete: false. usageOf ignored that flag: the
token median took the partial total as the trial's, and the cost total
counted it as known. Such a trial now counts as one that stated none:
it leaves the token median, and makes the cost total incomplete, as a
trial with no cost already did. The table, history and dashboard all
read usageOf.

Tested: benchmark-table case for a trial with one pass stating 80 + 20
tokens and one stating none (red: median 53 of 2 and cost known, then
green), benchmark and dashboard unit tests, full unit suite (4 tests
failed under load and pass alone), benchmark-run, dashboard-workflow-runs
and benchmark-lifecycle e2e.
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
  • [P2 non-blocking] Reject or support regression checking with the skill driver — src/workflow-commands.ts:948. benchmark run <suite> --driver skill --fail-on-regression accepts the flag, but startWorkflow() returns no result on the skill path, so this return always skips failOnRegression(). The flag is neither propagated nor persisted for completion. Reject this combination explicitly, or carry the regression check into skill-run completion.

Earlier findings: Resolved, including the latest literal-closing-bracket glob issue.

Testing: The description documents sufficient built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only 0af232c...25ce3c1 against the checked-out base criteria. Ran no PR code, builds, tests, or installs.

With --driver skill, benchmark run hands the run to the coding session
and returns before it ends, so --fail-on-regression was accepted and
never checked. The command now refuses the combination before planning,
with invalid_arguments, and the flag's help and the guide say it needs
the local driver.

Tested: benchmark-fail-on-regression e2e case (red: it reached the
start, then green; no run created), the rest of that file.
…stated input and output, and its duration only when every pass stated one

A pass with a tokens object but no input made a trial's total complete,
its unknown input taken as 0, and a pass with no duration added nothing
to a known trial duration. Now a trial's tokens are complete only when
every pass stated input and output, so the usage median leaves out a
partial total, and a trial has a duration only when every launched pass
stated one.

Tested: benchmark-table case for a workflow arm trial with a looped
prompt, one pass at 80 + 20 tokens and 1000 ms, one with 10 output
tokens and no duration (red: complete true, then green), benchmark,
dashboard and workflow-records unit tests.
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

  • Earlier findings: Resolved, including the latest --driver skill --fail-on-regression issue: the combination is explicitly rejected before creating a run.
  • Testing: The PR description documents sufficient testing, including built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only 0af232c...18ce9cbb against the checked-out base review criteria. Ran no PR code, builds, tests, or installs.

hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

  • Earlier findings: Resolved, including the latest --driver skill --fail-on-regression issue: the combination is explicitly rejected before creating a run.
  • Testing: The PR description documents sufficient testing, including built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only 3881fdc6...fce73fb5 against the checked-out base review criteria. Ran no PR code, builds, tests, or installs.

A tool a trial starts in its clone keeps the member's HOME, while the
clone's install is written under the clone's root. Config detection
looked up the partition under the member's HOME, so a Codex session hook
in the clone delivered no team rules, and teamai pull there found no
workspace.

Detection now uses the clone's install partition when the attempt marker
names a step whose clone is the workspace. A pull started there also runs
with the clone's install home, as that install's own pull did, so it
writes nothing into the member's tool homes. Without the marker, or
outside that clone, nothing changes.

Tested with an e2e that drives a Codex trial and, from a subdirectory of
its clone, runs the session-start hook and teamai pull: the hook returns
the clone's rules, pull reports the pinned workspace, and the member's
checkout, pull records and Claude and Codex homes are unchanged. It
failed before the change (no hook output), and with detection fixed but
not the pull home it failed on a new ~/.codex/hooks.json.
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

  • Earlier findings: Resolved, including the explicit rejection of --driver skill --fail-on-regression. The previously fixed protection, deadline, validation, scheduling, and workflow-arm issues remain addressed.
  • Testing: The PR description documents sufficient testing: built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only 3881fdc6...0b63e930 against the checked-out base review criteria. Ran no PR code, builds, tests, or installs.

…nstall's home

Only pull moved to the clone install's home, so other commands a step
started in its clone still wrote into the member's home: the trial's
session hooks recorded its sessions in the member's local dashboard.

The home switch now happens first in the preAction hook, for every
command: when the attempt marker names a step whose clone is the
workspace, teamai's own home becomes the clone install's for the rest of
the process. It moves no environment variable, so the processes teamai
starts, such as the trial's check, keep the member's HOME. Runs are
still found under the member's home, and contribute records a learning
on the step's run instead of in the clone install's scope, which holds
no run. A path check skips the run lookup for any command outside a
clone, so hooks elsewhere pay nothing.

Tested with e2e on a Codex trial's clone: the session-start hook returns
the clone's rules, pull reports the pinned workspace, and the member's
checkout, pull records, Claude and Codex homes and local dashboard are
unchanged (failed before, on a session_start event in the member's
dashboard); a learning contributed in the clone lands on the trial's
step (failed before: no such run); a trial's check sees the member's
HOME (fails when the switch also moves HOME).
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
  • [P2 non-blocking] Reject copy-opening fan-outs during arm preflight — src/benchmark/arm-workflow.ts:145. A workflow arm containing a for_each workflow step with workspace: continue passes this guard. That combination opens per-item copies, so its child prompts fail with workspace_base inside the trial’s clone. Reject it before creating the run, or support its workspace semantics.

  • [P2 non-blocking] Use the current lease’s withheld environment for clone observation — src/workflow/place/clone.ts:272. If a non-strict command opens the clone before a strict-sandbox prompt, cloneHead() retains the first command’s withholding list. Its pre-launch git status can therefore pass GH_TOKEN to a configured clean filter despite the prompt’s lease withholding it. Apply the current lease’s environment restrictions.

Earlier findings: Resolved in the current diff; not raised again.

Testing: The description documents sufficient built real-CLI verification and representative E2E results. Coverage deferred to CI is not blocking.

Reviewed only the specified three-dot diff against the trusted base criteria. Ran no PR code, builds, tests, or installs.

…clone's head as the current lease withholds

A workflow arm with a for_each workflow step under workspace: continue
passed the arm preflight, but each item's steps open a copy of the
trial's clone, which a clone place has none of, so its prompts failed
with workspace_base. Start now refuses it with arm_workflow_unrunnable,
like the other steps a trial cannot run.

The local driver read a clone's head before a prompt with the names the
lease that opened the clone withheld. A command without a strict sandbox
that opened it left a later strict prompt's git status, and any filter
configured there, with GH_TOKEN. cloneHead now takes the current lease's
withhold list and deadline, and git runs without both lists.

Tested: e2e benchmark-workflow-arms refuses the for_each arm before any
run (failed before: the run started); a unit test reads a clone's head
with the current lease's GH_TOKEN withheld while the opening lease
withheld nothing (with the receipt's list only, git saw the token).
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

  • Earlier findings: Resolved, including copy-opening fan-out preflight rejection and use of the current lease’s withheld environment for clone observation.
  • Testing: The PR description documents sufficient testing: built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only 02b8e9f...973895c against the trusted base review criteria. Ran no PR code, builds, tests, or installs.

…uites

# Conflicts:
#	scripts/doc-checks/readme-matrix.ts
#	src/tool-home.ts
#	src/workflow/drivers/skill/child-model.ts
…uites

# Conflicts:
#	docs/guide/dashboard.md
#	docs/guide/zh-CN/dashboard.md
#	src/dashboard/client.ts
hz89Dev added a commit to hz89Dev/teamai-cli that referenced this pull request Nov 2, 2026
…s solutionCommit

Tencent#1379 renamed the task field source.fix to a top-level solutionCommit. The
workflow's input follows it: fix becomes solution, the draft step writes
solutionCommit and keeps source to platform and sessionId, and describe's
duplicate check reads task.solutionCommit, so it also names a hand-written task
with no source. The guide's task example, CI job text and outcome table use the
solution wording and the messages benchmark try now prints, and the fixtures of
the session-to-task and task CI e2e tests write solutionCommit.
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

  • Earlier findings: Resolved, including copy-opening fan-out preflight rejection and applying the current lease’s withheld environment to clone observation. Previously fixed cases remain addressed.
  • Testing: The PR description documents sufficient testing: built real-CLI verification and representative E2E results. Provider, agent, and Windows coverage deferred to CI is not blocking.

Reviewed only a7c702d52927a152e66cd368901b5feb303bc60d...b3ffef8d6273d4bef18415e747f1bffd33251a61 against the checked-out base review criteria. Ran no PR code, builds, tests, or installs.

SaulMoro added a commit that referenced this pull request Nov 2, 2026
…a session's finished work as a benchmark task (#1658)

Run benchmark suites as a default workflow, and keep the work a session finished, whether a fix, a feature or a refactor, as a benchmark task. `teamai-session-to-task` proposes the starting commit, the solution commit and the suite. `teamai push --file --path` proposes one file to the team repo as a pull request. This lands #1379 together with this change.

Closes #1180, closes #1181, closes #1400, closes #1401, closes #1402.

Co-authored-by: Saul Moro <[email protected]>
@SaulMoro

SaulMoro commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: #1658 was built on this branch's head (b3ffef8) and has merged as 8a84704, carrying every commit from here. The two are closely related, so they landed in one merge. Merging them one after the other would have meant another round of conflicts. #1658 closed #1180, #1181, #1400 and #1401 with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants