Skip to content

fix(policy): support generated policy definitions - #2021

Merged
notgitika merged 1 commit into
aws:mainfrom
aidandaly24:fix/policy-generation-policy-definition
Aug 18, 2026
Merged

fix(policy): support generated policy definitions#2021
notgitika merged 1 commit into
aws:mainfrom
aidandaly24:fix/policy-generation-policy-definition

Conversation

@aidandaly24

Copy link
Copy Markdown
Contributor

Description

agentcore add policy --generate assumed generated statements always used
definition.cedar.statement. After the Policy service's Dogwood rollout, valid generated
statements can instead use definition.policy.statement, causing the CLI to report that no Cedar
statement was found even though generation succeeded.

This change:

  • accepts generated statements from either supported PolicyDefinition member
  • surfaces service findings when an asset contains no statement
  • adds SDK-boundary regression tests for Cedar, Policy, and invalid generation assets

Related Issue

Closes #2020

Documentation PR

N/A - this restores the documented policy generation behavior.

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 (N/A - no asset changes)

Focused unit tests:

npx vitest run --project unit \
  src/cli/aws/__tests__/policy-generation.test.ts \
  src/cli/primitives/__tests__/PolicyPrimitive.test.ts

Test Files  2 passed (2)
Tests      10 passed (10)

Also verified the changed files with Prettier and git diff --check.

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 (N/A - no documentation change required)
  • 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.

@aidandaly24
aidandaly24 requested a review from a team August 18, 2026 14:57
@github-actions github-actions Bot added size/m PR size: M agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 18, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Aug 18, 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 Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.27.0.tgz

How to install

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

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 18, 2026

@notgitika notgitika 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.

thank you for the fix this looks good to me!

@notgitika
notgitika merged commit 85b953e into aws:main Aug 18, 2026
33 of 35 checks passed
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.

agentcore add policy --generate returns "no Cedar policy statement was found" in us-west-2

2 participants