fix: auto-discover KNOWN_AGENTS for resource injection during pull - #394
Open
jeff-r2026 wants to merge 3 commits into
Open
fix: auto-discover KNOWN_AGENTS for resource injection during pull#394jeff-r2026 wants to merge 3 commits into
jeff-r2026 wants to merge 3 commits into
Conversation
The pull flow (skills, rules, agents, builtin resources) only iterated over tools explicitly listed in teamai.yaml toolPaths via scopedToolPaths(). Tools like tclaude/tcodex that are registered in KNOWN_AGENTS and installed on disk (.tclaude/ exists) were silently skipped — seedProjectAgentRoot() created their root directory, but pullItem() never wrote resources into it. Add effectiveToolPaths() that merges scopedToolPaths() with auto-discovered KNOWN_AGENTS entries whose install root exists on disk. Convention-based paths (skills, rules, agents, claudemd) are derived from the agent's skillsPath. Use this in all pull/sync call sites so any installed tool receives team resources without requiring explicit teamai.yaml config. Also add tclaude and tcodex to SELF_MODE_AGENT_CHOICES so they are detected during `teamai init` in single-repo mode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
建议把这个问题提升为更明确的产品模型:不再由 建议的职责划分:
当前 PR 的 auto-discovery 方向符合这个目标,但实现上建议补齐几个边界:
建议增加以下回归测试:
这样可以彻底解决“新增 Agent 需要更新团队配置”的问题,同时避免把路径猜测和双向同步安全边界混在一起。 |
…anaged tools Address PR review feedback: 1. Replace convention-based path derivation (deriveToolPaths) with a lookup into DEFAULT_TOOL_PATHS — a verified per-tool registry extracted from the schema defaults. Agents without a registry entry (e.g. gemini) receive only their skills path; rules/agents/claudemd are never guessed. 2. Restrict push (scanLocalForPush) and remove (removeItem) to scopedToolPaths() — only team-managed tools. This prevents personal skills in auto-discovered tool dirs from being silently uploaded, and ensures remove only deletes resources teamai has management records for. 3. Pull and sync paths (pullItem, pullAllRules, builtin-*) continue using effectiveToolPaths() so installed tools receive team resources. 4. Add regression tests covering: auto-discovery with verified paths, skills-only fallback for unregistered agents, custom path override precedence, disabledAgents, codebuddy CODEBUDDY.md preservation, and scopedToolPaths isolation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
复查最新提交 [P1] pull 的 tombstone 清理仍会删除自动发现目录中的个人 Skill
本地复现:
也就是说,直接调用 另外还有两个 auto-discovery 功能遗漏:
建议在合并前至少修复 tombstone 删除问题,并为“自动发现目录中存在同名个人 Skill”加入回归测试。 |
…ull path Address second round of PR review: 1. [P1] Tombstone cleanup and stale-skill cleanup in pull.ts now use scopedToolPaths() instead of effectiveToolPaths(). A personal skill in an auto-discovered dir (e.g. ~/.gemini/skills/private-skill) that shares a name with a tombstoned team skill is no longer deleted. Same fix applied to stale-rule cleanup in rules.ts. 2. OpenCode user-scope detection: effectiveToolPaths() now resolves the install-detection root from userScope paths when in user scope, so ~/.config/opencode is correctly detected (not just ~/.opencode). userScope path overrides are also applied to the returned paths. 3. AgentsHandler.pullItem() and pullLegacyMd() now use effectiveToolPaths() so auto-discovered tools (e.g. tclaude) receive team agent definitions. 4. Added regression tests for OpenCode user-scope auto-discovery. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pullItem()in skills/rules/agents handlers only iteratedscopedToolPaths()(=teamai.yamltoolPaths), missing tools liketclaude/tcodexthat are inKNOWN_AGENTSand installed on diskeffectiveToolPaths()intypes.tsthat mergesscopedToolPaths()with auto-discoveredKNOWN_AGENTSentries whose install root (e.g..tclaude/) existseffectiveToolPaths()tclaudeandtcodextoSELF_MODE_AGENT_CHOICESforteamai initsingle-repo mode detectionTest plan
npx tsc --noEmitpasses (no new type errors)npx vitest run— all previously-passing tests still pass, updated 3 test files for new SELF_MODE_AGENT_CHOICES sizemkdir -p /root/gpu/.tclaude && teamai pull --force→ skills/rules injected into.tclaude/skills/and.tclaude/rules/🤖 Generated with Claude Code