Repository navigation
feat: AgentCore login attach and consent - #6600
kyleseaman wants to merge 1 commit into
Conversation
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS
Not justified as shipped
What this change shipsInventory (10 items) — 6 justifiedIntent: let a human's channel/CLI session carry their own identity to the AgentCore Gateway under login posture, while automation and non-managed MCP are withheld — an ADDITION (RFC
[FIRST-PRINCIPLES-REVIEWED] 0f7bd89 |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify the warm-pool claim→discard→replenish cycle under login/workload posture — every human session creation burns one pooled spawn plus a cold start. Suggestions
[DESIGN-REVIEWED] 0f7bd89 |
GPT 5.6 Review — 🔴 changes requested (blocking)GPT 5.6 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/agent.py:1755 -- stale ownership records can delete a user-created agent Adjudication (Opus 4.8) — is blocking on each finding proportionate?The adjudicable block is empty (0 findings). One fenced finding, F1. F1 — Conditions traced in this run:
Recovery path: none — the user's file is unlinked and there is no backup; loss is irreversible. Rarity assessment: The triggering collision (a user naming a custom agent False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsNo findings. The single candidate ( [OPUS-REVIEWED] 0f7bd89 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
e78c0fd to
7397d76
Compare
UX Review (Fable 5) — ⏭️ skippedRevision |
7397d76 to
c6be17d
Compare
c6be17d to
bf26519
Compare
| if not isinstance(servers, dict): | ||
| return | ||
| for name in [n for n in list(servers) if n not in managed_names]: | ||
| del servers[name] |
There was a problem hiding this comment.
[P1] Do not implement withholding by deleting the only durable copy of custom MCP configuration. For an agent-file-only server, enabling login posture removes the entry and writes the reduced config back to disk; switching to workload later has no source from which to restore it. Preserve the authored configuration separately and filter only the emitted session view, or leave these entries untouched until a reversible withholding path exists.
bf26519 to
625dfb5
Compare
701bdf4 to
65debdd
Compare
65debdd to
4e1a20f
Compare
4e1a20f to
706ba27
Compare
|
/ai-review override gpt 2b5f71a: Boot leftover-verify was already rejected because it delays readiness by profile size; Identity PUT and leave-login still rematerialize fail-closed. |
Human judgment recorded@kyleseaman marked the gpt AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
Security Scope Review -- 🟡 CONCERNSWhich legitimate operations does Verdict basis: the reviewer's own judgement; no confirmed regression. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: CONCERNS TIGHTENING: The read+write path fence ( ADJUDICATED: 14 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: posix and windows; no UNADJUDICATED: Four guards in this change take no shell command line, so no verdict is available for them and the honest verdict is CONCERNS:
[SCOPE-REVIEWED] 0f7bd89 |
GPT 5.6 Review —
|
Stage Gateway bind before get_or_create; apply after the per-session lease, immediately before session/new, so concurrent turns cannot overwrite each other's JWT or recycle an in-flight stream. A failed recycle or sidecar unlink raises so the turn cannot continue with a leftover bearer. Authored MCP is merged into an owner-only sidecar with sourceServers deletion tracking so leaving login cannot resurrect a deleted server; --clean discards that sidecar. Unattended is the default: only dashboard, cli_chat, and channel session namespaces bind as a human. A same-named live source does not discard a stashed agent override. A nonempty consent query must bind client_id and redirect_uri. The login leftover-verify catalog fails closed: an app directory whose installed.json the listing could not represent aborts the login emit instead of leaving that app's materialized agents, and their non-managed MCP commands, unrefreshed and loadable.
|
Maintainer note: PR #11780 (merged 2026-09-19, This PR is MERGEABLE, but on this head |
bolichen97
left a comment
There was a problem hiding this comment.
Blocking merge until this is rebased onto post-#11780 main and the removed-symbol references listed in my comment above are dropped. Textually the merge is clean, so nothing else would stop it from breaking main at import time.
|
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. |
Stacked PR 5 of 6. Trust boundary: login-posture inbound attach, 3LO consent, and unattended-session policy.
What this PR does
Login posture stages a per-session
0600inbound sidecar (JWT or URL-only OAuth challenge). Dispatchers callprepare_turn_gateway/prepare_session_gatewayto stage identity.SessionManager.get_or_createinstalls that sidecar under a per-key creation reservation that covers both warm-pool claimants and cold creators, beforeprovider.start(), sosession/new/session/loadcannot read a leftover or concurrent bearer. The reservation is acquired before_drain_and_claimand released by one outerfinallyacross install/start/register — a factory exception, a cancel while waiting for the lock or the start semaphore, or an install failure cannot wedge the key or orphan a claimed pool process (thefinallyputs an unregistered claim back). A warm-pool process already completedsession/newat fill; when AgentCore is on (login JWT or workload SigV4) that process is discarded after install so a freshstart()injects Gateway. After the same-key winner holds the per-session semaphore it applies again and recycles if the fingerprint changed. Attach-before-acquire raced concurrent JWTs and killed in-flight streams; attach-after-return leaked a leftover bearer.Unattended
cron:,taskrunner:,subagent:,hook:,wf:,wf-pool:, andwf-author:prefixes and the exact keys_bg/_hbnever bind. Login inject denial is SEL-audited even when attach was never called.clear_session_principalafterget_or_createwould recycle the provider this turn just acquired, so post-acquire retract is metadata-only. A failed unlink/recycle raisesGatewayCredentialErrorrather than leaving the old bearer active.Rebuild withholds non-managed MCP from the emitted
--agentspec (kirocrew.jsonis the filtered runtime). Authored leftovers are stashed to owner-onlyagentcore-authored-mcp.json. Restore runs after current MCP sources merge (setdefault, current sources win) and the sidecar is unlinked only after the runtime write succeeds, so leaving login cannot resurrect a deleted server.GET
/api/agentcore/consentis owner-dashboard-cookie only. Consent URLs must passsecurity.allow_agentcore_consent_url. Catalog inspect and the consent GET both go throughsurface_consent_url, which SEL-audits grant and deny (host+path only, never token bytes).Inert by default
No capability + no login posture = no sidecar, no withhold, no consent URL.
Two changes to the PR 4 workload path ride along and are intended, not incidental:
Workload
user/OBO sessions without a vaulted owner token are denied Gateway (SEL reasonuser_without_vault), the same rule unattended keys already met. Denial is the absence of a session entry: the Gateway is only ever session-injected and rebuild pops any persisted managed leftover, so no placeholder element is needed and none is emitted. The inject tests were re-keyed fromagent:main:maintodashboard:1because the former is now a denied key under this rule.Gateway boot runs the agent rebuild off the event loop with
app_agent_refresh=Falseso a slow rebuild cannot stall boot readiness; app-agent files are refreshed by the normal rebuild path afterwards.The withhold gate reads the EFFECTIVE posture (
agentcore_aws.resolved_posture, strict mode: ceiling when loaded, else launch env / home authoring), the same read the session attach path uses -- so an env-onlylogininstance (a CloudFormation launch configured through its unit environment, no ceiling document) withholds non-managed MCP at rebuild exactly where it attaches login Gateways; an unavailable ceiling still withholds.Login withhold decides ownership by the FILE kiro-cli resolves (
--agentby declaredname, project dir first, declared name over stem): the app-agent ownership ledger (<config_dir>/app-agent-trust/ownership.json, on the sensitive-path floor and sandbox-masked, written before each spec lands, never replaced when unreadable) plus the manifest say which materialized specs are the app's; a bare declared name is no exemption, a user's<app>--mine.jsonis never touched, unknown ownership fails closed.The authored-MCP stash never mistakes an unreadable source for a deleted one:
_live_source_inventoryreports completeness; on an incomplete inventory the stash writer omitssourceServers(the merge prunes nothing), keeps every source-owned stash entry and its refs as stashed instead of merging the partial extract's entry for it (the runtime spec was assembled from the readable sources only, so an alias the unreadable source owns resolves to a sibling there), passes no partial live specs to the merge (no alias is classified as taken over), and restore likewise skips takeover classification, drops no name and keeps the sidecar.Out of this PR
Tests
test_agentcore_credential_lifecycle.py: factory /_start_semcancel cannot leak the create lock; leftover bearer + concurrent pooled/cold creators; stale JWT replaced before bothsession/newandsession/load; AgentCore-on pool hit discards the fill process and re-issuessession/new(login and workload); identity-off still reuses the pool; cancel-while-waiting-for-lock and install failure return the claim; human first turn injects then synthetic unbind retractstest_agentcore_login_withhold.py: authored sidecar stash/restore; second login rebuild does not overwrite a good stash; sourcemcp.jsonstays byte-identicaltest_identity_topology.py: every human dispatcher namesawait prepare_turn_gatewayimmediately beforeget_or_createtest_agentcore_inspect.py: a refused catalog consent URL is dropped and SEL-auditedtest_agentcore_unattended.py,test_agentcore_consent.pyStacked on #6598. Part of stack #6601. Supersedes #6387.
Credential lifecycle: staged install runs under the creation reservation before
provider.start(); unbind retracts the live Gateway/bearer (ACP recycle + sidecar drop).publish_turn_identitywithout bind is metadata-only so a post-acquire retract cannot kill the provider just created. Authored MCP is stashed toagentcore-authored-mcp.jsonand unlinked after restore. Unattended prefixes includehook:(notchannel:).