Skip to content

feat(workflow): keep a session's finished work as a benchmark task (after #1379) - #1658

Merged
SaulMoro merged 306 commits into
Tencent:mainfrom
hz89Dev:feat/1402-session-to-task
Nov 2, 2026
Merged

SaulMoro merged 306 commits into
Tencent:mainfrom
hz89Dev:feat/1402-session-to-task

Conversation

@hz89Dev

@hz89Dev hz89Dev commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Work finished with an agent, a bug fix, a feature or a refactor, is the best benchmark task a team can get, but turning it into one meant finding the starting commit, the commit that completes it, the suite and the test by hand. Now you tell the session that did it "turn this fix into a benchmark task" or "keep this feature as a benchmark task", and the default workflow teamai-session-to-task proposes the commits and the suite, drafts the task with you, and proposes it to the team repo as a pull request with one file.

Includes #1379 (benchmark suites), and lands both in one merge: they are closely related, and merging them separately would mean another round of conflicts. This PR carries #1379's commits up to its head b3ffef8 and adds 20 on top. One of them fixes a token-meter bug in #1379's code that review of this PR found (last note below).

you:    turn this fix into a benchmark task
agent:  teamai workflow start --describe teamai-session-to-task --driver skill
        proposes session 7c1e…, source claude-code, suite benchmarks/fix-auth,
                 start 3f2c9a7…, solution 9a1d4e7…
agent:  drafts benchmarks/fix-auth/tasks/refresh-race.yaml with you
agent:  Propose benchmarks/fix-auth/tasks/refresh-race.yaml to the team as a pull request?
you:    yes
step:   teamai push --file /tmp/refresh-race.yaml --path benchmarks/fix-auth/tasks/refresh-race.yaml
        ✔ Pull Request created: https://github.com/acme/team/pull/77

What moved:

 workflows/
+└── teamai-session-to-task.yaml   # draft (interactive) → propose (optional approval) → push --file --path
 src/
+├── session-to-task.ts            # describe proposals: start, fix, suite, plus a duplicate-task note
 ├── workflow/drivers/skill/skill-driver.ts   # merges them beside SessionShare's
+├── push-file.ts                  # push exactly one file to one team path, as a PR
 ├── index.ts                      # push --file <local file> --path <team path>
 └── benchmark/suite-cache.ts      # listCachedSuites
 docs/guide/{benchmarks,workflow,sharing}.md (+ zh-CN)

What describe proposes, and when it proposes nothing (each input gets a why either way):

Input Proposed Not proposed when
session, source the calling session and its tool no agent session
start the commit the session's first session_start recorded tracked files were modified at start, or no start recorded
solution HEAD, the commit that completes the task: the fix, or the feature's or refactor's commit; the task keeps it as solutionCommit HEAD is still start, tracked files are modified, or no start
suite the one cached suite whose repo is origin (as configured or as insteadOf rewrites it) none or several match

When the suite already has a task from this session or this commit, the why of session and solution names it, so the agent can stop before a duplicate.

push --file --path builds the commit from the team repo's default branch on origin with a temporary index (read-tree, update-index --cacheinfo, commit-tree), so nothing else in the team clone, or in the project checkout in single-repo mode, joins the pull request. It refuses:

  • a path outside a team resource directory or with ..;
  • a benchmark path that is not benchmarks/[<namespace>/]<suite>/tasks/<task>.yaml, or whose suite has no suite.yaml;
  • a path through a symlink or a file, or one that names a directory;
  • --branch set to the default branch, or naming a branch origin has without an open pull request (its commits stay);
  • --skill, --role, --project, --shared, --all or --carried beside --path.

With --branch naming a branch whose pull request is open, it rebuilds that branch from the default branch with this file and a lease, and updates the pull request. A new file is executable when the local file is.

The benchmarks guide adds a team-repo CI job that runs teamai benchmark try on each added or changed task in a pull request. The e2e test reads that job from the guide and runs its script with bash, so the docs cannot drift from a working job.

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

Proven test-first: each behavior and each review fix started as a failing test, then the real built CLI ran the whole flow end to end.

  • npx tsc --noEmit passes (npm run typecheck)
  • npm run lint passes (oxlint and documentation checks)
  • npx vitest run passes: 658 files, 20472 tests passed, 24 skipped (before the review fixes; CI reruns it at the head)
  • Added/updated tests for the change

Real-CLI record. Each file runs dist/index.js after npm run build, against real git origins and a fake gh:

