Repository navigation
feat: read agent space ownership and operator app state - #927
Conversation
aca5dde to
81cc52a
Compare
81cc52a to
23bfc72
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 23bfc72. Configure here.
|
Two notes — both about error paths in the new lookup / ownership helpers. 1. One
|
23bfc72 to
0885ccc
Compare
0885ccc to
15d4879
Compare
15d4879 to
2a32490
Compare
b85e861 to
57bbce9
Compare
57bbce9 to
446b9ef
Compare
|
@Andrewjeska, thank you. Commit
This reply is from Claude. |
| return summary, nil | ||
| } | ||
|
|
||
| // hasManagedTag reports the ldcli:managed tag on an agent space. |
AgentSpaces lists the agent spaces in the region. A space counts as made by setup (ManagedByLDCLI) only if it has the tag ldcli:managed=aws-devops-agent. A user can change the description, so setup does not read it. Each space costs one ListTagsForResource call. An agent space does not report its ARN, so setup builds it. If setup cannot read a tag, it stops with an error that names aidevops:ListTagsForResource. AgentSpace reads one space with the same check. appState reads the operator app with GetOperatorApp. GetStatus uses it. If the app is off, the status has operatorAppEnabled false and no URL, and the plaintext output says "off". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
status failed if GetOperatorApp failed for a reason other than an app that is off, for example without aidevops:GetOperatorApp. The whole report was then lost. status now reports the app as unknown with the AWS error code, and shows the rest of the space. status also uses the operator app URL that AWS sends, like setup. It builds the URL only if AWS sends none. Doc comments now say that appState needs a space that exists, and that AgentSpaces fails on purpose if it cannot read the tag of a space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tag error said that setup needs aidevops:ListTagsForResource for every failure. For another error, such as a server error that the SDK retried, the message now gives only the AWS error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AgentSpaces failed if one tag lookup failed, so one space could hide every other space. Now the summary of that space has TagErr, and the other spaces stay in the list. If every lookup fails, AgentSpaces still returns the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AgentSpace failed if it could not read the tags of the space. It now puts the error on the summary as TagErr, like AgentSpaces, so the caller decides what to do with a space whose owner is unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42c2b8e to
ff4e2fd
Compare
Requirements
Related issues
None.
Describe the solution you've provided
AgentSpacesmarks a space asManagedByLDCLIonly if it has the tagldcli:managed=aws-devops-agent, the tag that setup already puts on its roles. A user can change the description, so setup does not read it. A later PR tags each space that setup creates.AgentSpacesreads the tags of each space, so the list costs oneListTagsForResourcecall per space. It builds the ARN asarn:aws:aidevops:<region>:<account>:agentspace/<id>, the format in the role trust policy. IfAgentSpacescannot read the tags of a space, the summary of that space getsTagErr, and the other spaces stay in the list. A caller must not use that space as if its owner is known, because setup uses the owner to decide if it can change the roles and the operator app. If every lookup fails,AgentSpacesreturns the error.AgentSpace, for one space, also puts a tag error on the summary. The error namesaidevops:ListTagsForResourceonly forAccessDeniedException. Thestatuscommand does not callAgentSpaces, so a failed tag lookup does not affect it.AgentSpacereads one space with the same ownership check asAgentSpaces.statusprinted an operator app URL even when the app was off, and that URL does not work.appStatereads the app withGetOperatorApp.GetStatususes it for each space. If the app is off, the status hasoperatorAppEnabled: falseand no URL, and the plaintext output saysoff. If the app is on,statusshows the URL that AWS sends, likesetup. It builds the URL only if AWS sends none.statusis a read command. A policy withoutaidevops:GetOperatorAppmust not hide the roles, services, and connections.GetOperatorAppfails,statusreports the app as unknown and shows the rest of the space. The JSON getsoperatorAppErrorwith the AWS error code, for exampleAccessDeniedException. The plaintext output saysOperator app: unknown (AccessDeniedException).ResourceNotFoundExceptionfor an app that is off and for a space that does not exist.appStatetreats the error as an app that is off. Its doc comment says that the space must exist. Each caller in the later PRs skips a space that setup will create.The setup flow does not use
AgentSpacesorAgentSpaceyet. Later PRs use them. The plan PR, #928, usesAppAction, its constantsAppEnable,AppKeep, andAppChange, andAppStep.Action. This PR does not set or read them.Describe alternatives you've considered
None.
Additional context
Testing:
go test ./...andgolangci-lintpass on this branch.🤖 Generated with Claude Code
Note
Overview
Adds agent space discovery with ownership detection via
AgentSpaces/AgentSpace, usingListTagsForResourceon a constructed agentspace ARN to setManagedByLDCLIfrom theldcli:managedtag. Tag read failures surface as per-spaceTagErr(or fail the whole list only if every lookup fails), with permission-specific messaging forAccessDeniedException.Operator app reporting now calls
GetOperatorAppthrough sharedappStateinstead of always printing a synthetic URL. Status JSON gainsoperatorAppEnabledandoperatorAppError; the CLI shows the AWS URL when enabled,offwhen disabled, orunknown (<code>)when the app cannot be read—without blocking roles, services, or associations.Also extends the DevOps Agent client surface (
GetOperatorApp,ListTagsForResource) and introducesAppStep/AppActiontypes for upcoming setup/plan work (not wired into setup flow in this PR).Reviewed by Cursor Bugbot for commit 42c2b8e. Bugbot is set up for automated code reviews on this repo. Configure here.