Repository navigation
feat(agents): let the team repo replace the built-in teamai-recall agent - #1691
Conversation
A team's agents/teamai-recall.* or agents/<ns>/teamai-recall.* now replaces the agent teamai ships, as a team workflow replaces a default: pull leaves the team copy in place on full and fast-path syncs, push offers edits to it, and deleting it brings teamai's back. While recall is off, the team copy is not delivered either.
…e team agent does not reach The built-in step now judges a destination the checkout record holds as a team copy: unedited is replaced, an edit is kept with a warning, and the fast path leaves it to the next full sync. A team teamai-recall replaces the built-in only for the tools it reaches; one that does not parse replaces nothing and pull says so.
… replaces it A built-in leaves no delivery record, so a member who already had teamai's teamai-recall kept it when the team added its own: pull judged it the member's file, and push offered it as a modified team agent. The copy's bytes now identify it: the agent's copy origin carries what teamai ships under that name, and push leaves such a copy out.
Every pull wrote over a built-in agent's path before a team agent could replace it, so a copy there with no delivery record is teamai's, whichever teamai version wrote it. Matching only the current render left an older release's copy in place of the team agent, and offered it to push.
Testing: The description supplies build, lint, focused-test, and representative real-CLI records. It meets the testing-documentation requirement; the disclosed full-suite failures and deferred provider/agent coverage are not blocking findings. No PR code was executed. |
…gent Replacement was decided per tool from the team file's targets, which missed what pull actually delivers: a copy a tool rejects or a model that cannot be resolved left a new member with no recall agent, two tools sharing one directory overwrote each other's copy, and an unrelated namespace collision suppressed the built-in. The built-in now steps aside at the destinations pull writes the team agent to, and during a collision only where a team copy is already installed.
|
All three are fixed in 9448c74. Replacement is now decided by destination, not by tool ID: the built-in steps aside only at the paths where pull writes the team agent. Each case has a test in
Lint, typecheck and the four affected test files pass (140 tests). The real-CLI scenarios in the description pass again on this head. |
Earlier findings: The rejection/new-install, shared-destination, and inactive-namespace scenarios are resolved in the current diff. Testing: The description documents sufficient build, lint, focused-test, and representative real-CLI verification. The disclosed suite failures and deferred provider/agent coverage are not blocking findings. No PR code was executed. |
A recorded model renders a destination whether or not a copy is there, so a member whose held copy was removed got neither the team agent nor the built-in. The held destination now counts only while its copy exists, and recall enable promises the team's copy only where pull delivers it.
|
Fixed in ffc3805.
|
Earlier findings: All four previously reported scenarios are resolved in the current diff. Testing: The description documents sufficient focused tests, lint/type checking, and representative built real-CLI verification. Disclosed suite failures and deferred provider/agent coverage are not blocking findings. No PR code was executed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
I built ffc3805 and the merge-base (164fac9) and ran each case with the CLI in an isolated HOME, --agent claude --scope workspace, against a local bare team repo.
These hold at ffc3805:
| Case | ffc3805 |
|---|---|
| Conflicting Trae extras, or a team copy whose model does not resolve, on a fresh install | built-in recall written, with a warning |
Team copy for trae in the shared .trae/agents/teamai-recall.md, Trae CN installed too |
team copy kept after two full syncs |
Unrelated conflict, teamai-recall only in an inactive namespace |
built-in written for a new member |
Copy held for its model, removed by recall disable, aliases broken, then recall enable and two pulls |
built-in written (the 9448c74 gap is fixed) |
agents/teamai-recall.yaml, three pulls, recall off and on |
team copy, no rewrite loop |
The CI review at ffc3805 raises two more blocking cases. I reproduced both:
[P1 blocking] A legacy agents/teamai-recall.md leaves no recall agent after recall off and on
team: agents/teamai-recall.md (front matter name and description, no YAML)
teamai pull rc=0 .claude/agents/teamai-recall.md is the team copy
teamai recall disable rc=0 no recall agent
teamai recall enable rc=0 no recall agent
teamai pull rc=0 (no team change) no recall agent
164fac90: the built-in is there after enable and after the pull
The built-in steps aside at the team copy's destination, and the unchanged-rev pull only redeploys YAML agents (agentsToRedeploy), so nothing writes the .md copy back. Redeploying a missing legacy replacement, or skipping the fast path when one is missing, fixes it.
[P1 blocking] recall enable overwrites a member's edit that pull kept
team: agents/teamai-recall.yaml
teamai pull rc=0 team copy
(member appends a line to .claude/agents/teamai-recall.md; team deletes agents/teamai-recall.yaml)
teamai pull rc=0 Kept .claude/agents/teamai-recall.md: it holds your edit of the team's teamai-recall agent, ...
teamai recall enable rc=0 .claude/agents/teamai-recall.md is now the built-in; the member's line is gone
deployRecallArtifacts calls deployBuiltinAgents without the checkout's delivery record, so the write is allowed (builtin-agents.ts:124). Pull protects the edit and recall enable then drops it. Passing the same record there keeps it.
[P3 nit] The recall enable hint does not check that pull can deliver
recall enable still says to pull to get the team's copy back in the legacy case above, and the pull brings nothing back.
Push, the role split and an unparsable team file I checked against the code and your record only. CI was still running when I checked.
… agent copies Recall decides which agents pull delivers, so toggling it now bypasses pull's unchanged-revision fast path, as a changed exclude list does: the next pull restores a team's own recall agent, a legacy .md one included, which the fast-path redeploy does not cover. recall enable also leaves a team copy on the checkout record, such as one the member edited, to pull.
|
Both are fixed in 25a2327.
New tests in |
Earlier findings: The originally reported paths are resolved, including explicit toggles followed by ordinary pulls and preservation of recorded edits when enabling recall. Testing: The description meets the testing-documentation requirement with focused tests, lint/type checking, and representative built real-CLI verification. Disclosed suite failures and CI-deferred coverage are not blocking findings. No PR code was executed. |
…y is missing A pull that keeps its revision does not deliver a team agent again: after TEAMAI_RECALL_DISABLED or an inherited scope removed the team's recall copy, the built-in stepped aside at an empty destination and the member had no recall agent. The built-in now steps aside only while the team's copy is there; the next full sync replaces teamai's copy with the team's, since a copy holding exactly what teamai ships there is teamai's even on record as a team delivery, and push leaves it out.
|
Both are fixed in d3fcbf2 at the shared cause rather than per fast-path variant. Both paths removed the team's copy without a full sync, and the built-in then stepped aside at an empty destination. Patching each variant (
Real CLI, your second scenario with a legacy
New tests fail on 25a2327 and pass now: |
|
No new findings I can confidently substantiate in the specified diff. Earlier findings: Resolved, including the inherited-scope and environment-controlled disabling scenarios. Missing replacement copies now receive the built-in fallback until a full sync restores the team copy. Testing: The description meets the testing-documentation requirement with focused tests, lint/type checking, and representative built real-CLI verification. Disclosed full-suite failures and CI-deferred provider/agent coverage are not blocking findings. No PR code was run, built, or installed. |
|
@SaulMoro all three are fixed as of 25a2327. I reran your sequences on the current head, d3fcbf2, with the CLI built from that head. [P1] Legacy [P1] The same sequence with a legacy [P3] Enable hint. The hint holds now, because the pull after a toggle is a full sync and brings the team's copy back (first trace above). Tests that cover these: |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approving at d3fcbf2. I built it and reran every case from my last review with the CLI (isolated HOME, --agent claude --scope workspace, local bare team repo):
| Case | d3fcbf2 |
|---|---|
Legacy agents/teamai-recall.md, recall off and on, unchanged pull |
built-in after recall enable, team copy back after the pull |
Member edits the team copy, team deletes its agent, pull keeps it, recall enable |
the edited copy is kept |
agents/teamai-recall.yaml, recall off, team commit, recall on, two pulls |
built-in after enable, team copy after the next pull, no rewrite loop |
Copy held for its model, removed by recall disable, aliases broken, recall on, two pulls |
built-in written |
Trae and Trae CN sharing .trae/agents/teamai-recall.md; conflicting Trae extras; an unrelated conflict with teamai-recall only in an inactive namespace |
unchanged from ffc3805, all as expected |
The CI review at d3fcbf2 has no new findings and calls the earlier ones resolved; I agree. The recall enable hint nit stands but no longer leaves a member without recall, since the built-in is written meanwhile. Push, the role split and an unparsable team file I checked against the code and your record only. The merge waits for CI.
Summary
A team can replace the default workflows teamai ships, but not the
teamai-recallagent. A team'sagents/teamai-recall.yamlwas delivered and then overwritten by the built-in on the same pull, andpushnever offered edits to it. A team agent with that name now replaces the built-in, atagents/for everyone oragents/<ns>/for one role, the same way a team workflow replaces a default.[agents] agents/fe/teamai-recall.yaml cannot be delivered (…), so teamai's teamai-recall stays in effect.teamai-recallis not delivered either, so pull does not write it, remove it, and redeploy it on every run.TEAMAI_RECALL_DISABLED, an inherited scope), the member gets teamai's recall agent until the next full sync puts the team's copy back.teamai recall enableanddisablemake the next pull a full sync, as a changed exclude list does: recall decides which agents pull delivers. Enable leaves a team copy on the checkout record to pull, and says to runteamai pullwhen the team replaces the agent.docs/guide/sharing.md#replace-the-recall-agent.Type of Change
Test Plan
npx tsc --noEmitpasses (npm run typecheck)npm run lintpasses, documentation checks includednpx vitest runpasses. Not established locally; see below.Each new test failed before its fix and passes with it:
builtin-agents.test.ts:agents.test.ts:.teamai/agents/teamai-recall.yamldesired-agents.test.ts: no teamteamai-recallis delivered while recall is offrecall-toggle.test.ts: each toggle makes the next pull a full sync, and enable leaves an edited copy on record aloneTest runs on head
d3fcbf2b:agents.test.ts,builtin-agents.test.ts,desired-agents.test.ts,pull-skip-sync.test.ts,recall-toggle.test.tsanddoctor-agents-delivery.test.ts: 174 passed.LC_ALL=Con a heavily loaded machine (load average 38–102 on 12 cores), before a rebase onto fix(sync): 为会话启动刷新增加冷却和并发复用 #1683 that applied cleanly. 46 tests failed in 10 untouched workflow/docs-check files, 35 of them timeouts. Rerunning those files with--testTimeout=180000 --maxWorkers=4left 3 failures, all timeouts at the 60 s limit the tests set themselves (check-docs.test.ts×2,workflow-settle-cost.test.ts×1), none an assertion failure.npm run lintruns the same docs checks and passes. This does not establish a full-suite pass; CI is the authority.LC_ALL=C, git-message tests fail here because git prints Spanish. This is unrelated to this change.Real CLI record
macOS, Node 24.21.0. Built
dist/from this branch, then ran with an isolatedHOME, a local bare team repo behind a synthetic HTTPS URL,provider: git,--agent claude --scope project, andsharing.recall.enabled: true. "Before" is an unmodified build oforigin/main.agents/teamai-recall.yaml, thenpull,pullSynced 1 agents, file is teamai'sAlready synced …, skippingpullpush --dry-run:No new or modified resources to pushagents/frontend/teamai-recall.yaml, members with roles frontend and backenddescription:; backend: teamai'spush --allteamai/push/…changesagents/frontend/teamai-recall.yaml(the generic git provider opens no PR, as designed)recall disable,pull×2,recall enable,pullDelivered 1 agent(s) missing from a tool: teamai-recallpullrecall disable, team aliases file broken,recall enable,pullHeld teamai-recall.yaml: Invalid model aliases file …,Synced 0 agents (1 held); the member gets teamai's built-inagents/teamai-recall.mddelivered, thenrecall disable,recall enable,pullon the same team revisionSynced 1 agents, legacy team copy backTEAMAI_RECALL_DISABLED=1 teamai pull, thenpullat the same revision, thenpull --forcepull⚠ Kept …/teamai-recall.md: it holds your edit of the team's teamai-recall agent, which no longer reaches this directory. Delete it to get teamai's teamai-recall back.Deleting it and pulling brings teamai's back. A laterrecall enablekeeps the editOnly Claude, at project scope, with the
gitprovider ran locally. Other agents (Codex, CodeBuddy, OpenCode) and providers (gitlab,github) are left to CI. Per-tool reach is covered by unit tests.Related Issues
None.
Notes for Reviewers
ownsAgentCopyalready treats a built-in's name as teamai's. So a file at a built-in agent's path with no delivery record counts as teamai's, whichever version wrote it (CopyOrigin.builtin, read byisTeamaiCopy). A copy pull delivered from the team agent is on the record and follows the usual edit rules.builtinAgentsReplacedByTeamresolves the team agents again inside the built-in step and the push scan, and asksAgentsHandler.deliveryDestinations(built onresolveRenders) where each lands. Both paths then agree with pull on what is delivered where..gitgets a new inode (a restored or copied checkout loses its record key), is treated as teamai's and overwritten on the next pull. Onmain, every pull overwrites any edit to this file, so this is no regression. Covering it would mean reading the other checkout records in pull's ownership check.