Skip to content

fix: initialize telemetry for full-screen TUI mode#1350

Draft
Hweinstock wants to merge 1 commit into
mainfrom
fix/tui-telemetry-init
Draft

fix: initialize telemetry for full-screen TUI mode#1350
Hweinstock wants to merge 1 commit into
mainfrom
fix/tui-telemetry-init

Conversation

@Hweinstock
Copy link
Copy Markdown
Contributor

Description

When launching the full-screen TUI via bare agentcore (no args), TelemetryClientAccessor.init() was never called. The args.length === 0 branch returned before reaching the init() call that serves the CLI path. This meant:

  1. The telemetry client lazily initialized with mode="cli" instead of mode="tui"
  2. TelemetryClientAccessor.shutdown() was never called, so the OTLP exporter could lose buffered metrics on process exit

This PR adds init("tui", "tui") before renderTUI() and shutdown() in the waitUntilExit() handler.

Related Issue

Closes #

Documentation PR

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

TelemetryClientAccessor.init() was never called when launching the
full-screen TUI (agentcore with no args). The client fell back to lazy
init with mode='cli' and no shutdown() was ever called, so metrics were
either misattributed or lost when the process exited.
@github-actions github-actions Bot added the size/xs PR size: XS label May 21, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 21, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.14.2.tgz

How to install

gh release download pr-1350-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.14.2.tgz

@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 May 21, 2026
Copy link
Copy Markdown

@agentcore-cli-automation agentcore-cli-automation left a comment

Choose a reason for hiding this comment

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

Looks good — small, targeted fix that correctly addresses both stated issues:

  1. TelemetryClientAccessor.init('tui', 'tui') is now called before renderTUI(), so the bare-agentcore invocation gets tagged with mode=tui instead of falling back to the lazy mode=cli default.
  2. TelemetryClientAccessor.shutdown() is now invoked from the waitUntilExit().then(...) handler, so the OTLP exporter gets a chance to flush buffered metrics before process exit.

I verified the init signature (init(entrypoint, mode)) — both args being 'tui' is correct. Ink's default Ctrl+C handling unmounts cleanly and resolves waitUntilExit(), so the new shutdown() also runs on the common Ctrl+C-from-TUI exit path. Browser-dev exit action doesn't emit telemetry, so calling shutdown() before launchBrowserDev() is fine for now.

No new issues worth blocking on.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 44.3% 9531 / 21512
🔵 Statements 43.54% 10114 / 23225
🔵 Functions 41.01% 1655 / 4035
🔵 Branches 40.84% 6162 / 15086
Generated in workflow #3228 for commit 36beb61 by the Vitest Coverage Report Action

@Hweinstock Hweinstock changed the title fix: initialize telemetry for bare TUI mode fix: initialize telemetry for full-screen TUI mode May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants