Skip to content

feat: AgentCore AWS provisioning and adapter - #6597

Merged
kyleseaman merged 2 commits into
feat/agentcore-2-principalfrom
cursor/agentcore-3-aws-1b02
Aug 29, 2026
Merged

kyleseaman merged 2 commits into
feat/agentcore-2-principalfrom
cursor/agentcore-3-aws-1b02

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

PR 3 of 6 in the AgentCore stack. The optional AWS extra, CloudFormation identity, and instance IAM need their own review before SigV4, consent, or Settings UI land.

Why it matters

Provisioning and credential resolution are a different trust boundary from the localhost proxy and from OAuth attach. Mixing them hid wiring gaps in #6387. This PR is merge-safe and inert: no Gateway inject, no SigV4 listen, no login consent.

What changed (motivation → approach → change)

Goal: land the adapter later PRs attach to, without turning the data plane on.

  • kirocrew[agentcore] extra (boto3) and install.sh --agentcore
  • platform/agentcore_aws.py: opted-in adapter, WAT vending, extra ensure, policy-over-env resolution. Reuses agentcore_schema validators; does not import SigV4
  • Standalone bootstrap swaps agent_identity only when opted_in() and the extra is importable. Does not change profile
  • CFN AgentCorePosture=none|workload|login (default none) creates AWS::BedrockAgentCore::WorkloadIdentity and writes launch env
  • Instance-role posture documents + successor boundary kirocrew-ec2-boundary-agentcore. Launcher Policy.json never carries InvokeGateway
  • CLI --agentcore-posture / --agentcore-gateway-url; dashboard launch stays none

Not in this PR: SigV4 proxy, MCP inject, login withhold/consent, Settings identity UI. gateway_mcp_spec() returns the https Gateway hostname.

Stacked on #6595 (principal).

Tests

  • test/test_agentcore_aws.py: import does not load boto3 or SigV4; opted-in requires posture or name+flag; policy beats env; workload spec is the https URL; WAT / inbound JWT; probe discards the token; bootstrap ensure_extra when opted in
  • test/test_agentcore_iam_posture.py: launcher has no Invoke; workload vs login instance SIDs; successor boundary union; CLI/API labeled sibling
  • Spawn audit allowlists platform/agentcore_aws.py::ensure_extra
  • Cloud launch/IAM/EC2 tests updated for the new parameters

Local: 220 passed on the AWS/IAM/cloud suites; spawn-audit allowlist tests passed.

Manual verification

N/A — inert without a configured posture and the extra. Default launch stays none. Unit coverage is the verification.

Related Issues

Stack after #6595. Supersedes the AWS/CFN/IAM slice of #6387.

Checklist

  • One Conventional Commits commit
  • Tests added
  • Docs updated (cloud.md, platform-context.md, governance.md, install.md)
  • No secrets

UserData now sed-escapes % → %% in the Gateway URL before writing the systemd Environment= line, so a percent-encoded path survives daemon-reload.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 86d52f77823deb6a6877dc2d62e08ad3ed4af072 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 86d52f7

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 86d52f77823deb6a6877dc2d62e08ad3ed4af072: <one-sentence reason>

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

Design-level review of 86d52f77823deb6a6877dc2d62e08ad3ed4af072 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design review complete. I inspected the full diff (adapter, bootstrap swap, IAM/boundary changes, CFN template, launch plumbing, docs) against the PR's stated scope.

Design-Verdict: CONCERNS

Sound staged slice; the single union successor boundary quietly gives login-posture instances a ceiling that includes the verbs login exists to forbid.

Watch

  • Union boundary vs. login posture. The successor boundary is "the same union for both" postures ("SSM-core + source-bucket read + every AgentCore action either posture may grant"), while login's protection against IAM Gateway invoke is only the CFN-attached DenyUserIdAndIamGateway fragment. The launcher policy grants iam:DeleteRolePolicy + iam:PutRolePolicy on tagged kirocrew-ec2-* roles, so the leaked-launcher-credential adversary the boundary mechanism was built for can delete the Deny fragment and inline an InvokeGateway/GetWorkloadAccessToken allow that the union ceiling permits — escalating a login instance to workload capability. Per-posture successor boundaries would cap this; if union stays, say why in cloud.md's residuals list. Public core's probe_instance_invoke_gateway() is always-False, so the fork never detects the mismatch.
  • First AgentCore launch fails with self-defeating advice. The successor "must be admin-pre-created" (launcher gets IamAgentCoreBoundaryRead only), yet deploy() still routes through ensure_instance_boundary(name=AGENTCORE_BOUNDARY_NAME), whose AccessDenied path raises "grant iam:CreatePolicy and retry" — remediation that reintroduces the first-write-race hole the read-only grant was designed to close. Detect the successor name and point at kirocrew cloud iam-boundary --agentcore instead.

