Repository navigation
fix(pull): point a kept agent or rule folder copy at the team folder, not at push - #1905
Walternater wants to merge 4 commits into
Conversation
… not at push Pull kept an edited copy of a delivered agent or rule folder and told the member to share it with `teamai push`, which takes nothing from it — the folder is edited in the team repo (`AgentsHandler.scanLocalForPush`, `RulesHandler.scanLocalForPush`). The message now names that folder instead. `keepsEditedCopy` records the team folder a folder copy's change is made in, and `reportKept` words that copy from it. Every other kept copy keeps its message. `ResourceItem.folder` documented itself as rules-only, but agent folders set it too (`agents.ts:784`), which is what made one condition cover both. Co-Authored-By: Claude Code <[email protected]>
Testing documentation is sufficient: the description records failing-first coverage, unit tests, lint, type checking, and a representative real-CLI verify-world run. No testing-record finding. No PR code was executed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Reviewed at 0553859. The message now names the right place, and only its last step needs to change.
What I checked. I ran the built CLI with this head and the merge-base (84561fb) on a team repo with an agent folder (agents/reviewer/) and a rule folder (rules/api-style/):
- pull, then the member edits both delivered copies, then
teamai push --all. Both builds print "No new or modified resources to push", as you say. - The team changes
RULE.md, then pull. Main says to share the copy withteamai push. This head namesrules/api-style/andagents/reviewer/in the team repo, which is the fix #1880 asks for. - I followed the new advice: the team folders took the member's line, then pull. The agent copy now matches and is taken back. The rule copy is kept again, with the same warning. One more team change, then pull: kept again, same warning.
rm .claude/rules/api-style.mdandteamai pull --forcedelivers the team version with the member's line, and later pulls deliver normally.
CI is green at this head. #1908 fixes another part of #1880 and shares no file with this one.
[P1 blocking] "let the next pull deliver it" doesn't happen (delivered-copies.ts:863). We agree with the CI review here, and we'd make it blocking, since it fits this PR. classifyCopy (:56-63) keeps any copy whose bytes match neither the recorded hash nor the incoming one. A copy the member changed still carries the team's old text, so moving the change into the team folder doesn't make the bytes equal. A member who does what the message says gets the same message on every pull, which is the loop this PR set out to end. Step 4 is what works, so the message could say that in one instruction:
`Push takes nothing from this copy: make your change in ${editAt} in the team repo, `
+ 'then delete your copy and run `teamai pull --force` to take the team version.'The new test's toContain('Edit rules/api-style/ in the team repo') would follow the new wording.
[P2 non-blocking] teamai doctor still says "A copy changed by you is kept by pull: share it with teamai push" (doctor-delivery.ts:174-178). For a rule or agent folder copy, that's the same wrong advice. It shows only beside another failing check, and I checked it by reading the code only.
[P3 nit]
- A kept folder copy the team hasn't changed now prints a warning where main printed info (
delivered-copies.ts:860). #1880 keepsinfofor that form, so(teamChanged ? log.warn : log.info)would match it. - The new case covers the rule folder only, and its
not.toContaincan't fail on main: that scenario prints the "Merge that change…" form there, not the text the assertion excludes. The positive assertions do the work.
CI review. One P2, the finding above. We agree, and we'd raise it to blocking.
Merge risk. Low. One log message and an optional field on an internal record. No sync state changes.
…e edit is not enough classifyCopy keeps any copy whose bytes match neither the record nor what teamai would write now. A member who moves their change into the team folder leaves the copy unchanged, so every later pull keeps it again: the message promised a delivery that never came. The copy goes instead, after the edit lands in the team repo. doctor's advice for CHANGED_BY_YOU names the team folder for a folder copy too, and a kept folder copy the team has not changed stays `info` as on main. Co-Authored-By: Claude Code <[email protected]>
|
No new confident findings in the scoped diff.
No PR code was run, built, or installed. |
|
Both findings fixed in e9477a6. [P1 blocking] "let the next pull deliver it" doesn't happen — you're right, and the reason is exactly [P2 non-blocking] [P3 nit] A kept folder copy the team has not changed is back on Real-CLI record (world Then following it — the line lands in the team folder, the copy is deleted, No second warning; the member's line arrives. The new doctor test fails on this head before the fix ( The ledger reports one LEAK, |
|
Fixed in You're right that "let the next pull deliver it" was the wrong promise — a kept copy's bytes match neither hash, so moving the edit into the team folder cannot make the next pull treat it as deliverable, and a member following the old sentence would meet the same line every pull. Both steps are now in one direction, and the e2e test ( [P2] [P3] The log level was already Checks: The CI review's P1 is the same finding, so this resolves both. |
Resolved: The earlier advice finding is fixed: members are now told to edit the team folder, then delete the delivered copy and pull. Testing: The description includes a representative real-CLI verify-world record, so no missing-record finding. Its older build reference is not blocking. No PR code was run, built, or installed. |
409d0a4 dropped it from reportKept while the E2E assertion took it, so the test failed at that head, and the message a member reads no longer said what `pull --force` takes. The copy of every other kept resource names it, in the same function. Co-Authored-By: Claude Code <[email protected]>
|
No new confident findings in the scoped diff.
No PR code was run, built, or installed. |
|
The P1 is real and was mine: 409d0a4 removed "to take the team version." from Confirmed locally at 655b5f6: On the P2: the advice is now the sequence you asked for — make the change in the team folder, then delete the copy and |
|
Triage status: ready for a fresh maintainer review.
The earlier requested-changes review still blocks merging, so this needs a new review from someone with write access. |
|
因超过一周无活动且 review 未完成关闭。SaulMoro 在 2026-11-16 的 CHANGES_REQUESTED 之后,维护者复审一直未处理(最后一条 XY-code1 2026-11-18 19:14 记为 ready for maintainer review),7 天无进展。如仍需要,欢迎重新提 PR 到最新 main。 |
Summary
Fixes the first of the five bugs in #1880. Pull keeps an edited copy of a delivered agent or rule folder and told the member to share it with
teamai push— which takes nothing from it, because the folder is edited in the team repo (AgentsHandler.scanLocalForPushatsrc/resources/agents.ts:427,RulesHandler.scanLocalForPushatsrc/resources/rules.ts:82, anddocs/guide/sharing.mdsays the same). The member follows the advice,pushanswers "No new or modified resources to push", and nothing is shared.The kept copy's message now names the team folder the change is made in, so the member is told where to make it instead of being pointed at a command that ignores it.
Type of Change
What changed
src/resources/delivered-copies.ts—keepsEditedCopyrecordseditAt(the team folder) for a folder copy, on both paths that push akeptentry;reportKeptwords that copy from it. Every other kept copy keeps its message.src/types.ts—ResourceItem.folderdocumented itself as "Rules only", but agent folders set it too (src/resources/agents.ts:784). The comment now says both, which is what makes one condition cover agent and rule folders. The field's meaning does not change.src/__tests__/e2e/pull-keeps-edits-822.test.ts— a case in the file that already owns this behaviour.Test plan
Proof is a failing test first, extended into the existing
pull-keeps-edits-822.test.ts(AGENTS.md"Proof for a bug fix is a failing test first"):main:npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/pull-keeps-edits-822.test.ts -t "rule folder"→ fails, the output tells the member toShare it with \teamai push``.delivered-copiesandagent-foldersunits: 31/31.npx tsc --noEmitclean,npm run lintpasses.Real CLI in a verify world (
20261116T040738-a6b4d3, build84561fb0+dirty): a team repo carryingrules/api-style/RULE.md, one pull to deliver it, the member appends a line to.claude/rules/api-style.md, the team bumpsRULE.md, a second pull prints:The ledger reports one LEAK, and it is not this change:
~/.claude/plugins/claude-hud/transcript-cache/…(a plugin of the shell the world ran in) names the world. Everything else under(e)is the known #1808 set.Hit every surface
keptentries are recorded before any tool renders.keepsEditedCopy, which both scopes call.gitin the world.httpteams are read-only and never reach this path.ResourceItem.folder, so all three get the new wording.path.posix.dirnamematches howrelativePathis spelled.Notes for reviewers
teamai pushbugs: kept folder copies push never takes, an interrupted pre-push sync, a linked SKILL.md, a failed --branch carry, and self-mode leftovers #1880; the other four are untouched, and that issue should stay open.editAtfolder is derived fromitem.relativePathrather than carried through the resolver, so it cannot disagree with the path the copy was delivered from.Disclosure
Implemented with AI assistance (Claude Code); every line reviewed and tested by the author.