Skip to content

fix(local-agent): log real derived agent id, not stale config field#169

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jeff-r2026:fix/local-agent-log-tag
Jul 9, 2026
Merged

fix(local-agent): log real derived agent id, not stale config field#169
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jeff-r2026:fix/local-agent-log-tag

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Problem

debug.log shows local-agent HTTP request tags as [local-agent nknown] even though the request body carries a correct local_agent_id (e.g. 101a235cb52bcf67).

Root cause: localAgentFetch built its log tag from config.localAgentId, which was deprecated in #161 (f3c61a4) when local_agent_id moved to runtime derivation via resolveLocalAgentId(). 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 leading u, rendering nknown.

The data was never wrong: the payload's local_agent_id already came from resolveLocalAgentId(). Only the log prefix was misleading.

Fix

Thread the resolved agent id into localAgentFetch (and ackCommand), so the log tags for report / sync / ack / user-groups all match the local_agent_id sent in the body. No behavior change beyond logging.

Test Plan

  • npx tsc --noEmit
  • npx vitest run — 1680 passed (the single import-repo-merge.test.ts failure is pre-existing on the base commit and unrelated to this change)
  • npm run build
  • Real CLI e2e: hook-dispatch session_startdebug.log now shows [local-agent 2bcf67] matching body local_agent_id ending 2bcf67; the context-less user-groups call shows a real derived id a22382 instead of nknown.

🤖 Generated with Claude Code

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>
@jeff-r2026 jeff-r2026 merged commit 42e4d8a into Tencent:main Jul 9, 2026
6 checks passed
@jeff-r2026 jeff-r2026 deleted the fix/local-agent-log-tag branch July 9, 2026 05:10
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.

1 participant