Skip to content

fix(local-agent): pass --agent filter to initLocalAgentHttp to prevent cross-tool hook injection#174

Merged
jeff-r2026 merged 3 commits into
Tencent:mainfrom
m0Nst3r873:worktree-fix-init-http-filter-agents
Jul 9, 2026
Merged

fix(local-agent): pass --agent filter to initLocalAgentHttp to prevent cross-tool hook injection#174
jeff-r2026 merged 3 commits into
Tencent:mainfrom
m0Nst3r873:worktree-fix-init-http-filter-agents

Conversation

@m0Nst3r873

@m0Nst3r873 m0Nst3r873 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Thread filterAgents (from --agent CLI flag) through initLocalAgentHttp to injectHooksToAllTools
  • Prevents teamai init --http <url> --agent codebuddy from injecting hooks into .workbuddy/settings.json (and vice versa)
  • Fixes duplicate agent cards appearing on ClawPro when CodeBuddy and WorkBuddy coexist on the same machine

Root Cause

initLocalAgentHttp called injectHooksToAllTools without a filterAgents parameter, so it injected hooks into every tool directory that existed on disk. When CodeBuddy IDE triggered a session-start hook, both .codebuddy/settings.json and .workbuddy/settings.json hooks fired, causing two separate report/sync cycles with different agent_type and local_agent_id.

Test plan

  • teamai init --http <url> --agent codebuddy only injects hooks into .codebuddy/settings.json
  • teamai init --http <url> (no --agent) still injects hooks into all existing tool directories (backward compatible)
  • npx tsc --noEmit passes
  • npx vitest run — no new test failures

🤖 Generated with Claude Code

…t cross-tool hook injection

When `teamai init --http --agent codebuddy` is run on a machine that also
has WorkBuddy installed, initLocalAgentHttp previously injected hooks into
ALL tool directories unconditionally. This caused CodeBuddy sessions to
trigger WorkBuddy report/sync as well, producing duplicate agent cards on
ClawPro.

Thread the existing filterAgents (from --agent CLI flag) through to
injectHooksToAllTools so only the target tool receives hooks.

--story=1032029153857553

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@m0Nst3r873 m0Nst3r873 force-pushed the worktree-fix-init-http-filter-agents branch from d2f9b5c to 5c17fb8 Compare July 9, 2026 08:28
jaelgeng and others added 2 commits July 9, 2026 17:01
…etry queue

appendReporterQueue wrote {at, entry:{error, context}} into the same
queue.jsonl that status-report's flushQueue expects {url, body} entries.
These orphaned entries could never be drained and accumulated forever.

Rename to errors.jsonl so the retry queue stays clean.

--story=1032029153857553

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…arity

The function writes diagnostic error entries (not retryable requests),
so the name should reflect its actual purpose.

--story=1032029153857553

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeff-r2026 jeff-r2026 merged commit dca24a5 into Tencent:main Jul 9, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants