Repository navigation
fix: stop MCP servers of plugin packs no workspace chat enables - #233
Conversation
…-packs-16-manifest-mcp
…-packs-16-manifest-mcp
…-packs-16-manifest-mcp
…-packs-16-manifest-mcp
…-packs-16-manifest-mcp
…-packs-16-manifest-mcp
A managed pack that no chat on the workspace enables stayed on disk with its commit marker, so the workspace agent kept starting its MCP servers. The agent now skips the MCP servers of a managed pack whose marker is missing or empty. coderd empties the marker of each pack it wrote to an agent once no unarchived chat on the workspace enables it, forgets the pack so enabling it again rewrites it, and on the first connection to an agent sweeps pack directories it did not write.
# Conflicts: # agent/agentcontext/fork_pack_mcp.go # agent/agentcontext/fork_pack_mcp_internal_test.go
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f58c8d33c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merged after fork-ci passed on head 1f58c8d (run 43169073964), Codex review 5870255173 on that head (the P1 flags the ARCHITECTURE.md TODO, which stays for @ibetitsmike to write; four edge-case P2s declined with replies), 0 unresolved threads, local Go validation with negative controls, and a live recheck on a 1f58c8d server and agent with the |
This stops the workspace agent from running the MCP servers of plugin packs that no chat on the workspace enables. Before this change, disabling or uninstalling a managed pack only hid its tools: the server process kept running and restarted with the agent (Codex P1 on #231, and seen live in the #231 UAT).
Agent (
agent/agentcontext)packMCPSourcesskips a pack under~/.coder/plugins/whose.coder-pack-commitmarker is missing or empty. coderd writes the marker last, so an unmarked pack is either incomplete or disabled. Packs outside the managed root behave as before.coderd (
coderd/x/chatd)materializePluginPacksplans a cleanup (fork_pack_cleanup.go). When this server holds a pack for the agent that the current chat does not enable, it takes the union of enabled packs over the workspace's non-archived chats. Each pack no chat enables gets an empty marker throughWriteFile(the agent API has no delete). The pack is then forgotten, so enabling it again rewrites it and re-pins its chats.~/.coder/pluginsand empties the markers of directories no chat enables. This covers packs written before a restart.Known gaps:
filterPackResources.Validation on 1f58c8d, run in a container:
gofmt -lon the changed files passes.go build ./agent/... ./coderd/... ./enterprise/...passes.go vet ./agent/agentcontext/ ./coderd/x/chatd/passes.go test ./agent/agentcontext/ ./agent/x/agentmcp/passes.go test -run 'Plugin|Pack|PinnedWorkspaceMCP' ./coderd/x/chatd/passes.TestResolverPackMCPSourcesSkipsUnmarkedManagedPacksfail, and never planning a disabled pack makesTestMaterializePluginPacks/ClearsMarkerOfPackNoWorkspaceChatEnablesfail.