Skip to content

fix(settings): say env-var aws credentials need a profile - #38414

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/34699-env-credentials-row
Nov 17, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/34699-env-credentials-row

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

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_ID and AWS_SECRET_ACCESS_KEY both exported in the gateway's environment, the "Before you start — your AWS setup" card's AWS credentials row leads with the AWS CLI's raw aws: [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 doctor already gives the right advice (create a profile with aws configure sso or aws configure); the dashboard, where most people set up a Remote Crew, did not.

Not a goal

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 sso or aws 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 English note text the panel never reads. reachability_check in src/kiro_crew/cloud/iam.py now also returns env_credentials: true when sts failed, no profile was given, and those variables are set. An explicit --profile drops the CLI's environment-credential step, so a named profile keeps showing the CLI's own error. website/src/pages/settings/RemoteCrewPanel.tsx picks the sentence (envCredentialsSentence() in remoteCrewPluginRefusal.ts, with the two commands passed in as values rather than catalog text) after the credential-helper case. CloudPreflight in website/src/api/client/cloud.ts gains the optional field. The new key credentials_env_vars is translated in every shipped catalog under website/src/i18n (with a translator note in en.context.json and en-XA.json regenerated), and the cloud spec (docs/system-specs/modules/cloud.md) describes the new field.

Backwards compatibility

Compatible: one added preflight field (env_credentials, optional in CloudPreflight); 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.py TestReachabilityCheck::test_env_credentials_are_flagged_only_without_a_profile, parametrized over the profile: with AWS_SECRET_ACCESS_KEY set and sts failing with the CLI's partial-credentials text, env_credentials is true with no profile and false with work, and note/detail are unchanged. test_profile_unresolved also asserts env_credentials is False.
  • website/src/test/RemoteCrewPanelPluginRefusal.test.tsx, RemoteCrewPanel env-var AWS credentials: the row's lead is the new sentence (naming aws configure sso), and the CLI's partial-credentials text sits under it on its own font-mono line inside the same alert. A preflight with env_credentials: false and a plain detail still shows that detail as 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.py and panel hunks):

FAILED test/test_cloud_iam.py::TestReachabilityCheck::test_profile_unresolved - AssertionError: assert None is False
FAILED ...::test_env_credentials_are_flagged_only_without_a_profile[-True] - AssertionError: assert None is True
FAILED ...::test_env_credentials_are_flagged_only_without_a_profile[work-False] - AssertionError: assert None is False
 × leads with the profile to create and puts the CLI’s own error under it   (Unable to find an element with the text: Create an AWS profile: ...)
   Tests  1 failed | 1 passed | 22 skipped (24)

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 43 test:electron reds fail identically on the base.

Determinism: test/test_cloud_iam.py 5 runs in a row at -n0 (80 passed each), once in a shuffled order (seed 34699, 80 passed), and with test/test_cloud_handlers.py and test/test_cloud_cli.py at -n 4 --dist loadgroup (224 passed); RemoteCrewPanelPluginRefusal.test.tsx 5 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 keys AKIAIOSFODNN7EXAMPLE / wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY in its environment, aws-cli 2.40.2):

  • Before the fix, GET /api/cloud/preflight?profile=&region=us-east-1 answered "reachable": false, "detail": "aws: [ERROR]: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY" and had no env_credentials key; the row led with that text. With profile=nosuchprofile the CLI said The config profile (nosuchprofile) could not be found instead, which confirms that in this setup a named profile stops the CLI using the environment's keys.
  • After the fix, the same profile= request carries "env_credentials": true with the same detail, 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. …", with aws: [ERROR]: Partial credentials found in env, missing: AWS_SECRET_ACCESS_KEY under it.
  • profile=nosuchprofile carries "env_credentials": false, and the row still shows the CLI's own profile error.
  • With the gateway restarted without the two variables, profile= carries "env_credentials": false.
  • With the browser in German the row reads "Lege ein AWS-Profil an: Führe aws configure sso oder aws configure … trage den Namen des Profils im Feld „AWS-Profil“ ein …".

