Repository navigation
feat: run the setup plan - #921
Merged
cchu-ld merged 4 commits intoOct 21, 2026
Merged
Conversation
This was referenced Oct 20, 2026
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 20, 2026 17:28
21d3c2a to
da7dbe7
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 20, 2026 17:47
da7dbe7 to
55f2d19
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 20, 2026 17:59
55f2d19 to
6ced80d
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
2 times, most recently
from
October 20, 2026 18:32
d90108f to
d0582f4
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 20, 2026 18:36
d0582f4 to
8ae1c1d
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
2 times, most recently
from
October 20, 2026 19:11
f6c619f to
c27f1ef
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 20, 2026 19:13
c27f1ef to
089018c
Compare
cchu-ld
changed the base branch from
cchu/aws-devops-3-status
to
cchu/aws-devops-4b-setup-plan
October 20, 2026 19:13
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 7683a40. Configure here.
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 18:10
7683a40 to
b3fc47d
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 18:18
b3fc47d to
f2be130
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 18:36
f2be130 to
371b0a3
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 18:48
371b0a3 to
87faa19
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 19:11
87faa19 to
188bbd3
Compare
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
3 times, most recently
from
October 21, 2026 19:35
680bbba to
be06594
Compare
Contributor
Author
|
@Andrewjeska thanks! |
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 19:59
b4164e6 to
dd04576
Compare
davidbrackbill
approved these changes
Oct 21, 2026
RunPlan runs a full setup plan. ConnectPlan runs a plan that only connects the MCP server. Before a step writes to AWS, a check makes sure that AWS still matches the plan. If AWS changed, the run stops with ErrPlanChanged. For the operator app, the check compares the sign-in method too. The role and association steps can take minutes, so RunPlan checks the app again right before the app step. The LaunchDarkly token is checked before any AWS write. Tests replace CheckToken, so they never call the real API. RunPlan tags a new space with ldcli:managed=aws-devops-agent. If AWS sends no operator app URL, RunPlan builds it from the space ID. SetupResult reports operatorAppEnabled. When --replace-mcp-token replaces the server, setup reconnects every other space, even if this space or one of them fails. The error names each space that lost the server. If a disassociate fails part way, the error names the spaces that are already disconnected. The setup command calls PlanSetup and RunPlan in place of Setup, and sets AuthFlowSet if you pass --auth-flow. The next PR replaces the call lines with the full command flow. Setup and ConnectExisting move to export_test.go, and FindAgentSpace is deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RunPlan skips the MCP server step if the plan says MCPSkip, and it does not check the MCP server before the run. The tests read the plan lines from Text. A test that pointed setup at an MCP server on another endpoint now passes that endpoint with --mcp-endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… writes The role and association steps can take minutes. If the plan keeps the AWS account association and someone removed it in that time, setup created a new one. It now stops with ErrPlanChanged. RunPlan checks the MCP server again right before the MCP step. A server that appeared or went during the writes now stops the run with ErrPlanChanged, instead of an AWS error that does not say why. A comment in checkApp says that a sign-in change by someone else also stops the run, and that a new plan then finds nothing to change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A token replacement removes the MCP server from every space before it registers the new one. If the deregister failed, or if the register failed because another server has the name, the error did not name the spaces that lost the server. Both errors now name them. The name clash error no longer suggests --mcp-service-id, because that server serves another endpoint. The recovery advice now says to run setup with --agent-space-id for each space, because a new run reconnects only one space. The new registration keeps the name of the replaced server, as the plan says. ConnectPlan reads the operator app again, so it reports the app as it is at run time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cchu-ld
force-pushed
the
cchu/aws-devops-4-setup-plan
branch
from
October 21, 2026 21:32
dd04576 to
358b317
Compare
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.

Summary
This PR runs the plan from #928.
RunPlandoes a full setup, andConnectPlanonly connects the MCP server. Before each write, setup makes sure that AWS still matches the plan, so a change that another person made in the meantime stops the run. The setup command now uses the plan in place of the oldSetupfunction.Human note: large PR but it's mostly tests - most logic are in setup.go
Requirements
Related issues
None.
Describe the solution you've provided
RunPlanruns a full setup plan, andConnectPlanruns a plan that only connects the MCP server. Before a step writes to AWS, a check makes sure that AWS still matches the plan. If AWS changed, the run stops withErrPlanChanged. For the operator app, the check compares the sign-in method, not only on or off. The role and association steps can take minutes, soRunPlanchecks the app again right before the app step.Setupchecked the LaunchDarkly token only when it replaced an MCP server registration. A bad token failed after setup had changed other AWS resources.CheckToken, so they never call the real API.RunPlantags a new space withldcli:managed=aws-devops-agent. AWS can also requireaidevops:TagResourceto tag a new space.RunPlanbuilds the URL from the space ID.SetupResultalso reportsoperatorAppEnabled.--replace-mcp-token, a failed association on this space returned at once. The other spaces that lost the old server stayed disconnected, and the error did not name them. One failed reconnect also stopped the rest.--agent-space-id <id>for each one. The new registration keeps the name of the replaced server, as the plan says.The setup command now calls
PlanSetupandRunPlanin place ofSetup, and setsAuthFlowSetwhen you pass--auth-flow.connectMCPServeralso passes the planned MCP step. A later PR replaces these five lines with the full command flow.SetupandConnectExistingmove toexport_test.go, because only tests use them.FindAgentSpaceis deleted.Describe alternatives you've considered
None.
Additional context
Testing:
go test ./...andgolangci-lintpass on this branch.🤖 Generated with Claude Code
Note
Overview
Replaces monolithic AWS DevOps Agent setup with a plan-then-apply flow:
PlanSetupdescribes the run,RunPlanprovisions IAM, agent space, associations, operator app, and MCP, andConnectPlanonly wires MCP on an existing space.Before each write (and again after slow IAM steps), setup re-reads AWS and aborts with
ErrPlanChangedif roles, spaces, associations, operator-app sign-in, or MCP state diverged from the plan. LaunchDarkly access tokens are validated before any AWS mutation; operator-app changes honorAuthFlowSetso sign-in is only changed when--auth-flowis passed.New agent spaces get the
ldcli:managedtag; results addoperatorAppEnabledand synthesize an operator URL when AWS omits one. MCP token replace reconnects other agent spaces more safely and surfaces clearer errors. The setup CLI now callsPlanSetup+RunPlan;Setup/ConnectExistingmove to test exports. Largerunplan_testcoverage exercises races and edge cases.Reviewed by Cursor Bugbot for commit 2106a4c. Bugbot is set up for automated code reviews on this repo. Configure here.