fix(local-agent): unify debug log tag across HTTP and report/sync lines#170
Merged
Merged
Conversation
The local-agent debug log mixed two tag formats: HTTP request/response lines used `[local-agent <id6>]` (prefix but no agent name) while report/sync/command lines used `[<id6>] [<tool>]` (agent name but no prefix). Same call, two shapes — and the HTTP lines couldn't be traced to an agent. Introduce a single `localAgentTag(context)` helper producing the unified `[<id6>] [<tool>]`, and thread the built tag (instead of a bare agentId) into localAgentFetch/ackCommand so every line — HTTP, report/sync, and command ack — carries both the id and the agent name. Co-Authored-By: Claude Opus 4.8 <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.
Problem
The local-agent debug log mixed two tag formats within a single hook fire:
localAgentFetch):[local-agent 2bcf67]— has thelocal-agentprefix but no agent name, so an HTTP line couldn't be traced to which agent made it.[2bcf67] [codebuddy]— has the agent name but no prefix.Example (before):
Fix
localAgentTag(context)helper producing the unified[<id6>] [<tool>].localAgentFetch/ackCommandto take the builttag(they previously took a bareagentIdonly to build the tag), so HTTP lines now carry the agent name too.fetchUserGroups,processCommands,reportAndSyncLocalAgent) onto the helper.No HTTP semantics or payloads changed — this is log-tag only.
After:
Test Plan
npx tsc --noEmitpassesnpx vitest run src/__tests__/local-agent.test.ts— 12/12 passnpm run buildsucceedshook-dispatch stop --tool codebuddyagainst the live backend; all 13 debug.log lines now use the single[2bcf67] [codebuddy]format (verified the old[local-agent 2bcf67]shape is gone).🤖 Generated with Claude Code