$ npm run build            # at 5f323091
$ npx vitest run -c vitest.e2e.config.ts src/__tests__/e2e/session-to-task-1402.test.ts \
    src/__tests__/e2e/push-file-path-1402.test.ts src/__tests__/e2e/benchmark-tasks-ci-1402.test.ts \
    src/__tests__/e2e/benchmark-ci-job.test.ts src/__tests__/e2e/assigned-roles-1186.test.ts \
    src/__tests__/e2e/local-agent-teardown-915.test.ts src/__tests__/source-ambiguous-foreign-claims-e2e.test.ts
 Test Files  7 passed (7)
      Tests  55 passed (55)

The last four existed before this PR. They list the skills pull delivers, now including teamai-session-to-task, or pick the suite's workflow out of the benchmarks guide, which now also shows the task CI job.

  • session-to-task-1402: a real Claude Code SessionStart hook records the start. describe proposes all five inputs, and the skill driver runs draft and propose with approval yes. The real push --file --path opens the pull request, and the guide's CI job passes on that pull request's branch.
  • push-file-path-1402 (20 cases) covers:
    • git mode: only the given file reaches the branch;
    • a skill file and a scorer;
    • --branch, updating an open pull request, and refusing a branch without one;
    • an executable script staying executable;
    • no changes;
    • 11 refusals, each checking that origin's main keeps its tip;
    • single-repo mode: .teamai/<path> lands, with the checkout's HEAD, index and files unchanged.
  • benchmark-tasks-ci-1402 (9 cases) covers:
    • pass with check.add, with an added test case, and with no add;
    • fail when the fix's test is not in add, when an add path is missing, or when the check passes without changes;
    • a renamed and changed task;
    • per-suite matrix entries;
    • a missing base branch fails instead of trying nothing.

Not run locally: Codex, CodeBuddy and OpenCode sessions, and GitLab/GitHub-hosted team repos. describe reads the same event fields for every tool, and the pull request goes through the existing createPrWithFallback; that matrix is left to CI.

Related Issues

Closes #1402. Closes #1180, closes #1181, closes #1400, closes #1401, the issues #1379 was going to close.

Notes for Reviewers

  • No new command. --file and --path are options on push, routed to src/push-file.ts before the existing push runs, so src/push.ts is unchanged.
  • The commit is built from the default branch with plumbing, not in a worktree. This keeps the pull request to one file, even in single-repo mode, where the team root is .teamai/ of the project checkout.
  • No dashboard change. A pr outcome would add a row kind to the published usage report and count toward delivered pull requests. The issue puts a results page out of scope.
  • The suite input's error message names "the suite's directory, such as benchmarks/frontend" rather than a teamai list benchmarks command, which does not exist.
  • The CI job uses git diff --name-only --no-renames --diff-filter=AM, assigned to a variable, so a renamed task is tried and a failing git diff fails the job instead of trying nothing.
  • Token meter (src/tool-launch/stdout.ts, from feat(benchmark): run benchmark suites as a default workflow #1379): Claude's message_delta states only output_tokens, and the meter replaced the message's usage with it, so input and cached tokens dropped out and a budget could be passed without stopping the run. The delta now merges into the message's usage; a budget case in workflow-local-tool-adapter.test.ts with output-only deltas timed out before the fix.
  • Not only bugs: the task format already takes any work (startingCommit, a check or successCriteria, and the completing commit in solutionCommit), so the workflow's description, draft prompt and whys speak of the work rather than the bug. The description is what an agent matches a request against. A refactor that keeps behavior gets successCriteria, since its tests pass before the change too and benchmark try would refuse a check. Its input is solution, after feat(benchmark): run benchmark suites as a default workflow #1379's solutionCommit, which replaced source.fix so a hand-written task can use check.add without a session.
  • scripts/check-docs.test.ts: the two cases that run the docs check three times get 30 s instead of the 15 s default. They take about 12 s on a CI runner and timed out on three slower Node 24 ubuntu runs of this branch. Their CPU time on Node 24 is the same with and without this PR (11.9-13.5 s against 11.9-12.3 s), and Node 20 and 22 runs of the same commits pass them in 9-13 s.
  • Claude's unattended: ✓v cell in src/tools.ts comes from feat(benchmark): run benchmark suites as a default workflow #1379, which records its run: Claude Code 2.1.312, 2026-10-30T12:51:41Z, teamai benchmark run fix --sandbox, with both trial transcripts at permissionMode: bypassPermissions from permissions: unattended (#1379's verification). This PR doesn't change src/tools.ts.

