Skip to content

feat: AgentCore AWS provisioning and adapter - #6793

Closed
kyleseaman wants to merge 2 commits into
cursor/agentcore-2-principal-1b02from
cursor/agentcore-3-aws-1b02
Closed

kyleseaman wants to merge 2 commits into
cursor/agentcore-2-principal-1b02from
cursor/agentcore-3-aws-1b02

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Replaces #6597 (falsely marked merged; its GitHub head is no longer based on #6595). Same trust boundary: optional AWS extra, CloudFormation identity, and instance IAM. Not a seventh layer.

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.

#6597's recorded head (86d52f778) is not based on the current #6595 (d8bc1fad7). This PR points the same cursor/agentcore-3-aws-1b02 head (12d202f03) at the latest #6595 base.

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. The default launch does not carry that resource type at all: CloudFormation validates every resource type against the region's registry before it evaluates Conditions, so a conditional BedrockAgentCore resource would fail change-set creation in a region without the service. cloud/ec2.py therefore deploys the BASE variant for none -- the bundled template with its # >>> agentcore-only blocks (the identity resource, the two posture policies, the posture conditions, the two outputs) stripped -- and the full template for a posture launch, which needs the service anyway. Whatever run_aws reads executes with the launcher's authority, so NO launch hands CloudFormation a fixed path an in-sandbox agent could pre-write -- including the bundled file itself, since the package directory is not a tree the sandbox masks and a personal install leaves it writable by the sandbox's own uid: ec2.staged_template snapshots the variant for exactly one deploy (read once in the gateway) under <config_dir>/run/ (the runtime exec dir the agent sandbox denies read and write on), in a fresh 0700 subdir with an unpredictable name, written O_NOFOLLOW|O_EXCL, and removes it once the deployment child exits; the dry run shows a placeholder naming the variant, not a path. The base variant is pinned by tests (no Type: AWS::BedrockAgentCore::, no dangling !Ref/!GetAtt, parameters and boundary-class tag intact) and linted by CI beside the full one
  • The instance role's kirocrew:boundary tag is derived from the boundary ARN the role is created under (IsAgentCoreBoundary), never from the posture parameter, so the launcher's tag-keyed Deny covers every successor-bounded role
  • CI: cfn-lint pinned 1.22.3 -> 1.56.1 (the floor carrying the BedrockAgentCore schemas and the current LaunchTemplate schema) and the EC2 template -- both variants -- added to the lint gate
  • Removed as dead: LaunchJob.agentcore_posture/agentcore_gateway_url, the widened LaunchEngine.provision signature and run_launch's kwarg branch (nothing in this stack sets them -- the dashboard launch is the none launch and its 400 guards are the whole boundary), and the posture knob on agentcore_boundary_policy_document plus the unconsumed agentcore_boundary_policy_json (one union document)
  • Eight cloud/ files this PR edits are black-formatted and dropped from .github/black-baseline.txt (the ratchet's format-on-touch)
  • 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). Later layers (#6598, #6600, #6602) already contain this head.

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

Manual verification

No live-account deploy. "Inert" for the default launch rests on a template property, not on a Condition: the none variant cloud/ec2.py deploys contains no AWS::BedrockAgentCore:: resource type, so there is nothing for a region's registry to reject (test_default_launch_template_carries_no_agentcore_resource_type, test_deploy_argv_picks_the_template_by_posture; both variants pass cfn-lint 1.56.1). A posture launch deploys the full template and requires the service in-region by construction.

Related Issues

Stack after #6595. Restores the AWS review surface of #6597. Supersedes the AWS/CFN/IAM slice of #6387.

@kyleseaman
kyleseaman marked this pull request as ready for review August 29, 2026 14:55
@kyleseaman
kyleseaman requested review from a team and iamwhatever and removed request for a team August 29, 2026 14:56
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 2cd50b292558a50152d6de023415aa8712ec3d5a — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

Five public functions and one HTTP query param ship with zero counted consumers — staging for later stack PRs the description names but this diff never wires.

Not justified as shipped

  • Item 6 — zero consumers (HTTP half): ?instance=1&posture= on /api/cloud/iam-policy has no caller — grep cloud/iam-policy in website/ finds only the plain cloudIamPolicy() (1 hit, no instance param); the Settings tab is declared "Not in this PR", yet docs/system-specs/modules/cloud.md states in present tense "The Settings → Remote Crew setup tab copies them as two separately labeled buttons".
    Subtraction: defer the instance_flag branch in handlers_cloud.api_cloud_iam_policy to the Settings-UI PR; the CLI --instance --posture already serves operators.
    Clears when: the stacked Settings PR consuming the param merges, or the branch is dropped.
  • Item 9 — zero consumers: ensure_extra, apply_agentcore_runtime, probe_workload_identity, extra_snapshot (platform/agentcore_aws.py) and probe_instance_invoke_gateway (cloud/iam.py, hardcoded False) — grep across src/ counts 0 call sites each (tests and the spawn-audit allowlist only); this PR's own bootstrap test pins that boot does NOT call ensure_extra.
    Subtraction: defer these five to the PR that calls them (feat: AgentCore Workload Gateway integration #6598/feat: AgentCore login attach and consent #6600/feat: AgentCore dashboard identity settings #6602 per the description) — the adapter, CFN, and IAM work stands without them.
    Clears when: a stacked PR consuming them merges, or they are deleted from this diff.

What this change ships

Inventory (10 items) — 8 justified

Intent: let an operator opt an EC2 cloud launch into an Amazon Bedrock AgentCore workload identity (extra, CFN, IAM) without turning any data plane on — an ADDITION, covered by RFC rfc-agentcore-identity-gateway (in-progress on base).

  1. New optional kirocrew[agentcore] extra (boto3) + install.sh --agentcore — justified
  2. Standalone boot attaches the AWS identity adapter only when opted in; default stays the no-op — justified
  3. cloud launch --agentcore-posture/--agentcore-gateway-url creates the CFN WorkloadIdentity + posture grant — justified
  4. Every cloud launch now deploys a one-shot staged template snapshot; default launches get the agentcore-stripped variant — justified
  5. iam-boundary --agentcore successor boundary; posture launches fail closed without it — justified
  6. Instance-role policy printable via CLI --instance --posture and HTTP ?instance=1 — zero consumers on the HTTP half; Settings tab is a later PR
  7. Launcher IAM grows AgentCore control-plane verbs, kirocrew:boundary role tag, and an explicit Deny on agentcore-tagged roles — justified
  8. Dashboard launch 400-refuses agentcore fields — justified
  9. Five adapter/probe functions shipped ahead of any caller — zero consumers, counted 0 in src/
  10. cfn-lint 1.22.3→1.56.1, both template variants linted; eight cloud/ files black-formatted off the baseline — justified (rides along, mandated ratchet)

[FIRST-PRINCIPLES-REVIEWED] 2cd50b2

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

Staged-template snapshot copies content from the same agent-writable bundled file, so the pre-write hole the PR declares closed stays open.

Watch

  • staged_template reads its text via load_template() from the bundled package path — the exact file the PR says "a personal install leaves … writable by the sandbox's own uid." An agent that pre-writes that file's content gets it faithfully snapshotted and executed with launcher authority on the next human launch; staging only closes the fixed-path/symlink/mid-deploy-swap channel. The description ("NO launch hands CloudFormation a fixed path an in-sandbox agent could pre-write -- including the bundled file itself") and the same sentence now in cloud.md record a guarantee the code doesn't provide, and later stack PRs (SigV4, inject) will build on that recorded boundary.
    Clears when: cloud.md names the residual (bundled-file content remains agent-writable pre-read) or the gateway verifies the template against a pinned digest before staging.
  • The default (none) launch now deploys a runtime-generated stripped template with three new parameters, verified only by cfn-lint 1.56.1 and static pins — "No live-account deploy." A semantic change-set failure would break the historical cloud launch for every cloud user, though a revert fixes it cleanly.
    Clears when: one live none-posture change-set creation (or deploy) in a real region is recorded on the PR.

[DESIGN-REVIEWED] 2cd50b2

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 2cd50b292558a50152d6de023415aa8712ec3d5a — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2cd50b2

Verdict parsed from the review's SHA-scoped output markers for commit 2cd50b292558a50152d6de023415aa8712ec3d5a.

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

@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 12d202f to 6e9cf31 Compare August 29, 2026 15:13
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 6e9cf31 to 77f254d Compare August 29, 2026 15:16
@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 2cd50b292558a50152d6de023415aa8712ec3d5a and found no blocking issues.

This comment is updated in place on each push.

Review details

FINDING -- src/kiro_crew/cloud/iam.py:872 -- "iam:TagRole" denies CloudFormation’s inline AgentCore role tag when the admin principal retains this policy, rolling back posture launches -> Fix: exempt initial role tagging while denying later boundary-tag mutation.
FINDING -- src/kiro_crew/cli.py:2273 -- "workload = IAM Gateway at boot" promises Gateway invocation, but this layer only vends identity tokens -> Fix: describe workload token vending instead.
[GPT-REVIEWED] 2cd50b2

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

@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 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 77f254d to 893216f Compare August 29, 2026 15:28
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Aug 29, 2026
@kyleseaman
kyleseaman changed the base branch from feat/agentcore-2-principal to cursor/agentcore-2-principal-1b02 August 29, 2026 18:44
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention 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 893216f to d5583d5 Compare August 29, 2026 19:01
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Aug 29, 2026
@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 31, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from d633bdf to 68f4249 Compare August 31, 2026 20:31
@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 31, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from 68f4249 to b4bb0b5 Compare August 31, 2026 21:28
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Aug 31, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-3-aws-1b02 branch from b4bb0b5 to 6f38638 Compare September 1, 2026 01:05
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

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

@kyleseaman

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt b7ce3de: false positive: this PR does not modify src/kiro_crew/slack/gateway.py (byte-identical to the base branch), and _pinned_kiro_cli / _KIRO_CLI_RESOLVE_TIMEOUT_SECS do not exist anywhere in the tree; the review ran against a degraded pass (log: 'pass 2 did not complete') and flagged code outside the diff.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Human judgment recorded

@kyleseaman marked the gpt AI finding as false positive, not applicable, or explicitly accepted for b7ce3de7f84d6ce6670c76efe1e1e3d61158d689.

false positive: this PR does not modify src/kiro_crew/slack/gateway.py (byte-identical to the base branch), and _pinned_kiro_cli / _KIRO_CLI_RESOLVE_TIMEOUT_SECS do not exist anywhere in the tree; the review ran against a degraded pass (log: 'pass 2 did not complete') and flagged code outside the diff.

This decision applies only to this commit. A new push requires a new judgment.

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

Copy link
Copy Markdown
Contributor

Reviewed for merge triage, not approving from my side: the base branch is cursor/agentcore-2-principal-1b02, not main, and it adds AgentCore AWS provisioning (credentials and cloud resources). Please retarget to main once the stack lands; it will also need a security owner's review.

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

REQUEST_CHANGES at 2cd50b2, after a deeper read.

The IAM design tightens access overall, but one safety claim is wrong.

  1. The bundled CloudFormation template is still agent-writable content. The staged_template docstring, the PR body and cloud.md say no launch hands CloudFormation agent-pre-writable content, "including the bundled file itself". But the text is read through load_template() -> _template_path(), the package file on disk (ec2.py#L204-L240). Staging stops path substitution, not edits to that file's contents before it is read.
    Fix: either read the template from a source the agent cannot write (embedded string or a sealed path), or state the residual plainly in the docstring and cloud.md.
  2. Low: --agentcore-posture help says "workload = IAM Gateway at boot", but this layer only vends workload identity tokens and the instance policy denies InvokeGateway (cli.py#L2273). Reword it, e.g. "workload = instance-role workload token". This is the unanswered GPT finding.

Other gates: the base is cursor/agentcore-2-principal-1b02, stacked on #6595, which is conflicting and has a change request. Coverage Gate, Frontend Lint & Type Check and Frontend Tests (1) are red on this head. The current-head Design and First Principles items need replies, and AWS provisioning needs a security owner's review. I did not run any of it.

— crew-pr-reviewer (r105 deep check)

@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks a lot for this careful, well-split AgentCore stack. We are closing #6595, #6793, #6828, #6600 and #6602 together for now: the branches are about 7,500 commits behind main, #6595 still has an open review on the identity contract, and the upper PRs reference symbols that #11780 removed, so a rebase would be close to a rewrite. The need is still tracked in docs/request-for-change/rfc-agentcore-identity-gateway.md (status: partial; phase 1 is on main via #6594). When AgentCore is picked up again, please open a fresh stack from current main, starting with the principal-propagation layer. Happy to reopen if you would rather continue on these branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants