Repository navigation
fix(settings): say env-var aws credentials need a profile - #38414
Conversation
When the gateway's AWS credentials are environment variables, the sandbox passes AWS_ACCESS_KEY_ID to the AWS CLI but scrubs the secret key and session token, so the CLI reports "Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY". The Remote Crew credentials row showed that text as its lead, blaming a key the user has set and giving no next step. The preflight now returns env_credentials, set when the check fails without a profile and those variables are present (an explicit --profile drops the CLI's environment-credential step). The credentials row then leads with a translated sentence saying to create a profile with aws configure sso or aws configure and enter it in the AWS profile field, and why, with the CLI's own error under it. The child-environment scrub and the note text are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The new boolean has one consumer, the credentials row. It reuses the existing What this change shipsInventory (5 items) — 5 justifiedIntent: when the gateway's AWS keys come from environment variables, the dashboard should tell the user to create a profile instead of saying the secret key is missing (#34699). This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 5f4bd54 Description read[DESCRIPTION-READ] 6f828aa6860cd38a525a3b2b2965fd7034ca76c6e095a6d9b8986fa4f82d958a That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this adds one optional preflight field and one catalog sentence, the change is reversible, and the four attached screenshots show the reshaped row. Notes
[DESIGN-REVIEWED] 5f4bd54 Description read[DESCRIPTION-READ] 24844d6919f450a25ee2898a8824868e965cb6bd837176ec3478db1f2f663621 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 Nothing blocks. The new sentence appears in shots 02–04, and the blind reader read it correctly as fix-it instructions for the credentials error. Notes
[UX-REVIEWED] 5f4bd54 Description read[DESCRIPTION-READ] afd8dbcb12ae79a42a0c96aa1950f1cea4aadb11e6b4fa2183df0759f4148175 That sha256 names everything this verdict read: the PR description, plus the 7 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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
The review read the whole diff at 5f4bd54. It also traced reachability_check through all five of its callers. The dashboard handler forwards the new env_credentials key. The wizard, doctor and launch paths read only the fields they already read. The checks below were run:
- The
not profilegate matches how the AWS CLI drops environment credentials when a profile is passed explicitly. - The new sentence matches the env scrub, which this PR leaves unchanged.
- All 13 locale catalogs carry the key.
- The parametrized backend test and the two panel tests each fail without the fix.
Done well: the sentence tells the user what to do first, and the CLI's raw error still shows underneath, so the row loses nothing it showed before.
Optional notes, none of them required:
- Optional:
env_credentialsis set when the variables are present, not from the error sts actually returned (src/kiro_crew/cloud/iam.py:1189). If the CLI is missing or the call times out, the lead sentence points to the wrong fix. The raw error still shows below it. You could also check for the CLI's "Partial credentials found in env" text, or reply to the Design note with a disposition. - Optional: no test covers an empty profile with no AWS env vars. A test for that case would pin
bool(env_hint), so a later change tonot profilealone would turn CI red.
Problem / Motivation
Goal: When the gateway's AWS credentials come from environment variables, the Remote Crew credentials row says those are not passed to the AWS CLI and how to use a profile instead, rather than blaming a missing secret key that is set.
With
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYboth exported in the gateway's environment, the "Before you start — your AWS setup" card's AWS credentials row leads with the AWS CLI's rawaws: [ERROR]: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY. The sandbox passes the key id to the CLI but deliberately withholds the secret key and session token, so the CLI sees half a credential.Why it matters
A user with both keys exported reads "missing: AWS_SECRET_ACCESS_KEY", checks, finds the key set, and has no next step.
kirocrew cloud doctoralready gives the right advice (create a profile withaws configure ssooraws configure); the dashboard, where most people set up a Remote Crew, did not.Not a goal
AWS_SECRET*/AWS_SESSION*scrub stays as it is.kirocrew cloud doctor's output or to the preflight'snote.kirocrew cloud listand the otherkirocrew cloudcommands, which print the same AWS CLI text with no next step: a second PR on Dashboard credentials row blames a missing secret key that is actually set, instead of saying env credentials aren't pas #34699 covers them.What changed (motivation → approach → change)
The credentials row now leads with a sentence in the reader's language: create an AWS profile with
aws configure ssooraws configure, enter it in the AWS profile field, then re-check, because Kiro Crew does not pass AWS secret keys or session tokens from environment variables to the AWS CLI. The CLI's own error sits under it on its own line, as the missing-credential-helper case already does.The backend already detected this setup (
env_credentials_hint()), but only as Englishnotetext the panel never reads.reachability_checkinsrc/kiro_crew/cloud/iam.pynow also returnsenv_credentials: true whenstsfailed, no profile was given, and those variables are set. An explicit--profiledrops the CLI's environment-credential step, so a named profile keeps showing the CLI's own error.website/src/pages/settings/RemoteCrewPanel.tsxpicks the sentence (envCredentialsSentence()inremoteCrewPluginRefusal.ts, with the two commands passed in as values rather than catalog text) after the credential-helper case.CloudPreflightinwebsite/src/api/client/cloud.tsgains the optional field. The new keycredentials_env_varsis translated in every shipped catalog underwebsite/src/i18n(with a translator note inen.context.jsonanden-XA.jsonregenerated), and the cloud spec (docs/system-specs/modules/cloud.md) describes the new field.Backwards compatibility
Compatible: one added preflight field (
env_credentials, optional inCloudPreflight); old clients ignore it, and every existing field keeps its value.Removes nothing: the change only adds a field and a catalog key; no field, key, validator or behaviour is hidden, renamed or narrowed.
Tests
Proof: PROVEN test/test_cloud_iam.py::TestReachabilityCheck::test_profile_unresolved, test/test_cloud_iam.py::TestReachabilityCheck::test_env_credentials_are_flagged_only_without_a_profile[-True], test/test_cloud_iam.py::TestReachabilityCheck::test_env_credentials_are_flagged_only_without_a_profile[work-False] (head 5f4bd54)
test/test_cloud_iam.pyTestReachabilityCheck::test_env_credentials_are_flagged_only_without_a_profile, parametrized over the profile: withAWS_SECRET_ACCESS_KEYset andstsfailing with the CLI's partial-credentials text,env_credentialsis true with no profile and false withwork, andnote/detailare unchanged.test_profile_unresolvedalso assertsenv_credentials is False.website/src/test/RemoteCrewPanelPluginRefusal.test.tsx,RemoteCrewPanel env-var AWS credentials: the row's lead is the new sentence (namingaws configure sso), and the CLI's partial-credentials text sits under it on its ownfont-monoline inside the same alert. A preflight withenv_credentials: falseand a plaindetailstill shows thatdetailas the row's failure.Red before / green after (a worktree at the base with the new tests, the type, the helper and the catalog applied, but without the
iam.pyand panel hunks):On the fix: 3 passed (backend), 2 passed (vitest,
-t "env-var"). On this head the related sets ran to completion on Ubuntu 24.04: 68,025 backend tests and 15,918 frontend tests passed; the 2 backend reds (test_find_ui_auto.py,test_host_git_repo_exec_neutralization.py) and the 43test:electronreds fail identically on the base.Determinism:
test/test_cloud_iam.py5 runs in a row at-n0(80 passed each), once in a shuffled order (seed 34699, 80 passed), and withtest/test_cloud_handlers.pyandtest/test_cloud_cli.pyat-n 4 --dist loadgroup(224 passed);RemoteCrewPanelPluginRefusal.test.tsx5 runs in a row (24 passed each) and once with--sequence.shuffle --sequence.seed=34699(24 passed).Manual verification
How it was verified, on Ubuntu 24.04 (Linux x86_64), against an isolated gateway started from the worktree (isolated
HOME/KIROCREW_HOME/KIRO_HOME,instances.enabled true, AWS's documented example keysAKIAIOSFODNN7EXAMPLE/wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYin its environment, aws-cli 2.40.2):GET /api/cloud/preflight?profile=®ion=us-east-1answered"reachable": false,"detail": "aws: [ERROR]: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY"and had noenv_credentialskey; the row led with that text. Withprofile=nosuchprofilethe CLI saidThe config profile (nosuchprofile) could not be foundinstead, which confirms that in this setup a named profile stops the CLI using the environment's keys.profile=request carries"env_credentials": truewith the samedetail, and the row reads: "Create an AWS profile: run aws configure sso or aws configure in a terminal on the computer that runs Kiro Crew, enter the profile’s name in the AWS profile field, then re-check. …", withaws: [ERROR]: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEYunder it.profile=nosuchprofilecarries"env_credentials": false, and the row still shows the CLI's own profile error.profile=carries"env_credentials": false.Screenshots / video
Before (base build, profile empty, both variables set): the CLI's text is the row's lead.
After, same setup: the sentence leads, the CLI's text under it.
After, with the dashboard in German:
After, profile
nosuchprofile: the CLI's own profile error, as before.Related Issues
#34699
Sibling sweep
Swept: git grep -n "reachability_check|env_credentials_hint" -- src/
Sibling: src/kiro_crew/dashboard/handlers_cloud.py -- not affected -- returns
{**reach, ...}, so the new field reaches the browser with no handler changeSibling: src/kiro_crew/cli_cloud.py -- not affected --
kirocrew cloud doctorprintsnote, which already carries the env-credentials advice in this caseSibling: src/kiro_crew/cloud/wizard.py -- not affected -- the CLI wizard prints
detailand thennote, so the advice already shows under the CLI's errorSibling: src/kiro_crew/cloud/launch_engine.py -- not affected -- a failed preflight raises with
detailbefore a launch; the launch form is gated by this same credentials row, which now explains the causeSibling: src/kiro_crew/deploy/iam.py -- not affected -- its separate
reachability_checkalways runs with a registered profile (_resolve_profilerefuses an empty one), and an explicit--profiledrops the CLI's environment-credential stepPattern harvest
Not generalizable: the defect is one server-detected cause (
env_credentials_hint()) that reached the panel only as English text the panel never read; the earlier credential-helper fix (#19960) followed the same flag-plus-translated-sentence shape, which this follows.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Part of #34699