Skip to content

fix(install): enrich displayName-lookup log with agentName/instanceId - #424

Merged
samxu01 merged 2 commits into
mainfrom
fix/install-displayname-log-context
May 22, 2026
Merged

samxu01 merged 2 commits into
mainfrom
fix/install-displayname-log-context

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Summary

Code-reviewer follow-up on PR #412.

Both console.warn lines in the displayName-lookup catch branches logged a bare Mongoose error message with no hint about WHICH agent the lookup was attempting. An operator diagnosing a 'wrong displayName on reinstall' incident has to cross-reference timestamps to figure out the install path.

Now both lines append ${agent.agentName}:${normalizedInstanceId}:

No behavioral change — strictly diagnostic enrichment.

Test plan

  • CI green (no logic touched; existing tests still cover both code paths)
  • Manual: trigger a User.findOne failure on the install path; verify log line includes the agent identifier

🤖 Generated with Claude Code

Code-reviewer follow-up on PR #412. The two displayName-lookup catch
branches in install.ts both log a bare Mongoose error message with no
hint about WHICH agent the lookup was attempting. An operator
diagnosing 'wrong displayName on reinstall' has to cross-reference
timestamps to figure out the install path.

Append `${agent.agentName}:${normalizedInstanceId}` to both log lines:
  - the install-path lookup (line ~284)
  - the intro-path lookup (line ~420)

No behavioral change — strictly diagnostic enrichment.

Co-Authored-By: Lily Shen <[email protected]>
Comment thread backend/routes/registry/install.ts Fixed
Comment thread backend/routes/registry/install.ts Fixed
…ing-injection

CodeQL flagged the template-literal log lines (`[install] displayName lookup
failed for ${agent.agentName}:${normalizedInstanceId}`) as
format-string-injection: agent.agentName + normalizedInstanceId both
trace back to req.body and end up in the format-string slot.

Same diagnostic payload, just shaped as a structured second arg:

  console.warn('[install] displayName lookup failed', {
    agent: agent.agentName,
    instance: normalizedInstanceId,
    error: (lookupErr as Error).message,
  });

CodeQL doesn't flag user-tainted values in non-format-string slots.

Co-Authored-By: Lily Shen <[email protected]>
@samxu01
samxu01 marked this pull request as ready for review May 22, 2026 10:00
@samxu01
samxu01 merged commit 872920e into main May 22, 2026
10 checks passed
@samxu01
samxu01 deleted the fix/install-displayname-log-context branch May 22, 2026 10:00
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.

3 participants