Skip to content

fix(import): only set resourceName when executionRoleArn is present#996

Merged
tejaskash merged 1 commit intoaws:mainfrom
jesseturner21:fix/import-gateway-resourcename-covariance
Apr 28, 2026
Merged

fix(import): only set resourceName when executionRoleArn is present#996
tejaskash merged 1 commit intoaws:mainfrom
jesseturner21:fix/import-gateway-resourcename-covariance

Conversation

@jesseturner21
Copy link
Copy Markdown
Contributor

Summary

  • Fixes e2e test failure on main where agentcore import gateway fails for gateways without a roleArn
  • resourceName and executionRoleArn must co-vary per the schema refine added in feat: add gateway import command with executionRoleArn support #855. When a gateway has no roleArn, resourceName must also be omitted to pass validation
  • Without this fix, toGatewaySpec always sets resourceName but conditionally sets executionRoleArn, causing the refine to reject the spec

Test plan

  • Unit tests updated and passing (370/370)
  • e2e tests pass on CI (gateway import without roleArn)

@jesseturner21 jesseturner21 requested a review from a team April 28, 2026 17:20
@github-actions github-actions Bot added the size/xs PR size: XS label Apr 28, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Apr 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.11.0.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-996-tarball/aws-agentcore-0.11.0.tgz

@agentcore-cli-automation
Copy link
Copy Markdown

Reviewed the change. The fix is correct and minimal — tying resourceName to the same gateway.roleArn predicate as executionRoleArn preserves the schema refine invariant (co-vary or both omitted), and the added unit tests cover both branches.

One minor semantic observation (not blocking): if a gateway ever does come back from GetGateway without a roleArn, the imported spec will now have neither resourceName nor executionRoleArn, so CDK will attempt to create a new gateway under a generated name rather than adopt the existing one. In practice real gateways always have a role, and the CloudFormation import step would fail loudly if this ever happened, so I don't think it needs to change here — just worth being aware of.

LGTM to merge.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Apr 28, 2026
The refine required both fields to be set together, but resourceName
is always needed on import (to preserve the AWS name) while
executionRoleArn is only present when the gateway has a custom role.
Gateways without a custom role (service auto-creates one) fail the
refine because resourceName is set but executionRoleArn is not.

Keep the individual field validations (GatewayNameSchema for
resourceName, regex for executionRoleArn).
@jesseturner21 jesseturner21 force-pushed the fix/import-gateway-resourcename-covariance branch from 8c017b5 to 2a057ac Compare April 28, 2026 17:32
@github-actions github-actions Bot added size/xs PR size: XS and removed size/xs PR size: XS labels Apr 28, 2026
@tejaskash tejaskash merged commit ad0ee58 into aws:main Apr 28, 2026
23 checks passed
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.

3 participants