Skip to content

feat: support project aware logging in runtime - #2271

Open
nborges-aws wants to merge 2 commits into
refactorfrom
project-logs
Open

feat: support project aware logging in runtime#2271
nborges-aws wants to merge 2 commits into
refactorfrom
project-logs

Conversation

@nborges-aws

Copy link
Copy Markdown
Contributor

Description

Adds project-scoped Runtime logging commands.

agentcore project log runtime
agentcore project log runtime --name FooRuntime --target production
agentcore project log runtime --name FooRuntime --since 1h --level error

The command resolves a runtime from the current project into its deployed id and target region. The rest is delegated to the existing observability log search/tail implementation. Projects with only one configured runtime can omit --name; projects with multiple runtimes are required to select one explicitly.

This PR also makes the following updates to observability:

  • Generalize the shared logs handler to support both imperative and project commands
  • Move runtime log-group derivation into core/observability (previous lived in runtime directory)
  • Moves CoreObservabilityClient from runtime handler types into observability
  • Generalize project resource selection for reuse by invoke and logging commands.
  • Remove the legacy observability client
  • updates documentation with project commands

Type of Change

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

Testing

How have you tested the change?

  • bun run test (3169 pass, 0 fail)
  • 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.

@github-actions github-actions Bot added the size/xl PR size: XL label Sep 10, 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 10, 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 10, 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

Clean refactor + feature. Highlights I checked:

  • src/core/observability.ts is split into observability/{runtime,insights,client,traces,types}.ts, and the old ObservabilityClient.resolveDeployedRuntime + handlers/runtime/resolveRuntimeTarget.ts are deleted with no remaining callers (git grep resolveDeployedRuntime|resolveRuntimeTarget|DeployedRuntime on pr2271 is empty). The CoreObservabilityClient interface moved to core/observability/types.ts and is re-exported from core/observability/index.ts, and TestObservabilityClient was trimmed to match — no dangling references.
  • The deleted observability.test.ts coverage is preserved: runInsightsQuery and sanitizeQueryValue in core/observability/insights.test.ts, runtimeLogGroup in core/observability/runtime.test.ts, and listTraces/getTrace behavior via handlers/runtime/traces/traces.test.tsx.
  • project log runtime uses the same projectManager.resolveDeployedResource seam as project invoke, and pins the region off the resolved target rather than the ambient one. selectProjectResource was extended with an operation string and moved up to handlers/project/selection.ts, and both invoke callers pass "invoke" — no stale imports.
  • The new handlers/project/log/runtime.test.tsx sticks to the recommended pattern (real tempdir + ProjectSpecSchema.parse + fake ProjectBackend at the domain seam, no fs mocks). Telemetry is emitted by the router's cli.command_run for all commands, so the new subtree is instrumented automatically.

Nothing needs to change before merge.

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

codecov-commenter commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.64865% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.93%. Comparing base (9d8cdbd) to head (b8b8877).

Files with missing lines Patch % Lines
src/handlers/project/selection.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2271      +/-   ##
============================================
- Coverage     97.04%   96.93%   -0.12%     
============================================
  Files           566      567       +1     
  Lines         39353    39231     -122     
============================================
- Hits          38190    38027     -163     
- Misses         1163     1204      +41     

☔ 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.

@nborges-aws
nborges-aws added this pull request to stack #2274 September 10, 2026 19:06
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 10, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 10, 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 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants