Skip to content

feat(telemetry): print a post-command notice on first run - #2156

Open
Hweinstock wants to merge 4 commits into
aws:refactorfrom
Hweinstock:feat/telemetry-first-run-notice
Open

feat(telemetry): print a post-command notice on first run#2156
Hweinstock wants to merge 4 commits into
aws:refactorfrom
Hweinstock:feat/telemetry-first-run-notice

Conversation

@Hweinstock

Copy link
Copy Markdown
Contributor

Problem

We are missing the post-first run telemetry notice on the refactor branch.

Solution

  • avoid writing the installationId as a side effect within globalConfig.
  • at the top level, determine if its the firstRun by checking if installationId is there, otherwise attempt to persist one.
  • print a telemetry notice when installationId was not there, and telemetry is enabled

Verification

> rm ~/.agentcore/config.json
> agentcore config 
{
  "telemetry": {
    "enabled": true,
    "audit": false,
    "endpoint": "https://telemetry.agentcore.aws.dev"
  },
  "installationId": "e92dbb9b-cd4f-4b9f-94cc-ef69d95087cb"
}

The AgentCore CLI collects aggregated, anonymous usage analytics to help improve the tool.
To opt out:   agentcore config telemetry.enabled false
To audit:     agentcore config telemetry.audit true
> agentcore config 
{
  "telemetry": {
    "enabled": true,
    "audit": false,
    "endpoint": "https://telemetry.agentcore.aws.dev"
  },
  "installationId": "e92dbb9b-cd4f-4b9f-94cc-ef69d95087cb"
}

notice that it only printed the first time.

@github-actions github-actions Bot added the size/m PR size: M label Sep 1, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress labels Sep 1, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 1, 2026

@agentcore-devx-automation agentcore-devx-automation Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentCore Harness Review

Verdict: Looks good

Nice, clean refactor. The move to lazy first‑run persistence in src/index.ts (with set() updating the cache before telemetry emits) means getResourceAttributes() on shutdown still sees the freshly persisted installationId, so telemetry keeps working within the first-run session. The printFirstRunNotice unit test is appropriately scoped and doesn't over‑mock.

One small behavioral note (not blocking):

  • src/handlers/config/handler.tsxcoerceValue switches on typeof current against DEFAULT_GLOBAL_CONFIG. Since DEFAULT_GLOBAL_CONFIG.installationId is now undefined, running agentcore config installationId <uuid> will fall through to the default branch and throw Unsupported target type "undefined". Previously the default was a random UUID string, so this path worked. It's a rare command and there was no test covering it before, but if you want to preserve the ability to override installationId from the CLI, you'd need to either treat undefined current-values as strings in coerceValue, or key the switch on the schema rather than the default value. Otherwise consider it intentional that installationId is now effectively read‑only via agentcore config (users can still edit ~/.agentcore/config.json directly).

Also worth considering (optional): if globalConfigAccessor.set() fails on first run, the notice will be re‑shown on every subsequent invocation and telemetry will keep failing schema validation (silently) for the whole session. Current behavior is best‑effort with a warning log, which seems acceptable.

@agentcore-devx-automation agentcore-devx-automation Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Sep 1, 2026
@codecov-commenter

codecov-commenter commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.22%. Comparing base (d304147) to head (bc4bef2).

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2156   +/-   ##
=========================================
  Coverage     97.22%   97.22%           
=========================================
  Files           507      508    +1     
  Lines         33809    33815    +6     
=========================================
+ Hits          32872    32878    +6     
  Misses          937      937           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Hweinstock
Hweinstock force-pushed the feat/telemetry-first-run-notice branch from 8254946 to bc4bef2 Compare September 1, 2026 01:04
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Sep 1, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 1, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 1, 2026
@Hweinstock
Hweinstock marked this pull request as ready for review September 1, 2026 01:37
const configFileData = await this.readConfigFile();

// if no installationId is present, generate one and merge it into the file data
if (!configFileData.installationId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be simpler to return isFirstRun in the output here? Would that avoid having to make many of these other changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants