Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion e2e-tests/harness-custom-jwt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ describe.sequential('e2e: harness with CUSTOM_JWT auth', () => {
harnessName,
'--model-provider',
'bedrock',
'--no-memory',
// Use the default managed memory (no --no-memory): a disabled-memory harness still
// calls bedrock-agentcore:ListEvents at invoke, but the CDK only grants that action on
// the execution role when memory is managed — so --no-memory invokes fail with AccessDenied.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This change masks (rather than fixes) a real user-facing bug: any user who runs add harness --no-memory and then invoke will hit the same AccessDeniedException on ListEvents at runtime, because the harness still calls ListEvents on a service-managed memory even when the CLI/CDK has skipped the IAM grant.

The PR description acknowledges this ("the harness still calls ListEvents on a service-managed memory at invoke time, so it 403s"), but #1626 is being closed by this fix and there's no follow-up tracking the actual product bug. After this merges, the only E2E coverage we had for the --no-memory invoke path is gone, and the next time someone reports this from the field there'll be no signal in CI.

A few ways to handle this — please pick one before merging:

  1. (Preferred) Open a follow-up bug for "harness with --no-memory fails at invoke with AccessDenied on ListEvents" (CDK should grant the action even when memory is disabled, or the harness runtime should not call ListEvents when memory is disabled — that's for the harness/CDK owners to decide), reference it from CI Failure: harness-custom-jwt bearer-token invoke fails with AccessDenied on ListEvents #1626 so CI Failure: harness-custom-jwt bearer-token invoke fails with AccessDenied on ListEvents #1626 isn't closed without the underlying issue being tracked, and link it from the inline comment here (lines 138–140) so future readers see it.
  2. Keep one E2E case on --no-memory — e.g., split the suite so the deploy/auth-config assertions still run against a --no-memory harness (those don't invoke and won't 403), and only the invoke-based assertions use managed memory. That preserves coverage of the --no-memory add/deploy path.
  3. If the harness runtime calling ListEvents under --no-memory is considered expected and the user-facing remediation is "don't use --no-memory with a harness" (or --no-memory is being deprecated for harnesses), document that in the --no-memory flag help text on add harness so users discover it at CLI time rather than at AccessDenied time.

The cheapest thing is probably (1) — it costs nothing in this PR and keeps the bug visible.


Tangential nit on the PR description (not a blocker): the quoted CDK snippet (const managedMemory = props.spec ? props.spec.memory?.mode !== 'disabled' : harness.managedMemory;) doesn't exist in AgentCoreHarnessEnvironment.ts in agentcore-l3-cdk-constructs on main. The actual ListEvents grant is in AgentCoreApplication.wireMemoriesToHarnesses (src/cdk/constructs/l3/AgentCoreApplication.ts:235-262), gated on harness.memoryName being set — which --no-memory doesn't set, so the effective behavior matches your description, just citing the wrong source location.

'--authorizer-type',
'CUSTOM_JWT',
'--discovery-url',
Expand Down
Loading