fix(local-agent): log real derived agent id, not stale config field#169
Merged
Merged
Conversation
localAgentFetch built its log tag from the deprecated config.localAgentId, which is undefined for configs written after the deterministic-id change, so it fell back to 'unknown' and .slice(-6) rendered it as "nknown". The actual local_agent_id in the payload was correct (derived via resolveLocalAgentId); only the log prefix was wrong. Thread the resolved agent id into localAgentFetch (and ackCommand) so the report/sync/ack/user-groups log tags match the local_agent_id sent in the body. 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
debug.logshows local-agent HTTP request tags as[local-agent nknown]even though the request body carries a correctlocal_agent_id(e.g.101a235cb52bcf67).Root cause:
localAgentFetchbuilt its log tag fromconfig.localAgentId, which was deprecated in #161 (f3c61a4) whenlocal_agent_idmoved to runtime derivation viaresolveLocalAgentId(). Configs written after that change no longer contain the field, so the tag fell back to the string'unknown'— and.slice(-6)on a 7-char string dropped the leadingu, renderingnknown.The data was never wrong: the payload's
local_agent_idalready came fromresolveLocalAgentId(). Only the log prefix was misleading.Fix
Thread the resolved agent id into
localAgentFetch(andackCommand), so the log tags for report / sync / ack / user-groups all match thelocal_agent_idsent in the body. No behavior change beyond logging.Test Plan
npx tsc --noEmitnpx vitest run— 1680 passed (the singleimport-repo-merge.test.tsfailure is pre-existing on the base commit and unrelated to this change)npm run buildhook-dispatch session_start→debug.lognow shows[local-agent 2bcf67]matching bodylocal_agent_idending2bcf67; the context-less user-groups call shows a real derived ida22382instead ofnknown.🤖 Generated with Claude Code