…w a tool across team revisions

The history pooled each arm on its own, so it could not say how much the team's assets added, or whether a change to them helped. It now lists, for the suite's current version, every two arms that differ only in their team assets, tool or model, pairs their trials by run, task and repetition, and gives the difference a 95% interval for paired proportions (Newcombe, method 10). It also pools each tool and model by the team revision it ran on, for the configurations that ran on more than one, and records each run's tool versions.

Tested: benchmark-history.test.ts covers the comparisons of a tool x team matrix, the paired interval against worked values, team revisions across runs and within one, and tool versions per run.
…one, with the files it changed

A team revision is a SHA in a run record. The Benchmarks API now reads each revision the selected suite ran on from this machine's team clone: its commit date and subject, and the files outside benchmarks/ it changed since the revision before it, relative to the team directory. The revisions are in commit order when the clone has every one, and in run order otherwise. What git answered is kept for the process, since a commit never changes; a revision the clone lacked is asked again, as a pull may bring it.

Tested: two cases in dashboard-benchmarks.test.ts, on a real team clone: revisions that ran newest first come back in commit order with their changed files, and one the clone lacks keeps its run order and no name.
…page

The Benchmarks page answered questions about tools and models. Two tabs beside the existing Arms panels now answer the questions about the team's own assets, under the same sidebar entry.

Compare picks a dimension (team assets, tool or model) and shows the chosen pair's difference with its interval, pass rate, cost per passed trial and tasks up or down; a forest plot of every pair; arrows from one arm to the other on pass rate against tokens, duration or cost; and each task's change. Team changes picks a tool and model and draws its pass rate per team revision in commit order, marking a revision told apart from the one before it; clicking one lists the team files it changed and each task's rate before and after. Pass rate per run also marks a tool update. Each tab explains, with a suite example, how to get data into it when it has none. The chosen tab is remembered, and every new label has its zh-CN text.

Tested: dashboard-ui checks every label has a zh-CN translation; dashboard-workflow-runs and dashboard-unified e2e pass; the tabs were checked at desktop, tablet and phone widths, dark and light, on a seeded workspace.
… changes tabs

Examples first: a suite with an arm on each kind of team assets, a tool x team matrix with the arms it makes, and the questions each new tab answered on a seeded workspace. English and zh-CN.
…team ref did not resolve

A record kept only the model each arm's alias resolved to, so claude and codex on alias strong had different models, and Compare never compared the tools of a suite that named a model, which is what the suite parser asks for when the tool varies. The plan and the record now keep the alias as alias, and two arms on one alias differ only in tool.

Start reported every failure to resolve an arm's team ref as no branch, tag or commit. It now names the team repo's branches when the ref is not one, and refuses with arm_team_unreadable, with git's message, when git could not read the team repo, also for a without arm whose skills git could not list.

Tested: a new case in benchmark-history.test.ts (two tools on alias strong compare by tool; codex on strong and fast by model) failed before the change; benchmark-models e2e checks the alias in the record, and benchmark-team-arms e2e the new message.
…ool ran on before

Team changes compared a revision with the one the chosen tool and model ran on before it, but listed the files changed since the revision before it among all, which another tool may have run alone. The API now returns teamDiffs by <before>..<after> for each two revisions a tool and model ran on in turn, and the panel reads the pair it shows.

Also: the twelve arms a matrix can make get twelve colours, a difference that rounds to zero prints 0 pp without a sign, a cost change from zero shows no percentage, and the change column and the told-apart tags have their zh-CN text.

Tested: a new case in dashboard-benchmarks.test.ts (claude on A and C, codex on B and C: A..C and B..C, not A..B) failed before the change; dashboard-ui passes.
Start looked for skills only at skills/<name>/SKILL.md, so an arm without a skill the team keeps under a role or project namespace, skills/<namespace>/<name>/, was refused though pull delivers it by that name. A skill's name is now the directory that holds its SKILL.md, at any depth under skills/.

Tested: a new benchmark-team-arms e2e case (without: [nested], with skills/dev/nested/SKILL.md) was refused before the change and runs with it.
…ials

Compare drew its arrows and its cost and token cards from each arm's pooled series, which also counts runs the other arm did not run, while its difference counted the paired trials only: the two could disagree. A comparison now carries each arm's usage over the paired trials, as the run table counts it, and the arrows and cards read its paired rates and usage. Cost per passed trial is the cost of those trials over the ones that passed, not the mean cost of a launched trial over the pass rate of planned ones, which inflated it when a trial never launched.

Tested: a new case in benchmark-history.test.ts (claude alone in one run, claude and codex in the next: the comparison's usage is the second run's) failed before the change; dashboard-ui passes, and the Compare tab was checked on a seeded workspace.
 asks

stepEnvironment now takes the team env's values and facts, so a provided key that lost its value gets the env add advice for an undeclared key. A trial's setup, check and pull pass the run's team env; a step environment that only withholds keys passes no team env, and --try the environment's keys as present.

Tested: tsc and lint clean; the benchmark e2e and unit suites run in the gates below.
…encent#1534 lets it fail init

initHttp no longer swallows a local agent setup that fails, and this file's fs mock has no readJson, so the case that checks a re-init keeps the member's workflow settings failed on the setup it does not test.

Tested: init.test.ts passes (85).
Benchmarks become a feature built on the workflow engine, so they get
their own top-level folder. A new boundary rule refuses any import from
src/workflow/ into src/benchmark/; today's 18 edges are allowlisted by
count and go away as benchmarks move onto the default workflow.

Proof: workflow-module-boundaries passes, and fails when one allowlist
entry is removed; tsc, lint and the unit suite (19224 tests) pass.
…ocal driver

The local driver held one prompt at a time, so a second prompt in a
worktree of its own waited for the first even with workflows.max_parallel
above 1, while commands in other places already ran beside each other.
Benchmark trials need the same driver loop to run their prompts, so the
generic loop gets the parallelism first.

The single prompt slot becomes a map keyed by attempt. A headless prompt
starts beside other attempts when its place is free and a slot is left,
in lease order; an interactive prompt still starts only once nothing else
runs and keeps the terminal alone. Cancels, signals, the done branch and
the final cleanup now reach every running prompt.

Proved by a new local-driver test: two prompts in worktrees of their own
overlap at max_parallel 2, and two prompts in the shared checkout do not.
The existing local-driver suite passes unchanged.
… cost

Only the benchmark loop measured a prompt: the generic loop's report had
no durationMs or cost, gave the tool no lease env, and left the git locks
a tool stopped at a limit holds. The local driver is to have one loop, so
the generic prompt report takes the benchmark loop's measures.

One helper, timedLaunch, now launches every local prompt: it times the
tool's run alone, turns a launch that throws into tool_failed, and once a
tool stopped at its timeout or budget is gone removes the locks git left
in its checkout. The prompt report carries durationMs for a tool that
started and the cost the tool stated, and the tool gets the lease env
over the step's environment, as a command does.

Proved by a new local-driver test: a prompt records its duration and cost,
and a tool that never started records no duration. The local-driver and
benchmark trials suites pass unchanged.
… delete driveBenchmarkRun

The local driver had two loops: driveRun for every workflow, and
driveBenchmarkRun, a serial loop only benchmark runs reached. Two loops
mean two places for every driver rule, and benchmarks are to become an
ordinary workflow on one driver system.

driveRun is now the only loop. A benchmark run reaches its own behaviour
through the existing Trials hooks at the points the deleted loop called
them: the notices and the crash sweep before the first next, Trials.next
for every lease (as the run's only driver, so a trial it cannot take is
not_run), Trials.report for a trial prompt, and the done table on stderr.
A trial prompt is launched by the trial rules, as before, and a tool still
running at the run's deadline is stopped without a report, so the next
next settles it as timed out. driveRun also judges a run's open required
entries itself whenever next waits on them, so a locally driven run never
waits on an outside teamai score --next. The driver handles stop signals
while it prepares or checks a trial or runs the judges, and a stop there
answers interrupted with the resume hint. Trials still run one at a time
by default, as workflows.max_parallel defaults to 1.

The local driver no longer imports the benchmark plan, so that allowlisted
edge is removed from the module boundary rule.

Proved by the benchmark judges e2e, which failed with busy waiting on
teamai score --next before the judge loop moved into driveRun and passes
after; every benchmark e2e file and the local-driver, benchmark trials
and module boundary suites pass unchanged.
A step's model is an alias or a model name that each driver resolves
through models/aliases.yaml for the tool it picks. A benchmark arm, and
any step that must run one model on one tool, needs the model it names
to reach the tool unchanged, never through an alias of the same name.

A prompt step's model may now be { name, effort? }, the exact model.
parseWorkflow reads it, the lease carries it, and the local driver
(chooseStepModel) and the skill driver (pickChildModel) pass it to the
tool as is, with no tool needed to resolve it, so describe no longer
counts it as a model a session's tool must resolve. A string model
keeps its alias semantics everywhere.

Proved by parseWorkflow tests for the exact form and its rejections, a
local driver run whose fake claude gets --model strong --effort max
while the team aliases map strong elsewhere, and skill driver runs that
start and dispatch an exact model in a session that names no tool.
…that lists it in can.tools

Which tool runs a prompt step was the driver's choice alone: --tools,
workflows.tools, TEAMAI_AI_TOOL, then ai.tool. A step that must run on
one tool, such as a benchmark trial, had no way to say so outside the
trial terms.

A prompt step may now name its tool (tool: codex). The lease carries it,
and negotiate holds the step, as `tools`, for a driver whose can.tools
does not list it; a driver that declares no can.tools keeps its
released behaviour and gets only steps without tool. The local driver
picks the step's tool before --tools, workflows.tools, TEAMAI_AI_TOOL
and ai.tool, and lists in can.tools the tools the run's steps name that
are on PATH here. It drives every run alone, so a step whose tool it
cannot launch fails tool_unavailable at once and stops only its own
scope, instead of waiting for a driver that never comes. The skill
host profiles declare no tools.

Proved by parseWorkflow tests for tool, protocol tests that lease a
tool step only to a driver listing it (with the tool and exact model on
the lease) and fail it tool_unavailable in an alone run while a sibling
is leased, and a local driver run that launches the step's tool over
--tools, workflows.tools and TEAMAI_AI_TOOL.
…odel, delete the trial tool, model and effort

A trial prompt carried its tool, model and effort in its trial terms, and
can.trials both chose which driver launched it and admitted the driver
to the suite's limits. Steps now name their tool and exact model
themselves, so trials no longer need terms of their own for either.

compilePlan writes the arm's tool and exact model on each trial prompt
step. The trial terms lose tool, model and effort, and trialTool goes
with them. The prepared trial lease names the tool and the exact model
at the top level, which the local driver and external drivers launch
with. can.tools now decides which trial prompts a driver gets; can.trials
only admits a driver to trials at all, until trial limits move onto the
lease. A trial prompt whose tool the local driver lacks fails
tool_unavailable, which the record reads as not_run, so the table, the
record and the one notice per arm stay as they were. The trial skip in
an alone run now covers only the sandbox, prepare and trials gates.
describe.ts no longer reads the benchmark terms, so its allowlisted
edge goes.

External drivers must list an arm's tool in can.tools to be leased its
trials; the benchmark tests' drivers now do.

Proved by the benchmark unit suites (the trial lease names its tool at
the top level; the alone run fails a trial prompt whose tool is missing
tool_unavailable), the full unit suite, and every benchmark e2e file
through the built CLI, including "tool missing" (the codex arm reads
not_run, its notice prints once, the run ends settled) and the model
e2e, whose arms run on the exact model the aliases named at start.
A benchmark trial gets its fresh clone from trial-only code. Any workflow
step should be able to ask for that place, so trials can become ordinary
steps and other workflows can run work away from the member's checkout.

A step may now write workspace: { clone: { commit, repo?, team } }. The
clone is a fresh clone of commit, taken from the run's checkout or the
commit cache, with its own git data, no remotes and hooks off; a team
other than none is installed under the clone's own HOME at the frozen
revision and selection. teamai prepares it at lease (next --prepare and
the local driver), every descendant continue step runs there, its work is
committed in the clone, the copy is recorded as kind clone, and a clone
whose steps all settled is swept. A driver that does not list clone in
can.workspace never gets such a step. A prompt in a clone sees the
clone's install, never the member's config.

Proved by a local-driver run of a workflow whose clone (team none) holds
two continue steps: both run in one clone at the commit with no remotes,
the second sees the first's file, the work is one commit on the clone's
branch, and the clone is gone once the run ends. parseWorkflow keeps a
clone place as written and refuses a short commit or team none with a
revision.
…tles

A clone is gone once its steps settle, so a judge that collects evidence
later finds the run's checkout, which never held the work, and closes
the entry evidence_empty.

A scored prompt in a clone now has its evidence collected from the clone
before its report settles it, and removed when the pass does not
succeed. A scored workflow step in a clone settles when the engine
advances past its last step, so its evidence is staged when the clone is
swept, before the clone goes. Both use one stageEvidence, generalised
from the trial's; a judge reads the staged copy for any step in a clone.
next --prepare now asks the engine with prepare set, which it did not
before, so a step in a clone reaches a driver that prepares through it.

Proved through next --prepare and report as an external driver, then
the first judge lease after the run ended: a scored prompt's evidence
and a scored workflow step's evidence both carry the range from the
clone's commit and the file the prompt wrote.
… trial preparation and sweep

Trials made, installed, committed and swept their own clones, with their
own receipts and copy locks, beside the clone place any workflow step
can now open. One mechanism should do it.

compilePlan now gives each trial's <arm> step, and each baseline step, a
clone place of the task's starting commit: the arm's team at its
revision and the run's selection, or no team for a baseline. Prompt
terms drop startingCommit, team and selection, which the place carries.
Trials.next runs under the run's lock and prepares each lease through
the place; it keeps the baseline and check commands, progress lines and
the team-ref blocker. Trials.report only completes a trial report with
what teamai observed of the clone; the caller settles it through the
place, which commits the clone and stages the judge evidence. A judge
reads staged evidence for any step in a clone.

Deleted: trial receipts and copy locks, the trial clone, install,
commit and evidence code, Trials.sweep, trialBase, teamRevisionOf. The
commit cache and fresh clone move to the clone place; the commit and
selection schemas to src/workflow/clone.ts.

The clone place gains what trials relied on: each clone prepared gets a
root of its own, an attempt prepared again gets a fresh clone when it
made the one it had, and a limit is dropped from a report whose work
could not be kept.

Public changes, with the tests that pin them: a step in a clone, a
trial or baseline included, goes only to a driver that lists clone in
can.workspace (Trials adds it for next --prepare); a baseline and prompt
lease carry workspace.clone instead of trial.startingCommit/team; two
concurrent next --prepare calls on a benchmark run answer
driver_running, not busy; clone roots live under teamai-clones.

Proved by the unit suites for workflow, benchmark and scorers, and all
14 benchmark e2e files on the built CLI.
A run whose steps work in clones on one machine cannot be handed to
another, retried or counted as a workflow outcome, but those policies
were keyed on the run being a benchmark.

A run is isolated when its definition, or a workflow it runs, opens a
clone, derived from the graph. Its start and end records say isolated:
true. publish and claim refuse it with isolated_run (was
benchmark_local), workflow retry refuses it, session publication skips
it, member stats leave it out, and the Scorers page shows no labels of
it. A benchmark record published before records said isolated still
counts as one. RunState.benchmark stays for what only a benchmark has.

Proved by a local-driver run of an ordinary workflow that opens a clone
(retry refused, claim refused isolated_run, end record isolated), the
full unit suite, and the benchmark lifecycle e2e pinning isolated_run
for publish and both claims.
The clone place and the isolated run were proved in process; a member
runs them through teamai workflow start and publish.

A team workflow opens a clone of the business repo's commit with no
team, and its continue step fails unless it runs at that commit with no
remotes. Started with --driver local it succeeds, leaves the member's
checkout and branches as they were, and workflow publish refuses the
run with isolated_run.

Proved by the workflow-publish-resume e2e file on the built CLI (13
passed).
…given up

A clone runs the setup command before its first step, a second prepare
of a created clone starts from a fresh clone, a commit the repo does not
have fails the step with clone_prepare_failed, and a continue step whose
clone is gone fails with workspace_base. The plan test now checks that
each arm opens its trials with the team the arm names, and the benchmark
fixture resolves arm teams instead of ignoring them.

Checked with tsc, lint, and the clone-place, plan, trials and
module-boundaries suites (63 passed).
…step

A driver that does not provide clones is held with workspace.clone
missing, a read-only step inside a clone fails as a clone has no reader
place, and a released clone is removed so the step is leased again in a
fresh one.

Checked with tsc, lint, and the clone-place suite (11 passed).
…runs no hooks

A released step that continues a clone gets the same clone back with the
work committed there, and a fresh clone points core.hooksPath at a
directory that does not exist, so no repository or global hook runs in it.

Both were mutants of the clone module that no test killed. Checked with
tsc, lint, and the clone-place suite (13 passed).
…e notes

The engine notes named Trials.report, withCopy and Trials.sweep as the
trial evidence contract; those are gone. They now say when the evidence of
a step in a clone is staged and removed, what a clone place is, and what
an isolated run refuses.
…, before the run is saved

A workflow step in a clone settles in the next that follows its last
step, and its evidence was staged only when the clone was swept after
that next. A judge lease taken in between, or by a plain next that
sweeps nothing, found no evidence and closed the entry evidence_empty,
and a dependent was leased before the evidence existed.

withRun now stages, under the run lock and before it saves, the
evidence of every workflow step the operation settled success in a
clone, so neither its judge entry nor a dependent is visible first. The
sweep no longer stages anything. A prompt's evidence was already staged
at its report.

Checked with tsc, lint, the full unit suite (19256 passed), the build,
and the benchmark and publish-resume e2e (15 files, 133 passed).
…puts in done

A run had no place for work that must happen however it ends, such as a report
or a cleanup, and the outputs its workflow declares never reached the caller.

A top-level `finally:` lists read-only command steps. When the run's steps end,
by any outcome other than a crash, the run keeps status `running` and holds
`finalizing: { outcome, end?, failure?, until }`, `until` ten minutes on; `next`
hands out the finally steps and the run's deadline is `until`. When they
settle, the run ends with the pending outcome, whatever they did. `done.outputs`
returns the declared outputs, read after finally, so they may read finally
steps; one whose step gave no value is absent. A failed or cancelled finally
step is listed in `done.finally`. The transition sits after the judge wait, so
judges settle before finally runs. `finalizing` is part of the run file and of
its published snapshot. Retry refuses a run in its finally phase and a finally
step.

Proved by a real-CLI test: a workflow whose only step fails ends `failed`, its
finally step wrote its file, and `done.outputs` carries the finally step's
output; the parse, engine, protocol, run-control, handoff and reconciliation
suites pass unchanged.
A `finally` step is a read-only command that runs when the run ends, so only
the run's own workflow can carry one, and a step that runs a workflow file
never runs that file's `finally`.

The parser now refuses a `finally` step with any key beyond id, needs, if,
command, env, output and timeout; `finally` on an inline workflow; a `finally`
step id that is also a step id; a `finally` step that reads the run's steps;
and a step that runs a workflow file which declares `finally`.

Proved through parseWorkflow: each rule has a case. The workflow-file case
failed before its rule existed; the key and id rules were removed once to see
their cases fail.
A member whose git rewrites the project's URL with url.<base>.insteadOf got no
suite proposed: describe compared each suite's repo with the rewritten URL
only. It now matches either the configured URL or the rewritten one.

Tested: session-to-task-describe.test.ts (mirror case, red before the fix),
and e2e/session-to-task-1402.test.ts: a Claude Code session's real
SessionStart hook, describe, the skill-driven run, teamai push --file --path
to a pull request, then the guide's CI job passing on that branch.
list workflows shows it as a default, and pull writes its skill as it does
teamai-share-session's.

Tested: status-list.test.ts, workflow-skills-discovery.test.ts.
…sing

bash ignores the exit status of a process substitution, so with the base
branch missing (a renamed default branch, a shallow checkout) the job tried
nothing and passed. The changed tasks are now read into a variable first,
whose failure stops the step.

Tested: e2e/benchmark-tasks-ci-1402.test.ts, both jobs with a missing base
branch (passed before, fail now).
…an open pull request

Review follow-ups for push --file --path:
- With --branch naming the branch of an open pull request, the branch is
  rebuilt from the default branch and force-pushed with a lease on the tip it
  had, and that pull request is updated instead of a second one failing to open.
- The CLI routes --file and --path to push-file directly, so push.ts and
  push-file.ts no longer import each other.
- --path is parsed once into its destination, with the task name rule taken
  from BENCHMARK_NAME; the unreachable containment catch is gone.
- A dry run hashes the file without writing an object.

describe's module is now session-to-task.ts (SessionToTask), its why texts are
whole sentences, and the share and task proposals are computed together.

Tested: e2e/push-file-path-1402.test.ts (update case red before), all new e2e
files (24 cases), session-to-task-describe.test.ts, npm run lint.
git diff reports a renamed task as R, so --diff-filter=AM skipped it even when the
rename also changed its check. --no-renames lists it as added. The CI e2e test now
renames a task and changes its check, and fails without the flag.
The lease push reached any branch origin already had, so --branch main put the file
straight on main, with no pull request to review it. The refusal runs before the
fetch. The e2e refusal table adds the row and now checks main's tip in every row.
… the suite CI test to its workflow

pull now generates teamai-session-to-task beside teamai-share-session, so the e2e
tests that list or skip the delivered skills name it too. The benchmarks guide now
shows the team repo's task CI job as well, so the suite CI job test picks its
workflow by leaving out the blocks headed .github/workflows/benchmark-tasks.yml,
which benchmark-tasks-ci-1402 tests.
…ge_delta states only output

The token meter replaced a message's usage with each message_delta's. A delta that
states only output_tokens, as Claude's stream does, dropped the input and cached
tokens of the message's start, so a budget counted 70 tokens for a run that used
110 and never stopped it. The delta now merges into the message's usage. The new
budget case timed out without the fix.
…ne place

proposeFile ran the symlink, regular-file and suite checks inline between the fetch
and the commit. placementAt now owns every check that needs the team repo's tree and
returns a placement or a refusal, beside destinationOf, which owns the ones that need
no repo. No behavior change: the 16 push --file --path e2e cases pass unchanged.
Selecting by content rather than by leaving out the task CI job's header keeps the
test on its workflow whatever other workflows the guide shows.
…s executable

--branch naming a branch that origin had without an open pull request rebuilt it
from the default branch, so its own commits were lost. The open pull request is now
looked up before anything is built, and a branch without one, or whose host cannot
say, is refused with exit 2 and left as it was.

A new file took mode 100644 whatever the local file's; it now takes 100755 when the
local file is executable. --all and --carried, which --file ignored, are refused
like --skill and --role, and a --path through a file in the team repo is refused
rather than failing in git update-index. sharing.md says that rebuilding an open
pull request's branch keeps only the file pushed last. Each new e2e case failed
before the change.
… not only a bug fix

The task format already takes any work: startingCommit, a check or successCriteria,
and the commit that completes it in source.fix. Only the wording tied
teamai-session-to-task to bugs, and its description is what an agent matches a
request against, so "keep this feature as a benchmark task" could miss it. The
description, the draft prompt and describe's why now speak of the work and the
commit that completes it. The guide adds a feature row, and a refactor row that
uses successCriteria because its tests pass before the change too.
…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.
They take about 12 s on a CI runner, against vitest's 15 s default, and timed out
on three Node 24 ubuntu runs of this branch whose whole job ran slower (810 s
against 650 s). CPU time of these cases on Node 24 is the same with and without
this branch's changes (11.9-13.5 s against 11.9-12.3 s), so the timeout, not the
docs, is what failed. The cases assert the same things.
… refuses

Since --path refuses --all and --carried, the flag table still said --all changes
nothing. Both languages now list them in the refused row.
@hz89Dev
hz89Dev force-pushed the feat/1402-session-to-task branch from 56139c5 to 5f32309 Compare November 2, 2026 11:15
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

No new confident findings in the specified diff.

Resolved

  • Existing-branch protection, partial Claude usage merging, and executable-file modes.
  • Incomplete-token median exclusion, per-pass token completeness, and partial-duration exclusion.
  • Claude unattended-support evidence includes the tool version, date, and command.

Testing: The description documents sufficient build and real-CLI verification at 5f323091: 7 files and 55 tests passed. Explicitly deferred provider/agent coverage is not blocking.

Review was read-only; no PR code was run, built, or installed.

@SaulMoro SaulMoro 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.

This was generated by AI during triage.

Re-checked at 5f32309 after the rebase onto #1379's head b3ffef8. This PR's own changes match the version approved at f84a377, apart from one context line from main. CI is green, and this run covers #1379's commits too. Merging this PR lands both #1379 and #1658, so it also closes #1180, #1181, #1400 and #1401.

@SaulMoro
SaulMoro merged commit 8a84704 into Tencent:main Nov 2, 2026
18 checks passed
SaulMoro pushed a commit that referenced this pull request Nov 3, 2026
…asset (#1684)

A task's covers names the team repo paths its work is expected to need, and the results answer, per covered path, whether an arm that runs without exactly that path passes less on the tasks that cover it, and no less on the others. Builds on #1658's benchmark engine and #1650's record used fields. Closes #1605.

- Each covered path gets a table: per task, passed without and with, and for a skill the routing values it loaded with (fit, missed, extra, idle, unknown), then the paired difference over the tasks that cover it and over the others, and passed when loaded / not loaded. Pure over the record, so published records answer without a rerun. The dashboard's Compare tab shows the same tables.
- plan reads what each arm receives at its own team revision, role and without paths, and refuses a covered path no arm receives, a namespace copy that stands in for it, and two covered skills of the same bare name. An arm whose clone does not receive a covered skill records no routing for it: the skill is absent, not missed.
- Docs en/zh: the covers task field and an Asset effect section.
- A handoff test that times out on macOS on main gets 60 s.

Original work by kittimzhe; review fixes pushed to the branch.
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