Screenshots / video

Before (base build, profile empty, both variables set): the CLI's text is the row's lead.

before

After, same setup: the sentence leads, the CLI's text under it.

after

After, with the dashboard in German:

after de

After, profile nosuchprofile: the CLI's own profile error, as before.

after named profile

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 change
Sibling: src/kiro_crew/cli_cloud.py -- not affected -- kirocrew cloud doctor prints note, which already carries the env-credentials advice in this case
Sibling: src/kiro_crew/cloud/wizard.py -- not affected -- the CLI wizard prints detail and then note, so the advice already shows under the CLI's error
Sibling: src/kiro_crew/cloud/launch_engine.py -- not affected -- a failed preflight raises with detail before a launch; the launch form is gated by this same credentials row, which now explains the cause
Sibling: src/kiro_crew/deploy/iam.py -- not affected -- its separate reachability_check always runs with a registered profile (_resolve_profile refuses an empty one), and an explicit --profile drops the CLI's environment-credential step

Pattern 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Part of #34699

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>
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5f4bd5404e074e7350365fb6465894c6bf5cd60c — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The new boolean has one consumer, the credentials row. It reuses the existing env_credentials_hint() check, and the catalog key is needed because the panel can't show the English-only note.

What this change ships

Inventory (5 items) — 5 justified

Intent: 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.

  1. The credentials row now opens with "Create an AWS profile: run aws configure sso or aws configure…" when the keys come from environment variables and no profile was given — justified
  2. The AWS CLI's own error now sits on its own line under that sentence — justified
  3. The preflight response gains an optional env_credentials field, read only by the credentials row — justified
  4. A new catalog key, credentials_env_vars, is translated into every shipped locale — justified
  5. The cloud spec now describes the new preflight field — justified

[FIRST-PRINCIPLES-REVIEWED] 5f4bd54

Description read

[DESCRIPTION-READ] 6f828aa6860cd38a525a3b2b2965fd7034ca76c6e095a6d9b8986fa4f82d958a

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5f4bd5404e074e7350365fb6465894c6bf5cd60c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • env_credentials comes from env vars being present, not from the CLI's actual error. So if sts fails for an unrelated reason (network, expired SSO) while a secret is exported and the profile is empty, the row tells the user to create a profile and shows the real error underneath. Matching the CLI's "Partial credentials found in env" text as well would make the flag precise.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 5f4bd5404e074e7350365fb6465894c6bf5cd60c — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • In credentials_env_vars, aws configure sso and aws configure render as plain red prose (shot-02), so the reader can't tell where each command starts and stops. Render {{sso}}/{{configure}} as inline font-mono code, the same style as the CLI error line under them.
  • The reader "only half follow[s]" the sentence because of "terminal", "environment variables" and "AWS CLI". The second sentence (the "why") is fine as it is, but the first step would be easier to act on as copyable command chips, like the plugin row's "Copy command".

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5f4bd5404e074e7350365fb6465894c6bf5cd60c — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5f4bd54

Verdict parsed from the review's SHA-scoped output markers for commit 5f4bd5404e074e7350365fb6465894c6bf5cd60c.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5f4bd5404e074e7350365fb6465894c6bf5cd60c false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5f4bd5404e074e7350365fb6465894c6bf5cd60c and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5f4bd54

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5f4bd5404e074e7350365fb6465894c6bf5cd60c false-positive: <reason, 20 to 500 characters>

@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 Nov 17, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 17, 2026 14:08

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 profile gate 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_credentials is 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 to not profile alone would turn CI red.

@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 Nov 17, 2026
@KiroCrewCaptain
KiroCrewCaptain merged commit ab78582 into main Nov 17, 2026
99 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/34699-env-credentials-row branch November 17, 2026 14:39
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants