Repository navigation
feat: ask which agent space to use and confirm the setup plan - #922
Conversation
c636ac6 to
6797e64
Compare
6797e64 to
36302cf
Compare
36302cf to
36e1dd9
Compare
1cfcc10 to
9554f39
Compare
9554f39 to
d2126d3
Compare
b45dc7f to
eee2057
Compare
eee2057 to
ff474ea
Compare
db25cce to
fc60c74
Compare
fc60c74 to
36c0096
Compare
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 36c0096. Configure here.
36c0096 to
ff6c136
Compare
ff6c136 to
f16baae
Compare
aa23ad3 to
8df2365
Compare
8df2365 to
f9895a1
Compare
|
@Andrewjeska, thank! All three are addressed.
This reply is from Claude. |
b296c42 to
3c5303f
Compare
If the region already has agent spaces, setup lists them and asks which one to use. A space that setup made gets the full setup. Another space gets only the MCP server, unless you pass --auth-flow. A space counts as made by setup only if it has the ldcli:managed tag. --agent-space-id picks a space without the list. --new-agent-space provisions another space. You cannot pass both. --agent-space-name has no default. With a name, Enter at the list picks the space with that name, or a new space with that name. Without a name, a new space makes setup ask for one. An unattended run with --agent-space-name X uses X, or provisions X if no space has that name. Setup shows the plan before the first write to AWS. In a terminal, it asks "Continue? [y/N]", also with --output json. The new --yes flag skips every question. The plan, the prompts, and the progress go to stderr. Stdout has only the result, so a json run shows the plan and keeps valid JSON on stdout. If setup must ask for a LaunchDarkly token, it asks before the plan and checks the token. If LaunchDarkly rejects it, setup stops before any AWS write. With a token, setup plans again, so the plan is current. Without one, the plan skips the MCP server, and a connect run stops, because it has nothing to do. Progress goes to stderr in every run, also with --output json. The plan names the profile from AWS_DEFAULT_PROFILE too. If a run fails after it created a space, the error names that space. --agent-space-id reads only that space, so a problem with another space cannot stop the run. The README lists the AWS permissions that setup and status need. If the operator app of a connected space is off, setup does not print its URL. It points to the AWS console, because the full setup would change a space that setup did not make. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--yes now also runs aws sso login in a terminal, so the help text no longer says that a run with it acts like a run without a terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…read If setup cannot read the tags of a space, the owner of that space is unknown. The list now leaves out that space, and a note names it with the --agent-space-id flag to use it. The name checks still count the space, so setup does not offer a new space with its name. A run that cannot ask stops without --agent-space-name, or if a space with unread tags has that name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan output reads the lines from Text. A run without a token sets the MCP step to MCPSkip, instead of a line that disagreed with the step. The README says that --mcp-service-id must name a server at the LaunchDarkly endpoint, or at the --mcp-endpoint endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup does not ask for a replacement token. Without a token from the flag, LD_ACCESS_TOKEN, or the ldcli configuration, the plan reused the MCP server and did not say why. Setup now stops and names --access-token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flow --agent-space-id on a space that does not exist now says to check --region and --profile, or to run setup without the flag to list the spaces. On a space whose tags setup cannot read, setup only connects the MCP server and says why, unless you pass --auth-flow. Before, setup stopped, so the list note that says to pass --agent-space-id did not work. --auth-flow on a space that setup did not make now prints a warning before the plan. Without --agent-space-name, Enter at the list picks the one space that setup made, as a run that cannot ask does. The error for a new space without a name gives an example name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a run that created a space and then failed, the error said that a new run reuses the space. A run with the same --new-agent-space and --agent-space-name stops on the name, so the error now says to run setup again with --agent-space-id <id>. --new-agent-space needs only the names of the spaces, so setup lists them with AgentSpaceNames and reads no tags. A failed tag lookup no longer stops a run that only creates a space. If an MCP server appears between the plan and the plan after a pasted token, setup now says that it reuses that server and does not use the token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3c5303f to
324ebdd
Compare

