fix(setup): failure screen hides errors raised before CloudFormation (preflights, image build)

Aperta
#1,020 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@krokoko ci sta già lavorando.

Dal 21/11/2026.

  • #1075 di @krokoko — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
aws, typescript
Ambito
cli, cloud, testing

Direzione di ricerca

Start with cli/src/commands/setup.ts and trace how the standard bootstrap preparation result is reflected in the review screen and passed to the //cdk:deploy spawn. Read cdk/src/bootstrap/preflight.ts and inspect the failure cause extraction path; add coverage using a standard-bootstrap describeStack fixture. Done when the chosen standard-bootstrap behavior is shown consistently and the preflight message appears in the failure screen's Cause.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug cli P2 v1
Component

CLI: bgagent setup (cli/src/commands/setup.ts, from #973 / #836), together with the //cdk:deploy bootstrap preflight (cdk/mise.toml, cdk/src/bootstrap/preflight.ts, from #976).

Describe the bug

In an account whose CDKToolkit is a standard CDK bootstrap, bgagent setup promises to deploy and leave the bootstrap unchanged. The deploy then fails at the bootstrap preflight.

  • planAccountPreparation deliberately leaves a standard bootstrap alone (DEPLOYMENT_GUIDE: "A standard CDK bootstrap (no ABCA policy outputs): left unchanged, because other apps in the account may depend on it").
  • Setup deploys through mise //cdk:deploy. Since #976, the first command of that task is npx tsx scripts/preflight-bootstrap.ts.
  • That preflight returns FAIL for a default bootstrap (cdk/src/bootstrap/preflight.ts:96-102). Setup doesn't set ABCA_SKIP_BOOTSTRAP_PREFLIGHT, so the deploy fails.

This affects any customer whose account already uses CDK for something else, which is likely common.

Steps to reproduce (verified at #973 head 1544814c)
npx cdk bootstrap aws://<account>/<scratch-region>     # standard bootstrap
bgagent setup --region <scratch-region> --stack-name backgroundagent-dev-std --features none --yes

Output:

  This account uses the standard CDK bootstrap; setup deploys with it and leaves it unchanged.
  ✓ Checking what will change  317 to create · 0 to update · 0 to remove
  ✓ Saved your selection to abca.deployment.backgroundagent-dev-std.json
  ✗ Deployment failed after 3s
  Cause:
    [//cdk:deploy] ERROR task failed

setup-deploy.log:

bootstrap preflight: FAIL: CDKToolkit is a default CDK bootstrap (no BootstrapPolicyVersion output), whose execution role has AdministratorAccess. ABCA expects its least-privilege bootstrap. Run `mise //cdk:bootstrap`, or bypass deliberately with ABCA_SKIP_BOOTSTRAP_PREFLIGHT=1.

No stack is created. The profile file is written anyway.

Expected behavior

The review screen and the deploy should agree. Pick one:

  1. Deploy as promised: when preparation.standardBootstrap is true, spawn //cdk:deploy with ABCA_SKIP_BOOTSTRAP_PREFLIGHT=1, and say so on the review screen ("deploys with your standard bootstrap's admin execution role").
  2. Refuse up front: before the diff, stop with: "This account uses a standard CDK bootstrap, which ABCA's deploy check rejects. Run mise //cdk:bootstrap to switch to ABCA's least-privilege bootstrap (this changes the bootstrap for every CDK app in this account and Region), or re-run with an explicit opt-in flag." Then update the DEPLOYMENT_GUIDE bullet.

Either way:

  • Surface the preflight's message in the failure screen's "Cause". Today it shows only [//cdk:deploy] ERROR task failed, because the cause extractor only reads CloudFormation events.
  • Add a test with a standard-bootstrap describeStack fixture, asserting either the env passed to the deploy spawn or the up-front refusal.
Additional context

This was found while reviewing #988, which has a related issue: its installer replaces a standard bootstrap via mise //cdk:bootstrap. Left as a follow-up to #973 rather than blocking it.

Lingua principale
TypeScript
Stelle
185
Fork
54
Merge medio
3g 3h
PR unite (30g)
27

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws-samples/sample-autonomous-cloud-coding-agents

Tutte le issue di aws-samples/sample-autonomous-cloud-coding-agents

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.