Suggestions

  • Put the invoke-gateway probe on the AgentIdentityProvider ABC with a False default rather than a module-level function "a companion must override" — matches the repo's own registration-seam rule and avoids a monkeypatch seam.

[DESIGN-REVIEWED] 86d52f7

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ⏭️ skipped

Revision 86d52f77823deb6a6877dc2d62e08ad3ed4af072 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 9db6b9d0882463c67570da31ce9c6bacfaffd25d — this comment is updated in place on each push.

Review details

No findings.

The one candidate — normalize_agentcore_gateway_url accepting query-string URLs (?…) that the CFN AllowedPattern charset ([A-Za-z0-9._~:/%!=+&,-]) then rejects — does not survive falsification as a reportable defect. The divergence is real, but it fails safe: such a URL is rejected at aws cloudformation deploy (rc≠0 with a parameter-validation error naming AgentCoreGatewayUrl), never accepted. There is no crash, no data loss, and no security bypass — the systemd-injection charset is still enforced by the template's AllowedPattern ($, backticks, @, quotes, whitespace all excluded). The residual is a less-precise error message on an input (query string in a Gateway MCP URL) the discovery pass itself could not establish occurs in practice. That is a UX-quality divergence, not a defect at the 80+ bar, and it is not in any BLOCKING class.

[OPUS-REVIEWED] 9db6b9d

Verdict parsed from the review's SHA-scoped output markers for commit 9db6b9d0882463c67570da31ce9c6bacfaffd25d.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 9db6b9d0882463c67570da31ce9c6bacfaffd25d: <one-sentence reason>

@kyleseaman
kyleseaman marked this pull request as ready for review August 28, 2026 18:56
@kyleseaman
kyleseaman requested review from a team and patrigao August 28, 2026 18:56
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 2c2c666 to 29e0fbc Compare August 28, 2026 19:30
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Aug 28, 2026
@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

Revision 86d52f77823deb6a6877dc2d62e08ad3ed4af072 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 29e0fbc to e36252f Compare August 28, 2026 19:54
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from e36252f to 18d6580 Compare August 28, 2026 20:21
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Aug 28, 2026
Comment thread src/kiro_crew/cloud/iam.py Outdated
"Effect": "Allow",
"Action": [
"bedrock-agentcore:GetWorkloadAccessToken",
"bedrock-agentcore:GetWorkloadAccessTokenForUserId",

@kyleseaman kyleseaman Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P1] Remove caller-chosen user impersonation from the instance role. The agent process inherits these instance credentials, so prompt-injected code can call GetWorkloadAccessTokenForUserId directly for an arbitrary user; the implementation itself never needs this action. The same role also receives SynchronizeGatewayTargets on every Gateway, turning a read-only Settings catalog into account-wide mutation authority available to the agent. Remove both actions from the instance policies, boundary, and CloudFormation mirror, or move mutation behind credentials the agent process cannot access.

@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 18d6580 to b09391c Compare August 28, 2026 20:53
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Aug 28, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 41b841a to bbf8418 Compare August 29, 2026 01:25
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Aug 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from bbf8418 to d3af616 Compare August 29, 2026 01:44
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Aug 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from d3af616 to be3b14d Compare August 29, 2026 02:00
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Aug 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from be3b14d to 57bb997 Compare August 29, 2026 02:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Aug 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 57bb997 to 707e703 Compare August 29, 2026 02:44
Land the inert AWS extra and launch-path identity so later Gateway
and login PRs have something to attach to. Default-off: no policy or
env posture means no boto3, no extra install, no adapter swap.

Workload gateway_mcp_spec returns the https hostname and does not
import the SigV4 proxy; that rewrite belongs in the next PR.
resolved_* reads the composed ceiling first. Workload Allow is
GetWorkloadAccessToken only; UserId stays on the login Deny.
Inspect is Get/List/GetTarget — no Synchronize. Dashboard launch
stays none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant