Repository navigation
feat: modular deployment profiles and bgagent setup wizard (#836) - #6
Draft
ayushtr-aws wants to merge 9 commits into
Draft
ayushtr-aws wants to merge 9 commits into
ayushtr-aws wants to merge 9 commits into
Conversation
aws-samples#836) Resolve one DeploymentFeatures value in main.ts from abca.deployment.json, per-feature context switches and the legacy topology, and pass it into AgentStack. Slack, Linear, Jira, deploy-preview screenshots, the Agent Registry and the Tool Gateway are omitted when disabled: no routes, WAF body-size exemptions, Lambdas, grants, tables, secrets, alarms or outputs, including the ECS/MicroVM compute roles' tracker OAuth grants. Without a profile the template is unchanged apart from a DeploymentFeatures output. contracts/deployment-capabilities.json records Region support (source, verification date, remediation) and synthesis rejects unsupported concrete Regions before any AWS lookup. The census gains 20 feature cells that assert omission and keep the catalogued footprints within 15%. Refs aws-samples#836
Resolve the Region first, reject Regions without core AgentCore services, preselect features already deployed, mark Region-unavailable features as unselectable, diff a temporary candidate profile, and require typing the stack name (or --yes --accept-data-loss) before deleting, replacing or orphaning state-bearing resources. Writes abca.deployment.json only after confirmation, deploys through mise //cdk:deploy and configures the CLI. Feature commands (slack, linear, jira, github webhook) fail fast with a pointer to bgagent setup when the stack omits their module. The capability catalog is mirrored with a parity test against the contract. Refs aws-samples#836
aws-samples#836) Replace raw cdk diff/deploy output with a guided flow: y/n per feature, a review screen, a one-line change summary, the deploy confirmation, then a live board (overall bar plus one line per component with a check mark as it finishes) and a result screen naming the failed component and CloudFormation's reason. Raw output goes to cdk/cdk.out/setup-*.log. Plain (non-TTY) output prints only state changes and 10% steps. Refs aws-samples#836
…ws-samples#836) New installations are asked where agents run (AgentCore, ECS or both); the ordered list is stored as the profile's optional `compute`, which buildApp applies unless compute context is set, so a later plain deploy keeps the same backends. Existing stacks keep their deployed backends; setup may add one but refuses to remove one (COMPUTE.md procedure). Before deploying, after confirmation, setup installs or updates ABCA's least-privilege CDK bootstrap and sets its ComputeTypes parameter (AgentCore always included); a standard CDK bootstrap is never touched. It checks Docker up front, explains the core platform on the review screen, and ends with a next-steps checklist. Refs aws-samples#836
aws-samples#836) Setup resolves the caller with STS GetCallerIdentity, shows the account and role, and asks for confirmation before reading or changing anything. Without --stack-name it lists ABCA deployments in the Region and lets the operator update one or create a new one under a chosen name (taken and unlisted existing names are rejected). Additional deployments from one checkout get abca.deployment.<stack>.json; CDK synthesis prefers the stack's file and falls back to the shared one, so deployments no longer overwrite each other's features. The CLI reuses the @aws-sdk/client-sts version already in the lockfile. Refs aws-samples#836
…#836) Setup now picks the container engine CDK uses for the agent image: CDK_DOCKER when set, otherwise Docker, otherwise Finch, passing CDK_DOCKER=finch to diff, bootstrap and deploy. Refs aws-samples#836
The deploy task's clean:disk step removes cdk.out before deploying, which deleted the change and deploy logs setup was writing there. Logs now go to ~/.bgagent/logs/<stack>/, outside the repository and the image build context. Refs aws-samples#836
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ABCA deploys Slack, Linear, Jira, deploy-preview screenshots and the Agent Registry for every operator, whether used or not, and only discovers an unsupported Region (e.g. Agent Registry outside its five Regions) late inside CloudFormation. That costs resources (~146 of 463 root resources), IAM/secret surface and deploy time, and eats the 490-resource budget. Implements aws-samples#836.
Approach
One validated
DeploymentFeaturesvalue is resolved inmain.ts(abca.deployment.json→ per-feature context switches override → legacy topology when no profile) and passed toAgentStack; constructs never read feature context directly. Disabled modules are omitted, not relocated: Slack/Linear/Jira/screenshots attach routes to the shared Task APIRestApi, and ADR-023 §1 plus the CDK stack-decomposition guidance rule out cross-stack route extraction without a migration rehearsal. A regional capability catalog (contracts/deployment-capabilities.json, verified 2026-10-25 against the AgentCore Regions page) is enforced at synth for concrete Regions and mirrored into the CLI.bgagent setupdiffs a temporary candidate profile and only writes the repo file after confirmation. Decision recorded in ADR-024 (proposed).Deliberate deviations from the issue (in ADR-024): the orchestration table + live reconciler stay core (the reconciler owns per-task budget rollups); the task table's
LinearIssueIndex/JiraIssueIndexGSIs stay (schema change out of scope); nested-stack extraction of route-owning integrations is not done.Changes
cdk/src/deployment/{features,capabilities}.ts: profile parsing (strict,schemaVersion: 1, every feature explicit), precedence,deploymentProfile=<path>|none, Region validation.cdk/src/stacks/agent.ts: gates every optional module, its grants, env, alarms and outputs. Stranded-orchestration sweep and heartbeat only with Linear/Jira. Screenshot→tracker wiring only when both are on. NewDeploymentFeaturesoutput.cdk/src/constructs/task-api.ts: WAF body-size exemptions only for deployed webhook paths (legacy statements unchanged).ecs-agent-cluster.ts,lambda-microvm-compute.ts,github-screenshot-integration.ts: tracker OAuth / index grants follow the selection.cdk/src/main.ts: reads the repo profile; Region check before any AWS lookup.cli/src/commands/setup.ts(bgagent setup):--features,--yes,--no-deploy,--accept-data-loss, repeatable-c/--context.compute_types/networkTopology.cli/src/feature-guard.ts:slack/linear/jira/github webhook-*fail fast pointing atbgagent setup.slack setupno longer runs an ungated deploy.cdk/mise.toml://cdk:diffforwards args..dockerignoreexcludes the profile.Tests & checks
buildApp), compute-role grants across all three backends, and the screenshot grants.--no-deploy, realcdk diffimpact words, and guard wiring on the real commands.main(normalized for asset hashes and timestamps): identical except the newDeploymentFeaturesoutput.mise run build✅ (CDK 6,001/6,001, CLI 1,147/1,147, agent, docs, synth)mise run drift-prevention✅security:sast✅ (justifiednosemgrepon operator-local paths)security:secrets✅,security:retire✅,security:gh-actions✅mise run hooks:run: every hook passes except the pre-push security aggregate, which fails because of the two items below.security:deps: 26 existing OSV advisories in lockfiles this PR doesn't touch (same onmain).security:sast:masking: 3 existing findings, identical onmain(chore(security): clean up 21 pre-existing silent-success-masking findings on main aws-samples/sample-autonomous-cloud-coding-agents#756); this PR adds none.Documentation
DEPLOYMENT_GUIDE.md#deployment-profilescovers the profile format, precedence, the wizard, what disabling removes, data loss, regional data and how to update it.DEVELOPER_GUIDEcensus section,ARCHITECTURE, the CLI README,AGENTS.mdrouting and pitfalls, and ADR-024.Self-review
type-design-analyzer, because the new types are plain records mirrored from existing idioms.approximateResourcesare standalone deltas; Linear and Jira share about 10 resources, so the sum overstates savings. Labelled as such.Update: guided
bgagent setupFollow-up commits (
1a709b7…895f6b5) change the wizard flow to: confirm account → pick or name a deployment → choose compute (new installs only) → choose features → review → change summary → deploy? → live progress → result plus next steps.GetCallerIdentity, showing the account and role. Declining stops before anything is read or written.@aws-sdk/client-stsreuses the version already inyarn.lock, so the lockfile is unchanged.abca.deployment.<stack>.json. CDK prefers that file and falls back toabca.deployment.json.compute.buildAppapplies it unlesscompute_types/compute_typecontext is set. Existing stacks keep their backends; setup can add one but refuses to remove one.mise //cdk:bootstrapnow accepts anaws://account/regionargument).ComputeTypesparameter, always including AgentCore.CDK_DOCKER, else Docker, else Finch (passingCDK_DOCKER=finch).cdk diff.~/.bgagent/logs/<stack>/, becauseclean:diskwipescdk.out.Checks (at
895f6b5)mise run build✅ (CDK 6,009/6,009, CLI 1,194/1,194, agent, docs, synth).drift-prevention✅.security:sast✅.security:secrets✅.security:sast:masking: only the 3 findings that already exist onmain(chore(security): clean up 21 pre-existing silent-success-masking findings on main aws-samples/sample-autonomous-cloud-coding-agents#756).bgagent setupdeployedforked-test-abcato us-east-1 through Finch, ending at the next-steps screen: AgentCore, with Linear and deploy-preview screenshots enabled; 385 resources created.