Implement namespace scoping for /api/agents#1878
Open
maazghani wants to merge 3 commits into
Open
Conversation
Signed-off-by: Maaz Ghani <mghani@lululemon.com>
32a94d8 to
95c5b81
Compare
Author
|
Verification performed so far: |
Author
|
@claude please review as well. Edit: or not |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds namespace-scoped agent listing support by introducing a new /api/agents/{namespace} endpoint, wiring it into both the UI’s getAgents action and the Go API client, and adding handler tests to validate the filtering behavior.
Changes:
- Add
GET /api/agents/{namespace}route and handler to list Agents/AgentHarnesses restricted to a namespace (with namespace validation). - Update UI
getAgentsaction to optionally call the namespace-scoped endpoint. - Extend Go API client to support listing agents for a specific namespace and add handler test coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/app/actions/agents.ts | Add optional namespace parameter to getAgents() to call a namespace-scoped agents endpoint. |
| go/core/internal/httpserver/server.go | Register a new GET /api/agents/{namespace} route. |
| go/core/internal/httpserver/handlers/agents.go | Implement HandleListAgentsForNamespace with Kubernetes namespace validation and namespace-scoped listing. |
| go/core/internal/httpserver/handlers/agents_test.go | Add tests ensuring namespace-scoped listing filters both Agents and AgentHarnesses. |
| go/api/client/agent.go | Add a client method (and interface entry) for listing agents by namespace. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7035655 to
b6ed0c8
Compare
Author
|
Please ignore my force-pushes I forgot to sign the commit(s). |
Signed-off-by: Codex <codex@openai.com> Signed-off-by: Maaz Ghani <maazghani@gmail.com>
54ada34 to
0c54895
Compare
Signed-off-by: Maaz Ghani <maazghani@gmail.com>
peterj
approved these changes
May 16, 2026
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.
Addresses #1812 and @EItanya's feedback to implement server side. If this PR lands, I'll wire the UI into it next.
Adds
GET /api/agents/{namespace}to work likekubectl get agent -n kagent, and leavingGET /api/agentsaskubectl get agent -A.Re-use existing namespace validation pattern to return invalid namespaces as 400 bad request.
HandleListAgentsForNamespacehandler with tests/{namespace}inserver.goListAgentsto hit path-based/api/agents/${namespace}Ran e2e tests using kind-backed env successfully, and validated namespace-filtering works.