Registry Mirror
Skip to content

Conversation

@spichen

@spichen spichen commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

When an atespace already exists and the controller has scoped access but no global can_create_atespace permission, agent preparation fails with PermissionDenied. EnsureAtespace unconditionally calls CreateAtespace, so authorization can reject the request before the server returns AlreadyExists.

Look up the atespace first and create it only on NotFound. Propagate other lookup errors and retain AlreadyExists handling for concurrent creation. This lets controllers use pre-provisioned atespaces with scoped permissions.

Regression coverage checks existing spaces, missing spaces, concurrent creation, denied/failed lookups, and creation failures.

Validation:

  • gofmt and git diff --check pass.
  • The equivalent fix passed the Substrate package tests on the fork used to reproduce the failure.
  • On this upstream-based branch, go test ./core/internal/substrate ./core/internal/controller, the focused retry go test -p 2 ./core/internal/substrate, and make -C go lint could not complete because the local disk ran out of space while building dependencies/linking. Upstream CI validation is still needed.
  • The patched controller has not been deployed for a live end-to-end verification.

Signed-off-by: Salah <nh.salah@gmail.com>
@spichen
spichen requested a review from a team as a code owner October 18, 2026 17:50
@github-actions github-actions Bot added the bug Something isn't working label Oct 18, 2026
@EItanya
EItanya added this pull request to the merge queue Oct 20, 2026
Merged via the queue into kagent-dev:main with commit 2a50a8b Oct 20, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants