Repository navigation
[feat] Define the team revision once for run records, labels and snapshots #1163
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Parent: #818
Goal
Three issues publish a teamRevision, and none defines it:
- [feat] Add workflow scorers and recorded quality labels #1085 locked it in the label record ("which version of the rubric gave each label");
- [feat] Publish and resume complete workflow state across machines #1084 records it in the state snapshot;
- [feat] Add a Workflow Runs page to the dashboard #1088 shows it on the Workflow Runs page.
Define it once, capture it once, and publish it in the run record (#1083) so the other three read the same value.
The obvious answer is wrong
git rev-parse HEAD in the team repo at workflow start does not say what ran:
- A run executes the definition cached at
pull(src/workflow/cache.ts), not the files atHEAD. - When a newer version fails validation, the cache keeps the earlier valid one.
HEADthen holds a definition the run did not execute. - In self mode,
pullcan cache edits that were never committed, or committed and never pushed. No teammate can resolve such a commit. sourceHashalready identifies what ran exactly: the YAML plus its prompt files, with children combined (engine.ts,loadWorkflows). It is a hash, not something a person can open.
Definition
| Field | Meaning | When present |
|---|---|---|
teamRevision |
The team repo commit the cached definition came from | Only when that commit holds the workflow and prompt files byte for byte, and is reachable from a remote-tracking ref |
sourceHash |
What ran, exactly (already in the run state) | Always |
How the value is captured:
- At
pull,cache.tsstores the team repo commit of that pull in every entry it writes or confirms unchanged. It does this only when the entry's files have no changes and the commit is reachable from a remote-tracking ref. - An entry kept from an earlier pull keeps its earlier value, because its content is not at the current
HEAD. - A run has a
teamRevisionwhen its parent and every child workflow carry the same one. Otherwise it has none. Never guess one.
The run record publishes both fields in the start and end phases. #1085 applies the same rule to the scorer file, and #1084 and #1088 read it from the run.
Acceptance criteria
Checked against git, not against our own code:
- In a fresh clone of the team repo,
git cat-file -e <teamRevision>succeeds for every published value. git show <teamRevision>:workflows/<name>.yaml, hashed with its prompt files the waycache.tshashes them, equals the run'ssourceHashfor a run without children.- A workflow edited and pulled without a commit publishes
sourceHashand noteamRevision. The same happens when it is committed but not pushed. - A newer version that fails validation leaves the kept entry with its earlier
teamRevision, and a run of it publishes that earlier value. - A parent and a child cached at different commits produce a run with no
teamRevision. - A record published before this change still parses and merges, and a record with the new fields parses with today's
WorkflowRunRecordreader. - Over the published records,
jq -r '[.run, .sourceHash, (.teamRevision // "-")] | @tsv' workflows/runs/*.jsononteamai-reportsgroups runs of the same definitions under onesourceHash, and names the commit when there is one.
Test plan
- Unit tests in
cache.tsfor each case above, with a real git repo and a bare origin. That is cheaper than mocking git. - Extend the e2e
workflow-records-reports-branch-1083.test.ts: readteamRevisionfrom the record on origin, then run criteria 1 and 2 against the fixture's clone. - One real-CLI run for the PR body:
teamai pull, thenteamai workflow start <name> --driver local, then criteria 1 and 2 checked on a fresh clone.
Watch out for
- The run lock forbids network I/O. Reading a remote-tracking ref is local; never fetch inside
pull's cache step for this. docs/guide/workflow.mdand its zh-CN page: add both fields to the "Run records" list.- feat(workflow): bounded loops, parallel for_each and list expressions #1148 (for [feat] Add bounded loops and parallel for_each #1079) rewrites
cache.tsandrecords.ts. Start after it merges, or rebase onto it.
Out of scope
The CI job URL (until a reader needs it) and PR URLs (#1090 publishes delivered PRs).
Dependencies
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
SaulMoro commentedon Oct 16, 2026
One detail for the published value: name the team commit in full. Pull keeps its revision short (
getHeadRevrunsrev-parse --short,utils/git.ts:283). #1176'sagent.team.revisionand #1180'sbaselineTeamRevisionresolve it to the full 40-character commit (getHeadCommit,utils/git.ts:1427) before publishing. IfteamRevisiondoes the same, the three compare as plain strings across records.feat(workflow): record team revision
feat(workflow): record team revision
feat(workflow): record team revision (#1201)