Humans:
Requirements
Related issues
None.
Describe the solution you've provided
setupreused the space namedlaunchdarklyor created a new one. Users usually have spaces already, and setup did not let them pick one.setuplists them and asks which one to use. The list marks the spaces thatsetupmade.--agent-space-idpicks a space without the list.--new-agent-spaceprovisions another space. You cannot pass both.setupmade gets the full setup. Another space gets only the MCP server, unless you pass--auth-flow. A space counts as made bysetuponly if it has theldcli:managedtag.--agent-space-namehad the defaultlaunchdarkly, so a new space got that name without a question.--agent-space-namehas no default. With a name, Enter at the list picks the space with that name, or a new space with that name. Without a name, the list has no default, and a new space makessetupask for a name. If a space already uses the name,setupasks again.--agent-space-name Xuses X, or provisions X if no space has that name. Without a name, it reuses the one space thatsetupmade, or stops.setupchanged AWS with no warning.setupshows the plan before the first write to AWS. In a terminal, it asksContinue? [y/N]. The new--yesflag skips every question.setup --output jsonin a terminal must also see the question before AWS changes.setupasks whenever stdin is a terminal, unless you pass--yes. The questions go to stderr, so stdout still has only the JSON. A run without a terminal, such as CI, does not ask.setupasked for a token after it changed AWS. If LaunchDarkly rejected the pasted token, the roles, the space, the association, and the operator app had already changed.setupasks for the token before it shows the plan, and checks it with LaunchDarkly. If LaunchDarkly rejects it,setupstops before any AWS write. If you press Enter,setupskips the MCP server and says at the end how to connect it.Ask for a token. After Enter on a connect run, the plan said that setup would register the server, but the run changed nothing.default credentialswhenAWS_DEFAULT_PROFILEchose the profile.SelectedProfile, the same rule as the SDK.setupagain with--agent-space-id <id>. A run with the same--new-agent-spaceflags stops on the name, so the ID is the safe way back.--new-agent-spaceread the tags of every space, but it needs only their names. If every tag read failed, it stopped a run that only creates a space.--new-agent-space,setuplists the spaces without their tags.setupsays that it reuses the server that is now registered, and how to replace its token.setupcould not read the tags of one space, the whole run stopped, so one space hid every other space.setupcannot read, because its owner is unknown. A note names that space and says to pass--agent-space-id <id>. The name checks still count the space, sosetupdoes not offer a new space with its name. Ifsetupcannot read the tags of any space, it stops. A run that cannot ask also stops without--agent-space-name, or if a hidden space has that name.--agent-space-idfor a hidden space, but--agent-space-idalso stopped if it could not read the tags. A typo in--agent-space-idgave only the raw AWS error.setupcannot read,--agent-space-idonly connects the MCP server and says why, unless you pass--auth-flow. On a space that does not exist, the error says to check--regionand--profile, or to runsetupwithout the flag to list the spaces.--auth-flowon a space thatsetupdid not make can change a sign-in that someone else set up, and a wrong--agent-space-idwas easy to miss.setupprints a warning before the plan, and the plan line names the current sign-in next to the new one.setupmade, but Enter at the list picked nothing.--agent-space-name launchdarkly.--agent-space-idstill listed every space. A missing permission on another space could stop the run.--agent-space-id, setup reads only that space withAgentSpace.setupand forstatus.setupchanged AWS and then said at the end that the MCP server was not connected.setupcannot ask for a token, it stops before it changes AWS.setupprinted an operator app URL that did not work.setupdoes not print the URL. It says that the app is off, and that you can turn it on in the AWS console. It does not suggest--auth-flow, because the full setup would change a space thatsetupdid not make.Behavior change from
main:--agent-space-idon a space thatsetupdid not make now only connects the MCP server. Onmain, it ran the full setup. No release has the command yet.Describe alternatives you've considered
The description
Managed by the LaunchDarkly CLIwas the first ownership marker. A user can change or copy it, so setup reads only theldcli:managedtag.Additional context
Testing:
go test ./...andgolangci-lintpass on this branch.I ran
setupagainst a sandbox AWS account. These cases worked: a new space with a typed name, a new space next to existing spaces, and a secondEnableOperatorAppcall (IAM to IAM) on a space whose app is on.Not tested against real AWS:
DevOpsAgentRole-AgentSpaceandDevOpsAgentRole-WebappAdmin.🤖 Generated with Claude Code
Note
Overview
aws-devops-agent setupis reworked so existing accounts get an interactive (or flag-driven) agent space choice, a pre-flight plan with optional confirmation, and safer connect vs full provision behavior.When the region already has agent spaces, setup lists them (marking
ldcli:managedspaces), supports--agent-space-id,--new-agent-space, and--agent-space-name(no default name), and uses--yesfor non-interactive runs. Spaces not created by ldcli get MCP connect-only unless--auth-flowforces full setup (with warnings). Unreadable tags hide spaces from the list but still affect name/default logic;AgentSpaceNamesavoids tag lookups when only checking names.Before any AWS writes, setup shows a plan on stderr, prompts
Continue? [y/N]in a TTY (JSON keeps stdout clean), collects/validates the LaunchDarkly token before the plan when needed, and runsConnectPlanvsRunPlanaccordingly. Operator-app-off connect runs no longer print a bogus URL. README documents the flow, CI behavior, and required IAM permissions.Extensive new tests cover confirmation, selection, flags, plan output, and unattended paths.
Reviewed by Cursor Bugbot for commit b296c42. Bugbot is set up for automated code reviews on this repo. Configure here.