Skip to content

feat: run the setup plan that setup showed - #908

Closed
cchu-ld wants to merge 1 commit into
cchu/aws-devops-5-planfrom
cchu/aws-devops-6-run-plan
Closed

cchu-ld wants to merge 1 commit into
cchu/aws-devops-5-planfrom
cchu/aws-devops-6-run-plan

Conversation

@cchu-ld

@cchu-ld cchu-ld commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

This PR is part 6 of a stack of 7 PRs for ldcli aws-devops-agent. It goes on PR 5 of the stack. Review and merge the PRs in order.

  1. feat: ask which existing agent space to connect LaunchDarkly to #903 Agent space choice
  2. feat: add AWS regions, send the API version, and shorten credential errors #904 Regions, API version, credential error
  3. feat: offer to run aws sso login when SSO credentials expire #905 aws sso login offer
  4. feat: show names and states in the plaintext status output #906 Readable status output
  5. feat: show the setup plan and ask before setup changes AWS #907 Setup plan and confirmation
  6. feat: run the setup plan that setup showed #908 Run the shown plan (this PR)
  7. feat: choose the setup steps by who made the agent space #909 Ownership rule and existing spaces

Describe the solution you've provided

  • setup runs the plan that it showed, one step at a time: IAM roles, agent space, account association, operator app, and MCP server.
  • Before a step writes to AWS, setup makes sure that AWS still matches the plan. If AWS changed, setup stops with ErrPlanChanged.
  • setup checks the LaunchDarkly token before any AWS write. If no MCP server is registered and setup cannot ask for a token, it stops before it changes AWS. Pass --access-token in those runs.
  • --yes skips every question, also the aws sso login question.
  • If the operator app of a reused space is on, setup keeps its sign-in, unless you pass --auth-flow. setup reads the app state, so it needs aidevops:GetOperatorApp.
  • If AWS sends no operator app URL, setup builds the URL from the space ID.

Describe alternatives you've considered

None.

Additional context

Testing: go test ./... and golangci-lint pass on this branch.

🤖 Generated with Claude Code


Note

Overview
aws-devops-agent setup now executes the plan it displays instead of re-deriving work at apply time. After planning with PlanSetup, it runs RunPlan (full provision) or ConnectPlan (MCP-only on an existing space). Each step re-reads AWS first; if reality diverges from the plan, setup aborts with ErrPlanChanged (“Run setup again”) rather than partially applying stale intent.

Non-interactive and safety behavior tightens. --yes skips every prompt (confirmation, agent-space choice, aws sso login), matching unattended runs. With no LaunchDarkly token, setup can reuse an existing MCP registration; if it would need to ask for a token (no TTY, JSON output, or --yes) and none exists, it fails before any AWS write and tells you to pass --access-token. LaunchDarkly tokens are validated before writes when registering or replacing MCP credentials.

Operator app handling on reused spaces uses GetOperatorApp: an enabled app keeps its sign-in unless the user explicitly passed --auth-flow (AuthFlowSet). The printed plan adds account association detail; invalid --mcp-service-id is rejected at plan time.

Reviewed by Cursor Bugbot for commit 941e257. Bugbot is set up for automated code reviews on this repo. Configure here.

Setup now runs the plan that it showed, one step at a time. Before a
step writes to AWS, setup makes sure that AWS still matches the plan.
If AWS changed, setup stops with ErrPlanChanged.

Setup checks the LaunchDarkly token before any AWS write. If no MCP
server is registered and setup cannot ask for a token, it stops before
it changes AWS. --yes now skips every question.

If the operator app of a reused space is on, setup keeps its sign-in,
unless you pass --auth-flow. Setup reads the app state, so it needs
aidevops:GetOperatorApp. If AWS sends no operator app URL, setup builds
the URL from the space ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cchu-ld
cchu-ld force-pushed the cchu/aws-devops-6-run-plan branch from 9758702 to 941e257 Compare October 20, 2026 16:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 941e257. Configure here.

name, trustPolicy, policyARN string,
action RoleAction,
logf func(string, ...any),
) (string, bool, error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale MCP plan after association wait

Medium Severity

RunPlan re-checks AWS before the first write, then can wait up to two minutes in associateAWSAccount before it registers the MCP server or enables the operator app. Those later steps use the original plan and do not call checkMCP or checkApp again. A server or app that appears during that wait no longer gets reused; setup tries to register anyway or calls EnableOperatorApp and can overwrite sign-in. The previous registerMCPServer path looked up the server at write time, so this is a regression versus the live lookup.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 941e257. Configure here.

@cchu-ld cchu-ld closed this Oct 20, 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.

1 participant