Repository navigation
feat: run a chat in a Kiro Cloud Sessions sandbox - #21260
iamwhatever merged 1 commit into
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, confirm that a real KAS session started with [DESIGN-REVIEWED] 4c92545 Description read[DESCRIPTION-READ] 3f232dfb4047728e14e5e5489d2454d462fd4adb5da7dcf394e6b7dd1670e5df That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS Preserving replayed approvals across a reopen ships five pieces of machinery beyond the Goal, when the existing audited reject already handles the replay safely. Not justified as shipped
What this change shipsInventory (10 items) — 7 justifiedIntent: let a user hand a chat to their Kiro Cloud Sessions sandbox from the environment chip. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 4c92545 Description read[DESCRIPTION-READ] cff6c78e189dd70dfa22641c678133be0506ad48b97c3f46ee157ef0f9f59d82 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS First-time users can't tell what to type in the Repositories field, and a stale-placement race flashes a red error for a chat that is fine. Watch
Suggestions
[UX-REVIEWED] 4c92545 Description read[DESCRIPTION-READ] ecd6b6b6b3dd93a482e93fe503283a41f2d0adb8c3996c1d2dea3f5d54ffe719 That sha256 names everything this verdict read: the PR description, plus the 11 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
6b91cb7 to
47b1810
Compare
b66eeee to
f184c66
Compare
5da3123 to
9c027ca
Compare
9c027ca to
91efcec
Compare
f184c66 to
42c29b1
Compare
cde57d6 to
cf8307a
Compare
cf8307a to
f87434b
Compare
5d02699 to
25aeda8
Compare
f87434b to
60d58f7
Compare
60d58f7 to
c017d8c
Compare
A Kiro Cloud profile asks KAS to place the session in a Kiro cloud sandbox with the _meta.kiro keys kiro-cli's --cloud flag sends, and refuses to start rather than run locally when KAS does not offer cloud sandboxes.
|
HOLD at 4c92545. This needs a human reviewer, and it cannot be approved yet in any case. What blocks approval:
Checks are green on this head. — crew-pr-reviewer (r113) |
|
|
|
|
|
|
|
|
HOLD at 4c92545. This still needs a human reviewer and cannot be approved yet. Thanks for the dispositions. The First Principles items and two UX items are rebutted with reasons. Two UX items are marked fixed in commit What still blocks approval:
Checks are green on this head. — crew-pr-reviewer (r116) |
Problem / Motivation
Goal: Let a chat run entirely in a Kiro Cloud Sessions sandbox, chosen from the same environment chip as a Coder workspace.
Session Environments (#19833) moves a chat's files and shells to a Coder workspace, but the agent itself always runs on the gateway. A user who already has Kiro Cloud Sessions cannot hand a chat to that sandbox from Kiro Crew; kiro-cli's own
--cloudflag is the only way in.Why it matters
A chat can borrow Kiro's managed cloud sandbox, with its repositories checked out there, without anyone running Coder infrastructure. Because that sandbox sits outside Kiro Crew's tool gate, the operator has to opt in deliberately, and an enterprise policy has to be able to keep it off.
Not a goal
What changed (motivation → approach → change)
A Session Environments profile can say "run this whole chat in Kiro's cloud". Kiro Crew does not build a sandbox. It asks KAS for one with the same
_meta.kirokeys kiro-cli's--cloudflag sends, confirmed against the installed kiro-cli 2.21.1's ACP client (newSession/loadSession). It refuses to start, rather than run locally, when KAS does not offer acloud-sandboxtarget.src/kiro_crew/config,config-baseline.json,src/kiro_crew/dashboard(handlers/core.py)session_environments.kiro_cloud_profiles: at most 20{id, name, repositories}records, each with at most 10owner/namerepositories. A save that gives one id to both a Coder and a Kiro Cloud profile is refused with 400profile_id_collision, writing nothingsrc/kiro_crew/platform(governance_parts/catalog.py),src/kiro_crew/coder(session_launch.py),src/kiro_crew/session_allocation_parts(get_or_create.py)capabilities.kiro_cloud_sessions, opt-in. When the policy or the session's profile sets ANY other scope, a cloud start needs that row enabled in the POLICY; a profile can withdraw it, never grant it. The profile is the one the session's tool calls get: app-bound first (the chat slot's own app, which session allocation sets on the provider asowning_app; never transcript metadata), then agent, then surface. An unreadable ceiling refuses. Every decision writes a SEL governance eventsrc/kiro_crew/coder(session_launch.py,session_browse.py)prepare_for_sessionreturnsPreparedCloudSession; the cloud id is recorded only if the same provider and profile are still chosen, else the start fails and the runtime is killed. Browse raisesCloudSandboxOnlybefore any Coder callsrc/kiro_crew/acp(harness/kas_cloud.py,harness/base.py,runtime.py,session_handle.py,session_handle_turn.py,session_handle_lifecycle.py,session_handle_runtime_contract.py,session_provider.py),src/kiro_crew/providers(acp_runtime_start.py,acp.py,base.py),src/kiro_crew/session_lifecycle_parts(fleet.py)KasCloudSandboxHarnesssendsexecutionTarget: cloud-sandboxplus the repositories (orisEmptyWorkspace), no MCP servers and no custom agent; every other host's request is unchanged (session_requestseam, harness-parity H13). Replayed approvals are held by a resume hold only the provider's cloud start takes (hold_cloud_resume; the runtime'sload_sessionis unchanged), plus two reader seams (holds_replayed_permission,unroutable_permission) every other host answers as a no-op, so the runtime's shared start and resume paths never test for the cloud harness. The cloud-only branches are the cloud harness itself, the provider's cloud start, and the handle's drain and teardown, which readis_cloud_sandbox. The keep-running rules belowsrc/kiro_crew/dashboard(chat_runner.py,chat_turn/turn_spec_hooks.py,handlers/session_environments.py),src/kiro_crew/context_assembly(turn.py)meta.kind = cloud_session_replayed); the environment endpoint returns the recorded provider; browse and file routes answer 409cloud_sandbox; the[PROJECT]line names the sandboxwebsite/src/pages,website/src/components,website/src/api,website/src/app-sdk,website/src/i18ncloud_sandboxis a rejected request and renders as anErrorNoticewith Ask the agent (no tree, Refresh or terminal), like any other listing failure; the error card renderscloud_session_replayedin the reader's language. Strings in all 12 catalogssrc/kiro_crew/change_card_catalog.py,docskiro_cloud_profilesanddefault_profileare code-exec. Specs:providers.md,acp-client.md,session.md,config.md,governance.md,docs/feature-map/README.mdBackwards compatibility
Compatible:
kiro_cloud_profilesis a new optional key, empty by default, so every existing profile, chat and save behaves as before. Every new runtime branch (no drain cancel, held approvals, local-only teardown, the startup notice) is keyed on the cloud harness, so other hosts keep their wire and teardown. One change-card classification moves: editingsession_environments.default_profileshows the code-exec card; the values it accepts are unchanged.Readers that now meet a
kiro_cloudchoice row, unchanged by this PR, each staying closed:session_environment.session_runs_remotelyanswers True, so local-only tools stay refused for a cloud chat, as for a Coder one.coder/retention.py:warn_unsaved_workaskssession_browse.unsaved_work, whose_resolveraisesCloudSandboxOnly; the check logs it and the archive goes on with no notice.providers/acp_lifecycle.py:_bound_remotelyanswers True, so a non-runtime backend refuses withREMOTE_NEEDS_KASinstead of starting locally.setting.changecard forsession_environments.default_profilenow asks for code-exec approval.Removes nothing: no key, route, tool or setting goes away, and the
session_requestseam returns its inputs unchanged for every existing host, and the two reader seams do nothing on them.Cloud session lifecycle
The cloud agent keeps running when Kiro Crew lets go of it, so Kiro Crew never cancels or deletes it on its own:
turn_survives_disconnectis true. A user's Stop still cancelssession/loadwith the recorded id andsessionSource: remote; no second sandboxsession/newno handle was returned forsession/newanswered, a latesession/newanswer nobody adopts, and the entitlement probe's own session. Asession/loadnever counts, so a failed reopen keeps its session_kiro/session/deletecannot be undone, so removing a Kiro Crew row is not taken as consent to destroy it. Sessions Kiro Crew no longer points at are listed and deleted in Kiro Web (app.kiro.dev) or the IDE's cloud-session menu (Delete Session), per Kiro's docsA chat's environment locks only once Kiro's cloud holds the session; a start refused before then leaves the chat free to move back to this machine. Riders:
default_profilemoves from cannot-widen to code-exec, because a default can now bind every new chat to a sandbox outside the tool gate;Kiro Cloud Sessionsjoins the i18n glossary.Stack
feat/session-environments-codermainfeat/session-environments-gitfeat/session-environments-healthfeat/session-environments-sprites-boxdfeat/session-environments-fargatefeat/session-environments-kiro-cloudfeat/session-environments-git-panelMerge order: #19833 first; then #21256 and #21259; then Sprites/boxd, Fargate, this PR and the Git panel PR, each on #21256. This PR adds nothing to #21256's git proxy, because a cloud session has no git proxy. It carries no Git panel: whichever of this PR and the Git panel PR lands second adds the panel's cloud placement (a neutral notice for a recorded cloud chat, an error for a refused request) and its test, reusing this PR's
cloudSandboxstring.Tests
test/test_kiro_cloud_session.py(new, 104 tests against a KAS stub): thesession/new/session/loadshapes, the empty workspace, and the refusal when KAS offers nocloud-sandbox. Governance: a ceiling on any scope refuses until the policy opts in; a profile cannot grant; an unreadable ceiling refuses; every decision is audited. Lock: a refused start can move back; a cleared, Coder or other-cloud choice during the reply fails the start and kills the runtime. Keep-running: the drain andclose_allsend no cancel or delete for a cloud turn while an ordinary KAS turn still cancels; the next start reloads the same id; a replayed approval reaches the normal approval event, also with a stranded request queued behind it, and an unregistered one expires; every served host answers the reader seams as a no-op, the shareddestroyand turn drain carry nogetattrprobe foris_cloud_sandbox, the runtime'sload_sessiontakes no hold, and the provider's cloud start does; only incognito/temporary chats delete; a refused cloud start, an unadopted latesession/newand the entitlement probe delete the session they minted; a failed reload after a successful load deletes nothing; the fallback notice is logged and surfaces once, including through a real dashboard turn (test/turn_harness.py'srun_turn; removing the call in_run_chatfails it).test/test_session_environments_config.py,test/test_change_card_setting_classes.py,test/test_session_environments_start_gate.py: round-trip and collision refusal,default_profileis code-exec, a cloud-only config counts as configured.test/test_acp_bindings.py,test/test_acp_harness_contract.py,test/test_acp_runtime_load_session.py,test/test_harness_parity.pyfollow the new property and the moved_load_sessionbody.website/src/test/SessionEnvironmentsCard.test.tsx(the cloud section sits outside Coder's steps, with its own labels and plain-view cost),website/src/test/RemoteFilesPanel.test.tsx(a recorded cloud placement renders an info notice with no browse call; a 409cloud_sandboxbrowse is an alert with Ask the agent and no Refresh, tree or terminal, and a real listing failure stays an alert with Ask the agent),website/src/test/SessionEnvironmentChip.test.tsx,website/src/test/ErrorCard.test.tsx(the replay error is localized),website/src/test/settingsCoverage.test.ts.session_lifecycle_parts, the harness base, the answer task,load_sessionor the session-environment handlers, plus the remote git and remote session suites: ona5e034a313, 6939 passed (every test naming the session handle,terminate_session, the cloud placement or the session-environment launch, browse and handlers, plus the gate and binding suites) and 30769 (every test naming the governance catalog, the chat runner and turn hooks, allocation, the fleet drain, change cards or config sections). Of the rest,test_markdown_agent_specs::test_the_strict_listing_raises_where_the_glob_reads_an_empty_directory,test_acp_refactor_facade::test_every_facade_patch_the_scan_cannot_resolve_is_a_listed_one,test_tool_call_classification_provenance_bound::test_a_payload_the_encoder_could_not_render_is_refused_not_retained_unmeasured,test_harness_parity::test_added_line_gate_reports_without_enforcingandtest_backend_cards_advertised::test_no_new_runtime_site_gates_a_field_backed_line_on_a_setfail identically on this PR's base;test_dashboard_server_composition_contract's boot-chain test failed only in a worktree carrying old built app files and passes on a fresh checkout of this head;test_slot_create_default_agentpassed on its own rerun. Reverting either relocated cloud hunk (the replayed-approval hold in the turn owner, the private-chat delete in the lifecycle owner), or discarding a held replay's id on its first drain read, or skipping the cloud start's resume hold, or not marking a minted session unclaimed (refused start, late answer, probe), makes its test fail. The five frontend files, 156 passed.tsc(npm run typecheck),i18n:check, eslint on changed TS/TSX, flake8 and isort on changed Python, mypy on the 27 changed source modules, the black gate andscripts/docs_lint.pypass.Manual verification
Not verified against a real cloud account. Whether a cloud turn actually keeps running after the local KAS relay stops has not been tested against a real Kiro Cloud Sessions account. Every test here ran against local KAS stubs; the keep-running behaviour above is what Kiro Crew sends and stops sending, and the claim that the cloud keeps the turn comes from Kiro's docs.
KAS limits, as found:
us-east-1onlycloud-sandbox, including a gateway restart mid-turn, a reopen with a pending approval and asession/loadresume.Screenshots / video
Captured from this head's components in a Vite dev server on 127.0.0.1, with every
/apicall answered from fixtures (no gateway, no KAS).Settings, the Kiro Cloud Sessions section after Coder's steps: what opting in gives up, setup steps open (step 1 names the backend as the Agent Harness picker shows it, "KAS (kiro-agent)"), the profile expanded with a pending edit, so the sticky save bar shows, and its own Remove and Add buttons:
Files panel. Left: a recorded cloud chat gets an info notice and the panel sends no browse request. Right: a browse request the gateway refuses with 409
cloud_sandboxis a rejected request, so it is an error in its own words ("Couldn't open this chat's files: …") with Ask the agent and no Refresh, tree or terminal:Transcript error after a failed reopen (the error card shows the localized sentence):
Default for new chats, open: a Kiro Cloud profile can be the environment every new chat starts in:
Composer environment chip: a Coder profile shows its directory, a Kiro Cloud profile its repositories, and an empty one "Kiro cloud sandbox":
Light theme and full card
Related Issues
Part of #10433
no linked issue: this PR closes nothing on purpose; #10433 tracks the whole Session Environments stack and stays open until it lands.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)