Fix mesh agent creation: permissions reload + project context#656
Open
Fix mesh agent creation: permissions reload + project context#656
Conversation
The /mesh/fleet/apply and /mesh/agents/create endpoints write agent permissions to disk but never reload the in-memory PermissionManager, causing 403 errors for newly created agents. The dashboard's create endpoint already does this correctly — add the same reload call to the two mesh endpoints.
The /mesh/fleet/apply and /mesh/agents/create endpoints start agent containers but never set PROJECT_MD_PATH or PROJECT_NAME in env_overrides. This means agents created at runtime through the mesh never get their project's PROJECT.md mounted, even when assigned to a project. The CLI startup path (src/cli/runtime.py) already does this correctly — this change mirrors that logic in both mesh endpoints by checking _agent_projects for the agent and injecting the project env vars when a mapping exists.
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
/mesh/fleet/applyand/mesh/agents/createwrite permissions to disk but never calledpermissions.reload(), so newly created agents got 403 Forbidden on all mesh API calls (e.g. LLM proxy). The dashboard's create endpoint already did this correctly.PROJECT_MD_PATH/PROJECT_NAMEenv vars, so they launched withoutPROJECT.mdeven when assigned to a project. Now mirrors the CLI startup behavior.Test plan
pytest tests/test_dashboard.py tests/test_permissions.py -xpasses🤖 Generated with Claude Code