Skip to content

feat: AgentCore Workload Gateway integration - #6828

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

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

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

PR 4 of 6 in the AgentCore stack. Workload inbound is IAM. kiro-cli cannot SigV4-sign InvokeGateway, so the unsigned Gateway hostname must never reach the agent file or session/new. This is the focused security-review slice.

A wiring gap here is an unsigned Invoke to a customer Gateway, or a bearer stuffed into ~/.kiro/agents/kirocrew.json. That review should not also cover OAuth consent or Settings UI.

What changed

  • Localhost 127.0.0.1 reverse proxy (preferred port 18765). HMAC-bound session token (X-Kirocrew-Proxy-Auth + X-Kirocrew-Proxy-Session); hop-by-hop headers are stripped before AWS.

  • SigV4 upstream is pinned to *.gateway.bedrock-agentcore.<region>.amazonaws.com.

  • Request-time recheck requires agentcore_posture == "workload" (not any AgentCore posture) and evaluates the calling session's profile, not the host profile.

  • Workload gateway_mcp_spec() returns the proxy listen URL, or None if the proxy cannot start. session/new injects only that loopback URL.

  • Default Kiro sessions use AcpRuntime; _mcp_servers_for_session injects the per-session Gateway alongside pooled MCP servers (not only AcpClient).

  • Dashboard inspect routes (/api/agentcore/gateway{,/verify,/sync}) lazy-import agentcore_inspect on first request so gateway boot does not load the optional AgentCore subsystem.

  • Proxy authentication is bound to a per-session GENERATION, not the session key alone: the inject registers a fresh nonce for the key on the live proxy before session/new (GatewaySigV4Proxy.register_session / session_headers), the X-Kirocrew-Proxy-Auth digest is HMAC'd over key, agent and generation, and every hop must present the currently registered generation (X-Kirocrew-Proxy-Generation, never forwarded). Registering the same key again replaces the generation, so a stalled predecessor whose key a successor reuses cannot regain signing authority through the successor's liveness (proxy_generation refusal). The inject retires the key's existing generation FIRST (retire_proxy_session), before its own gates, so a successor the gates deny still ends the predecessor's signed hops, and a replacement is minted only after every gate passes; teardown may retire_session. The per-hop liveness check counts a key whose session/new is still in flight (an allocation reservation) as live, since the Gateway MCP initialize happens inside that window.

  • The Gateway-URL withhold is a FINAL-map rule (platform.governance.strip_ungoverned_auto_approve -> withhold_agentcore_gateway_entries), so a Gateway URL from an app manifest, a per-agent MCP policy, the ambient mcp.json copy, an edition extra or the operator's override is withheld wherever it lands and regardless of a co-present command. The inject gate and the proxy recheck read the EFFECTIVE posture and URL (agentcore_aws.resolved_posture / resolved_gateway_url), so an env-only CloudFormation instance receives its Gateway while a loaded ceiling still outranks env.

Not in this PR: login inbound sidecars, OAuth consent, Settings identity UI. Dashboard Gateway sync stays in PR 6 and is operator-gated there.

Stacked on #6793.

Tests

  • test_agentcore_sigv4.py: region parse, HMAC bind, upstream pin, test_proxy_recheck_refuses_login_posture, test_proxy_recheck_uses_calling_session_profile
  • test_agentcore_gateway_inject.py: sanitize drops headers; session injects loopback and refuses unsigned https
  • test_agentcore_inspect.py: snapshot codes, owner-only handlers

Related

Stack after #6793. Supersedes the Gateway/SigV4/inspect slice of #6387. Replaces #6598, which GitHub stopped dispatching pull_request reviews for (same class as #6597 → #6793).

@kyleseaman
kyleseaman requested review from a team and pepmach and removed request for a team August 29, 2026 18:44
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 29, 2026
@kyleseaman
kyleseaman changed the base branch from feat/agentcore-3-aws to cursor/agentcore-3-aws-1b02 August 29, 2026 18:44
@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 4faaf420efc4001cc483fc8ac26965f43e3921d0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4faaf42

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

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

Mutating POST /api/agentcore/gateway/sync ships here while the description says "Dashboard Gateway sync stays in PR 6" — a scope contradiction inside the self-declared security-review slice.

Watch

  • The description's "Not in this PR" line defers Gateway sync to PR 6, yet the diff registers /api/agentcore/gateway/sync calling client.synchronize_gateway_targets(...) — a mutating AWS control-plane action reachable from an owner dashboard cookie today. A reviewer trusting that line skips the one mutating surface in the PR; PR 6's reviewer will assume it isn't live yet. It is owner-gated and SEL-audited, so the harm is misdirected review, not an open door — but a focused security slice must not carry a deferred-on-paper mutation.
    Clears when: the description is corrected to own the sync endpoint (or the route moves to PR 6).
  • The proxy admits at most PROXY_MAX_INFLIGHT = 16 handlers process-wide and closes over-cap connections without any response, and authenticated streams are cut after 300 s of quiet. If kiro-cli holds a standing streamable-HTTP GET per session, ~16 concurrent sessions exhaust the pool and every further session's Gateway call dies as a connection reset that looks like a dead proxy.
    Clears when: evidence that kiro-cli's Gateway transport does not hold standing per-session connections, or the cap scales per session / rejects with 503.

Suggestions

  • On slot exhaustion, send a 503 before closing so MCP clients can distinguish overload from a downed listener.

[DESIGN-REVIEWED] 4faaf42

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of 4faaf420efc4001cc483fc8ac26965f43e3921d0 — 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

POST /api/agentcore/gateway/sync mutates the AWS control plane with zero consumers, while the description itself defers "Dashboard Gateway sync" to PR 6.

Not justified as shipped

  • Item 8 — zero consumers: a state-changing endpoint (SynchronizeGatewayTargets on the customer's account) ships with nothing calling it — grepped api/agentcore under website/: 0 hits — and the description says "Dashboard Gateway sync stays in PR 6 and is operator-gated there."
    Subtraction: defer the /sync route, api_agentcore_gateway_sync, and synchronize_target to PR 6, where the panel that calls it and its operator gate land; the read-only catalog snapshot is untouched.
    Clears when: a counted consumer (the PR-6 Security-tab panel) calls the route, or the route is deferred to that PR.

The deleted pins (test_importing_the_module_does_not_import_sigv4, the workload-returns-hostname assertion) each carried "a later PR rewrites this onto a localhost SigV4 proxy" in their own text — the reversal is the recorded plan, not a finding. The whole shape (SigV4 proxy, session-only inject, catalog/verify/sync) is covered by rfc-agentcore-identity-gateway at in-progress on the base, so no product-shape trigger.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a deployed workload-posture crew reach its AgentCore Gateway tools from kiro-cli, which cannot SigV4-sign, without the unsigned hostname or a bearer ever persisting — ADDITION.

  1. kiro-cli sessions can now call Gateway tools via a localhost SigV4 proxy injected on session/new — justified
  2. Gateway-URL MCP entries (any name, even with a command) are withheld from every generated agent config — justified
  3. Proxy hops require an HMAC session token bound to a per-session generation; retired or reused keys get 401 — justified
  4. Each hop re-checks the calling session's profile ∩ policy after the body is read, before signing — justified
  5. Default dashboard/channel sessions (AcpRuntime) receive the same inject as the client path — justified
  6. Subagent and task-step children bind Gateway identity to the child agent, not the parent's — justified
  7. Owner-only GET /api/agentcore/gateway and POST …/verify return a live catalog snapshot — justified
  8. POST /api/agentcore/gateway/sync asks AWS to re-sync one target — zero consumers (see above)
  9. New KIROCREW_AGENTCORE_PROXY_PORT env var with preferred port 18765 — justified
  10. Proxy availability hardening: 10 s pre-auth deadline, 16-handler cap, body caps, no double 502 — justified

More than 10 differences exist (SEL audit verbs, feature-map row, weakref session registry); the 10 most observable are kept.

[FIRST-PRINCIPLES-REVIEWED] 4faaf42

@github-actions

github-actions Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — 🔴 changes requested (blocking)

Reviewed 4faaf420efc4001cc483fc8ac26965f43e3921d0 — this comment is updated in place on each push.

Newly added withhold_agentcore_gateway_entries guard is bypassed by a URL fragment or userinfo, so a managed-Gateway MCP entry is persisted into the agent config and mounted ungoverned.

[BLOCK-MERGE] 4faaf42
BLOCKING — src/kiro_crew/platform/governance.py:4229

    return is_agentcore_gateway_url(url)

is_agentcore_gateway_entry reuses the signing-strict predicate, whose guard if parsed.scheme != "https" or parsed.username or parsed.password or parsed.fragment: return False (agentcore_sigv4.py:1890) rejects any Gateway URL carrying userinfo or a #fragment. Input: an MCP entry — operator override, ambient mcp.json, edition extra, or an untrusted app manifest reaching bridges._strip_ungoverned_auto_approve — with url = https://abc.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp#x (a functional Gateway URL; the fragment is client-side only). Path: _merge_edition_mcp / withhold_agentcore_gateway_entries → is_agentcore_gateway_entry → is_agentcore_gateway_url returns False → entry NOT withheld → written to kirocrew.json and mounted as a plain remote in every session, including ones whose profile denies capabilities.agentcore, with any bearer headers persisted (in login/JWT posture the bearer authenticates → ungoverned Gateway access) — the exact bypass the withhold exists to prevent.
Fix: match on host only in is_agentcore_gateway_entry — parse the URL and test _GATEWAY_HOST_RE against parsed.hostname, independent of scheme/userinfo/fragment — instead of delegating to the signing-strict is_agentcore_gateway_url.

[OPUS-REVIEWED] 4faaf42

Verdict parsed from the review's SHA-scoped output markers for commit 4faaf420efc4001cc483fc8ac26965f43e3921d0.

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

@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 29, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-4-gateway-r2-1b02 branch from 578e377 to 593dc6a Compare August 29, 2026 19:02
@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-4-gateway-r2-1b02 branch from 593dc6a to d1a8bea Compare August 30, 2026 12:01
@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 30, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-4-gateway-r2-1b02 branch from d1a8bea to 453644e Compare August 30, 2026 12: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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Aug 30, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-4-gateway-r2-1b02 branch from b572009 to 5f9301e Compare August 31, 2026 21:28
@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-4-gateway-r2-1b02 branch from 5f9301e to e269fcd Compare August 31, 2026 22:18
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Aug 31, 2026
@kyleseaman
kyleseaman force-pushed the cursor/agentcore-4-gateway-r2-1b02 branch from e269fcd to 204b3d2 Compare August 31, 2026 23:04
@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-4-gateway-r2-1b02 branch from 204b3d2 to 9668d5f Compare August 31, 2026 23:36
@chenmingwei23

Copy link
Copy Markdown
Contributor

🤖 Kiro Crew [operator: chenmingwei23#de330d0c]: This PR has been inactive for 7+ days. I reviewed it but it requires your input rather than an automated fix:

  • Scale: this is a new subsystem (AgentCore Workload Gateway integration) at ~9300 added lines across 106 files. That is too much surface for the automated drive-to-green lane to reason about safely and stay within your design intent, so it routes to author.
  • The branch is CONFLICTING (dirty) against main and needs a rebase / conflict resolution that only you can direct given the stack context (PR 4 of 6 in the AgentCore stack).
  • reviewDecision is REVIEW_REQUIRED; the readiness label already reads passed for the current revision, so once you rebase onto main it should be reviewable.

When you have rebased and resolved conflicts, the pipeline will re-assess on its next cycle.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — ⏭️ skipped

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 0c71a197814e7e09b5b90edfef24f6122a4aa333; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

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

@bolichen97

Copy link
Copy Markdown
Contributor

Maintainer queue disposition for 0c71a19: HOLD on the current stack. Direct base #6793 is not review-ready (readiness failure/Design block), and root #6595 has an active contract correction request. This slice does not directly consume #6595's turn-principal bind; the hold is dependency ordering, not a claim that its proxy uses that binding.

Before the post-stack re-review, reconcile the body saying sync is deferred with the shipped gateway/sync route. Also verify fresh-session gateway setup against the reservation-vs-has_session boundary; the focused review identified a possible mount-time refusal before session/new completes. These observations are not approval of the unreviewed remainder. No cloud changes, history rewrite, or merge has been performed.

@iamwhatever

Copy link
Copy Markdown
Contributor

Not approving for now: this PR is stacked on #6793; we'll review it once the base lands.

Workload inbound is IAM. kiro-cli cannot sign InvokeGateway, so the
adapter rewrites gateway_mcp_spec onto a 127.0.0.1 listener and
session/new injects that live loopback URL. The unsigned hostname
never reaches the agent file. Login sidecars and consent stay out.
Loopback is same-host, so each hop carries an HMAC-bound session
token. Request-time signing requires the calling session's profile
to still permit AgentCore and the composed posture to be workload
— login uses JWT inbound, not instance IAM.
@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

needs-author-decision PR blocked on author input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants