Skip to content

feat: wire telemetry into all remove.* commands#1069

Draft
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:feat/telemetry-remove-commands
Draft

feat: wire telemetry into all remove.* commands#1069
Hweinstock wants to merge 1 commit intoaws:mainfrom
Hweinstock:feat/telemetry-remove-commands

Conversation

@Hweinstock
Copy link
Copy Markdown
Contributor

@Hweinstock Hweinstock commented Apr 30, 2026

Description

Wire telemetry withCommandRun() into all remove.* CLI command handlers and TUI remove flows, following the same pattern established in #1050 for add.* commands.

CLI paths use cliCommandRun which wraps the action handler with telemetry recording, error formatting, and process.exit. TUI paths use a new withTuiTelemetry helper (generalized from withAddTelemetry) that wraps each remove operation.

Supporting changes:

  • withAddTelemetry generalized to withTuiTelemetry — works for any { success: boolean } result type (add, remove, etc.). withAddTelemetry kept as deprecated alias.
  • remove.all added to COMMAND_SCHEMAS

All remove commands emit NoAttrs (no command-specific attributes per the telemetry metric shape spec).

Related Issue

N/A — continuation of #1050

Type of Change

  • New feature

Testing

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • Telemetry assertions added to existing integ tests (add-remove-resources.test.ts) verifying audit JSONL entries for remove.memory, remove.credential, and remove.policy-engine
  • Manual verification: AGENTCORE_TELEMETRY_AUDIT=1 → confirmed success and failure entries in audit files

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.

@Hweinstock
Copy link
Copy Markdown
Contributor Author

/strands review

@github-actions github-actions Bot added size/m PR size: M strands-running agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 89d3db7 to 7cbfdc9 Compare April 30, 2026 21:36
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 7cbfdc9 to 9e49ed7 Compare April 30, 2026 21:39
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 9e49ed7 to 5c078b8 Compare April 30, 2026 21:41
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock closed this Apr 30, 2026
@Hweinstock Hweinstock reopened this Apr 30, 2026
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress and removed size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 5c078b8 to 30ec334 Compare April 30, 2026 21:45
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 30ec334 to af77f7d Compare April 30, 2026 21:47
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@aws aws deleted a comment from agentcore-cli-automation Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from af77f7d to 5ac07cb Compare April 30, 2026 21:59
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@aws aws deleted a comment from agentcore-cli-automation Apr 30, 2026
@aws aws deleted a comment from github-actions Bot Apr 30, 2026
@Hweinstock Hweinstock closed this Apr 30, 2026
@Hweinstock Hweinstock reopened this Apr 30, 2026
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress and removed size/m PR size: M labels Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Additional Context on the Blocking Issue

To clarify: RuntimeEndpointPrimitive.ts is not modified in this PR, so the missing telemetry for remove.runtime-endpoint is a pre-existing gap, not introduced by this PR.

However, since:

  1. The PR title states "wire telemetry into all remove.* commands"
  2. remove.runtime-endpoint exists as a removable resource (has been since before this PR)
  3. This PR is specifically about completing telemetry coverage for remove commands

...it would be most consistent to address remove.runtime-endpoint in this PR rather than leaving it as the one exception.

Options:

Option A (Recommended): Add RuntimeEndpointPrimitive.ts to this PR's scope

  • Small change (~10 lines)
  • Achieves the "all remove.* commands" goal stated in the PR
  • Maintains consistency with the telemetry instrumentation effort

Option B: Explicitly document that remove.runtime-endpoint is out of scope

  • Update PR title/description to clarify which commands are included
  • Create a follow-up issue to track remove.runtime-endpoint telemetry

Let me know which approach you prefer!

@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 5ac07cb to 2f065b0 Compare April 30, 2026 22:02
@github-actions
Copy link
Copy Markdown
Contributor

Overall Assessment

Code Quality: ✅ Excellent

This PR demonstrates strong software engineering practices:

  1. Consistent pattern application - Follows the established telemetry instrumentation pattern from feat: wire telemetry into all add.* commands #1050
  2. Clean refactoring - The generalization from withAddTelemetry to withTuiTelemetry is well-thought-out
  3. Type safety - Proper use of TypeScript generics and type constraints
  4. Test coverage - Integration tests verify the telemetry actually works
  5. Documentation - Type casting is justified with safety comments

Architecture: ✅ Sound

The telemetry wiring correctly separates concerns:

  • CLI paths → cliCommandRun (handles exit codes and error formatting)
  • TUI paths → withTuiTelemetry (preserves result objects)
  • Both paths record the same telemetry via withCommandRun

Completeness: ⚠️ One gap

The only issue is the remove.runtime-endpoint gap discussed above. Once that's addressed (or explicitly scoped out), this PR will be in excellent shape.


Great work overall! The implementation is solid and the pattern is maintainable. 🎉

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M strands-running labels Apr 30, 2026
@agentcore-cli-automation
Copy link
Copy Markdown

Reviewed the diff end-to-end and didn't find any merge-blocking issues. The CLI path refactor in BasePrimitive and RuntimeEndpointPrimitive preserves the original JSON output shape on both success and failure (via errorContext for the failure side), and the withTuiTelemetry generalization correctly handles both the fn()-throws and fn()-returns-failure cases. Typing of SubCommand<'remove', ResourceType> with CommandAttrs collapsing to {} for NoAttrs commands is sound.

One minor note (non-blocking): the PR description says withAddTelemetry is kept as a deprecated alias, but the symbol is actually fully removed — all internal callers were migrated. Either update the description or add the alias, but since nothing outside the package imports it, this isn't a real concern.

LGTM.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 2f065b0 to 9ecf1be Compare April 30, 2026 22:11
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 9ecf1be to 304bda5 Compare April 30, 2026 22:19
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-remove-commands branch from 304bda5 to 86abe2d Compare April 30, 2026 22:23
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Apr 30, 2026
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.

2 participants