Repository navigation
feat: add AWS Fargate session environments - #21258
kyleseaman wants to merge 2 commits into
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the feature is off unless Notes
[DESIGN-REVIEWED] fca5ccf Description read[DESCRIPTION-READ] aba80b348a79c9665a387e32b02d64bfe91c78b4764df7ccf2fa6f4d92b5ddab 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 |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS The blind reader read every primary control correctly. Where they would not click, the reason was a true cost or data-loss warning, not a misreading. Notes
[UX-REVIEWED] fca5ccf Description read[DESCRIPTION-READ] bb287d0ba5091b00fe954319121d39e680773306366850ede512d407ab75be17 That sha256 names everything this verdict read: the PR description, plus the 17 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) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. This adds a new provider behind the existing What this change shipsInventory (10 items) — 10 justifiedIntent: let a chat run its workspace in a disposable AWS Fargate task from the team's own account while the engine stays on the gateway. ADDITION.
[FIRST-PRINCIPLES-REVIEWED] fca5ccf Description read[DESCRIPTION-READ] 781fab0d896ef59fc67ef9c05ca3994d4d1b320b49ee9694ea3857aca7fff54b That sha256 names the PR description this verdict read. 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
88d00ac to
7309946
Compare
|
fixed in 7309946 (span=08229dc59207): the provider cards did not say switching keeps the filled-in profile.
|
|
rebutted (span=1f258adaa6b2): dispatch ignores the recorded provider.
|
|
fixed in 7309946 (span=350ff7d8ed3a): the provider cards did not say switching keeps the filled-in profile.
|
|
fixed in 7309946 (span=3c122ae0eb80): the provider cards did not say switching keeps the filled-in profile.
|
|
rebutted (span=5515aea1d1bd): no limit on how long an unarchived task runs.
|
|
fixed in 7309946 (span=bffbc26c32dd): empty configuration abandoned persisted Fargate sessions.
|
|
fixed in 7309946 (span=c0275a82cd34): first local process to reach the forward could enrol its own secret.
|
|
fixed in 7309946 (span=e045f2d446a7): the provider cards did not say switching keeps the filled-in profile.
|
|
fixed in 7309946 (span=e1c3681301aa): shutdown note read as contradicting its switch and showed to Coder-only users.
|
22e148d to
d61d459
Compare
c017d8c to
762f3dd
Compare
|
rebutted (span=08453b70a647): the
|
|
rebutted (span=2b4cf25a8327): "profile" means three things on one form.
|
|
fixed (span=2b7e2f519eb5): an unreadable Fargate registry skipped
|
|
rebutted (span=2c3b751a5d25): the removed-profile status names the profile for Coder users too.
|
|
fixed (span=42c5f94c4d4c):
|
|
rebutted (span=4b429a74ab78): the shutdown switch reads as on while the note says it has no effect on Fargate.
|
|
fixed (span=6c26e66b79a0): addressed per Kyle: callout added, explicit pricing deliberately out of scope (prices change by region and over time).
|
|
fixed (span=c21bf0a763ee): RunTask tags the task, so the gateway also needs
|
|
rebutted (span=ee0945042710): split
|
|
rebutted for this PR, as a deliberate stack-wide deferral (span=f148083bb7ee): provider dispatch inside
|
|
rebutted (PASS punchline): a 900 s idle exit against a 60 s keep-alive.
|
|
fixed in 56419f9 (span=5604c2afad80): subagent provisioning leaves stale startup progress on its parent.
|
|
fixed in 56419f9 (span=a62dfd9054c0): Fargate settings deep links leave the target hidden.
|
|
fixed in 56419f9 (span=0f5cd9aa4764): keepalive never reconciles a Fargate task that stopped on its own.
|
|
fixed in 43e1796 (span=496b878cf102): an ephemeral-port collision hangs the pipe test.
|
|
HOLD at 43e1796. The base is On this head all AI lanes pass, every earlier GPT and Opus finding has a fixed disposition naming its span, and CI is green. The Design lane notes that no live AWS RunTask, enrol and archive cycle has run yet. Clears when: the lower PRs in the stack merge, this PR is retargeted to — crew-pr-reviewer (r124) |
|
Updated screenshot for 42b287b: Manage now names each Fargate task's chat and profile. |
|
fixed in cf5a7b6 (span=fbe431abb2d2): the Fargate half of the workspaces inventory failed open.
|
|
fixed in cf5a7b6 (span=86880e645bcc): an unreadable Fargate inventory was reported as empty.
|
A session environment profile can run a chat's workspace as an ECS Fargate task reached over SSM, reusing the whole-Crew Fargate lane's placement and task-ARN helpers with its own task tag so neither lane can stop the other's tasks.
- Keepalive: a failed probe asks ECS (rate-limited, authenticated rows only) whether the task is gone, and forgets one that stopped on its own or was purged, without a StopTask. - Start stages: a subagent's Fargate start reports provisioning and connecting on the subagent, not its parent (progress_key). - Settings: a deep link into the Fargate tab opens the tab and the row.
|
fixed in fca5ccf (span=94a4064dda41): a
|
iamwhatever
left a comment
There was a problem hiding this comment.
Request changes at fca5ccf.
The base is now main, so the r124 base blocker is gone. In the parts I read I found no defect: the bootstrap enrols only the secret whose hash the launch pre-committed, every request and answer is MAC'd over a per-connection nonce, the gateway ties the accepted connection to its own session-manager-plugin child before sending anything, and a failed launch stops the task it started.
KiroCrew/src/kiro_crew/fargate_session/launch.py
Lines 327 to 365 in fca5ccf
One item needs a tracked issue: no live ECS run has been done (your Manual verification says so, and the Design lane asks for one before the developer flag is lifted). Please open an issue for a live RunTask, enrol, keep-alive and archive/StopTask cycle as the precondition for un-gating Fargate, and link it in the description.
Separately, this adds a new network path to ECS tasks with its own enrolment protocol, task start/stop on the owner's AWS account, vault-held session secrets and a PID-1 process reaper. Those stay with a human maintainer, so even with the issue linked this needs a maintainer review of the network and task-lifecycle paths. CI is green and the branch merges cleanly.
The UX lane's copy notes (profileRemoved, the stop-on-shutdown note, fargateVsDeploy) are worth folding in but do not block.
— crew-pr-reviewer (r136)


Problem / Motivation
Goal: Let a chat run its workspace in an AWS Fargate task while the agent engine stays on the gateway.
Session environments can run a chat's files, builds, tests and shells on a Coder workspace, which needs a Coder deployment. A team that already runs ECS has no way to give one session a disposable, isolated machine from its own AWS account.
Why it matters
A risky or heavy session can run in a throwaway Fargate task built from the team's own task definition, network and IAM roles, while memory, crons, subagents, approvals and chat history stay on the gateway. When the task stops, nothing is left to clean up.
Not a goal
What changed (motivation → approach → change)
A Fargate profile in Settings > Session Environments lets a chat run its workspace in an ECS task from the owner's own AWS account. The engine stays on the gateway; only files, builds, tests and shells move.
src/kiro_crew/fargate_sessionsrc/kiro_crew/remote_session/fargate_bootstrap.pypython3 -ccontainer commandsrc/kiro_crew/cloudruntask.network_configuration, shared with Deploy my crew so both place tasks the same waysrc/kiro_crew/session_environmentsrouting.py), the Files panel via the bootstrap and the no-terminal refusal (browse.py), archive-time stop, keep-alive, stop retries, shutdown count and SSM forward cleanup (retention.py);src/kiro_crew/codercalls them under its lifecycle lock and sweepersrc/kiro_crew/config,config-baseline.json,src/kiro_crew/docs,src/kiro_crew/change_card_catalog_kinds.pysession_environments.fargate_profileslist (references only, no keys) as a row of thePROVIDERStable, under its cross-provider id check and config-merge safeguard (kept entry by entry, and a Fargate profile can be the default); settings registry, code-exec change classsrc/kiro_crew/dashboard,src/kiro_crew/providers,src/kiro_crew/slackchannel_boot.py) and retention start on a persisted task registry (process_entry.py)website/src/pages,website/src/components,website/src/api,website/src/assets,website/vite.config.tswebsite/src/i18n,website/src/test,test,docsWhat happens to a session's task:
stop_on_shutdownsays (countedskipped); rows and keys stay so a restart reconnects, and its SSM forwards are stopped.Unlimited retention while the gateway is up is the intended contract, confirmed by @kyleseaman: the task is the workspace, so an idle stop would silently delete an unarchived chat's files. The composer picker and Settings state the cost; archiving ends it.
The gateway starts each task from the owner's task definition, tagged with a hash of the session key, and reaches it through one
AWS-StartPortForwardingSessionforward. Enrolment is pre-committed: the gateway draws a 32-byte secret beforeRunTask, puts only its SHA-256 in the container override, and the bootstrap enrols only a secret matching it. The secret goes only to a forward proven to be the gateway's own Session Manager child, and every later request is attested the same way before it is sent; the secret lives in the encrypted vault and every request and answer carries an HMAC. A lost enrolment reply is settled by an authenticated no-op; a command is retried only if its request never left the gateway; an unreadable vault refuses the start rather than replacing the task.A pending stop is a signed marker written before
StopTask; a tampered or foreign row never authorizes one. If the marker cannot be written (full disk), the task is still stopped and the stop held in memory: the keep-alive never renews it, a reopened chat never reuses it, and the sweep retries until the marker saves. A task whose first registry write fails afterRunTaskis stopped at once. A Fargate registry failure never blocks Coder's archive or sweep. Retention starts whenever a task registry exists, and the keep-alive runs on its own clock and probes every task at once, so nothing slow delays a reachable task past its idle exit.The card explains each choice: its own intro on the Fargate tab, a Fargate line among the shutdown switch's per-provider notes, "Removed “”. Discard changes restores it and undoes any other unsaved edits.", and under Manage that a task bills while it runs. In the composer picker a Fargate row reads "Separate cloud machine in your AWS account", and below the rows an info callout says the task bills your AWS account while it runs, gives the same two stop conditions as the Manage hint and the shutdown note, and warns that archiving deletes the files, directly above the "See AWS Fargate pricing" link. Per @kyleseaman, it shows no price or estimate: Fargate prices vary by region and change over time.
Spawn audit:
fargate_session/forward.py::_spawn_ssm(gateway, fixed SSM argv, deliberately notcloud.ssm.open_port_forward, whose human-action gate is for the two operator tunnels) andremote_session/fargate_bootstrap.py::_run(guest only) are allowlisted one by one; no module exemption, no baseline change.Backwards compatibility
Compatible:
fargate_profilesis a new optional list, empty by default. An older client that omits it keeps its Coder-only form, and an existing config holds no Fargate ids, so the new cross-provider id check cannot refuse a save that works today.Removes nothing: Coder sessions, Deploy my crew and local sessions keep every path, route and setting; the shared
network_configurationhelper builds the same RunTask value Deploy my crew sent before.Tests
test_fargate_session,test_fargate_binding,test_fargate_keepaliveandtest_fargate_stop_and_enrollmentlock in the enrolment commitment (test_a_local_process_that_reaches_the_bootstrap_first_cannot_enrol,test_a_bootstrap_without_a_commitment_enrols_nothing,test_a_stranger_racing_the_launch_cannot_take_the_task), refusal of a foreign listener, the HMAC identity, vault-only key storage, tampered-row refusal, durable stop retries, shutdown keeping tasks, keep-alive bounds,test_a_damaged_fargate_registry_never_stalls_coder_archive_or_sweep,test_restart_with_no_profiles_maintains_persisted_tasks,test_a_vault_read_failure_never_stops_a_live_task,test_an_enrolment_whose_reply_was_lost_is_still_ours,test_a_reply_corrupted_in_the_tunnel_is_never_acted_on(the command ran once)test_a_call_that_never_reached_the_bootstrap_is_retried(refused, closed or reset before the greeting)test_a_slow_stop_retry_never_delays_the_live_tasks_heartbeat,test_no_request_is_sent_on_a_connection_that_is_not_the_tasks_forwardandtest_a_stop_whose_record_changed_is_refused_not_reported. Fargate cases intest_session_environments_config,test_coder_retention,test_coder_boot_activation,test_session_environments_start_gate(test_fargate_profiles_alone_resolve_placement) andtest_spawn_audit.test_session_environments_import_boundary(test_fargate_imports_nothing_shared_from_coder) keepsfargate_sessionoffcoder/'s shared pieces, andtest_a_saved_fargate_profile_can_be_the_defaultcovers the default-profile check.SessionEnvironmentsCard(provider choice and its hint, Fargate-only check, private-network default, failed check, per-provider list, default profile, the shutdown note shown only with a Fargate profile, the removed-profile status, the billing sentence under Manage, each task row naming its chat and saved profile, typing a comma-separated list key by key),SessionEnvironmentChip(the Fargate row's AWS line, the cost callout with no figure directly above the pricing link, both only with a Fargate profile, the check on the picked row), settings coverage.test_with_the_developer_flag_off_no_fargate_path_is_reachable(picker, launch, keep-alive, stop retries, archive, shutdown and boot), run with the new_fargate_environmentsguard removed and failed.SessionEnvironmentsCard,SessionEnvironmentChip,RemoteFilesPanel, settings coverage and the i18n suites: 1,066 passed. Every Fast Gate script plus the static and flake-pattern ratchets, scoped to this PR's commits: 29 passed. Semgrep 1.78.0 with CI's configs: rule tests 22/22, diff scan 0 findings. tsc, ESLint (--max-warnings 0),i18n:check,lint:i18n, the phantom-class and restyle ratchets, jscpd, the ui-index freshness check, flake8, isort, mypy and the baselined black gate (scripts/check_black_formatting.py), all clean.Manual verification
Screenshots / video
Rendered from this head's components in a Vite dev server with every
/apicall answered by a stub (no gateway, no AWS). Each part of the card is its own image.Composer picker on a Fargate profile: the picked row's check, the line saying it is a separate cloud machine in your AWS account, the cost callout, and the "See AWS Fargate pricing" link right after it:
The AWS Fargate tab beside Coder, Fly.io Sprites and boxd, and the note that this is not Deploy my crew:
Global defaults (after the three steps): the Fargate line among the shutdown switch's per-provider notes:
Setup instructions expanded on the Fargate tab:
A Fargate profile expanded: its fields, two comma-separated subnets, the Assign public IP switch and Remove profile:
After removing a profile, the save bar names it and says what Discard does:
Readiness check with one ready and one failed task definition, and Manage with the billing sentence and the task row, which names its profile and the chat it belongs to:
Light theme
Related Issues
Part of #10433
no linked issue: this stacked provider PR closes nothing; the Session Environments tracking issue stays open until the whole stack lands.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)