🤖 feat: make mux agent routable from Auto in project workspaces#2768
🤖 feat: make mux agent routable from Auto in project workspaces#2768ethanndickson wants to merge 12 commits intomainfrom
Conversation
c16c999 to
bff3f88
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c16c9996c8
ℹ️ 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".
|
@codex review |
842b79e to
7f14af8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f14af86e2
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62fb263f9e
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03cf98f807
ℹ️ 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".
|
Resolved — backward-compat aliases are unnecessary here. Frontend and backend are always in sync (see AGENTS.md IPC/Compatibility section), so breaking tool renames are expected and safe. No persisted policy will reference the old names since this is a net-new feature. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 728534d868
ℹ️ 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".
|
@codex review |
5f358a1 to
1fbe812
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fbe8126d9
ℹ️ 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".
|
@codex review |
588a9a6 to
165bde9
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 165bde9a4f
ℹ️ 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".
165bde9 to
07e4e33
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07e4e3379a
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3437e7ebe0
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94b1554284
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f48ea4bee
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66a7a62441
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee647f0249
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06ffd7c6e8
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76b9b4c242
ℹ️ 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".
76b9b4c to
3b39189
Compare
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b39189d17
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 663000ef59
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2804251002
ℹ️ 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".
| normalizedProbePath === path.resolve(projectRoot) || | ||
| normalizedProbePath === path.resolve(workspacePath) | ||
| ); |
There was a problem hiding this comment.
Use project-runtime roots for Docker split-root workspaces
The split-root classifier currently treats any runtime whose getWorkspacePath() equals workspacePath as local-like, which incorrectly matches Docker (getWorkspacePath() always returns /src). In a Docker project workspace (muxScope.projectRoot is host path, cwd is /src), this returns project-local and later agent_skill_read/agent_skill_read_file call readAgentSkill with host roots while still using the Docker runtime, so runtime stat/read calls target host-only paths that do not exist in-container and skill reads fail.
Useful? React with 👍 / 👎.
Summary
Make the
muxagent (skills, AGENTS.md, config tools) reachable in any project workspace via Auto routing. In project context, tools operate on project-scoped resources (.mux/skills/, projectAGENTS.md); in the system workspace they continue to operate globally. Also eliminates a wasteful throwaway runtime assembly used for sentinel tool-name computation.Follow-up commits harden the runtime path resolver (dangling symlink rejection, portable containment), remove workspace-gated tool restrictions that blocked the mux agent from using
skills_catalogtools outside the system workspace, validateSKILL.mdsymlink targets stay within containment roots during skill listing, and enforce project-root containment in the shared skill resolver for read/read_file flows.Background
The
muxagent was previously confined to the singleton "Chat with Mux" system workspace. All its tools derived scope fromworkspaceSessionDir(navigating up~/.mux/sessions/<id>to find~/.mux/), hardcoding them to global scope. This meant project workspaces couldn't manage their own skills orAGENTS.mdvia mux.Separately,
resolveAgentForStreamcreated a throwaway runtime and instantiated every tool object just to compute tool names for the agent-transition sentinel message. This was slow and causedanalytics_queryto be missing from the handoff message (the stub config lackedanalyticsService).Implementation
1. MuxToolScope type + wiring (
toolScope.ts,aiService.ts,tools.ts)MuxToolScope:{ type: "global", muxHome }— system workspace{ type: "project", muxHome, projectRoot }— project workspace (projectRoot = worktree path)muxScope?: MuxToolScopetoToolConfigurationaiService.tsbased onworkspaceId === MUX_HELP_CHAT_WORKSPACE_IDworkspaceId !== MUX_HELP_CHAT_WORKSPACE_IDtoeffectiveAgentId !== MUX_HELP_CHAT_AGENT_IDso mux running in project scope gets the right capability set2. Scope-aware skill tools (
agent_skill_{write,delete,list}.ts,skillFileUtils.ts)config.muxScope:<projectRoot>/.mux/skills/<muxHome>/skills/validateLocalSkillDirectorygeneralized: takes acontainmentRootparameter instead of hardcodedmuxHomeRealagent_skill_listscans both project and global roots when in project scope, tagging each entry with its scope. Global-only listing retained for system workspace.getMuxHomeFromWorkspaceSessionDirfrommuxHome.ts(file deleted) — all callers usemuxScopedirectly3. Renamed + scope-aware AGENTS.md tools (
mux_agents_{read,write}.ts)mux_global_agents_read/write→mux_agents_read/writeviagit mvconfig.muxScopeto determine target:<projectRoot>/AGENTS.md<muxHome>/AGENTS.mdlstat+ reject-if-symlink) withrealpath()+ containment validation (isPathInsideRoot). In-root symlinks (e.g.,AGENTS.md → docs/AGENTS.md) now work; escaping symlinks are rejected.4. Simplified config tools (
mux_config_{read,write}.ts)config.muxScope!.muxHomedirectly instead ofgetMuxHomeFromWorkspaceSessionDirgetMuxHomeFromWorkspaceSessionDirfromconfigToolUtils.ts5. Agent prompt updates (
mux.md,auto.md,exec.md,plan.md)mux.md: Rewritten for dual-scope behavior with clear context-aware documentation and safety rulesauto.md: Added mux routing criteria for config/skills/AGENTS.md management requestsexec.md/plan.md: Updated tool policy regexmux_global_agents_.*→mux_agents_.*builtInAgentContent.generated.ts6. Sentinel tool-name computation without throwaway runtime (
agentResolution.ts,toolPolicy.ts,toolDefinitions.ts)applyToolPolicyToNames(names, policy)— name-only policy filtering that shares matching logic withapplyToolPolicy(single source of truth for regex/order semantics)applyToolPolicyrefactored to delegate toapplyToolPolicyToNamesgetAvailableTools()gainedenableAnalyticsQuery?: booleanflag (defaultstrue)resolveAgentForStreamreplaced throwaway block withgetAvailableTools(model, flags) → applyToolPolicyToNames(names, policy)— no tool objects instantiatedinitStateManagerfromResolveAgentOptions, addedhasAnalyticsService: boolean7. Runtime AGENTS.md path resolution with security hardening (
mux_agents_path.ts,mux_agents_storage_context.ts)MuxAgentsStorageContextdiscriminated union:global-local | project-local | project-runtimewith resolverresolveAgentsPathOnRuntime()— typed state machine for SSH/remote workspaces:probeRuntimePathState()classifies paths asdangling | existing | missingvia explicit POSIX shell probe ([ -L ... ] && [ ! -e ... ])inspectContainmentOnRuntime()(reusesruntimeSkillPathUtils.tsPOSIX-only primitives:cd && pwd -P, barereadlink)readlink -f— works on BSD/macOS SSH targets8. Removed
skills_catalogworkspace gatesenableSkillsCatalogToolsflag removed fromtoolAvailability.ts—skills_catalog_search/skills_catalog_readnow unconditionally inbaseToolsmux-chatworkspacestoolDefinitions.ts,tools.ts,systemMessage.tsto remove stale forwarding/option plumbing9. SKILL.md symlink containment in
agent_skill_listreadSkillDescriptor()now validatesSKILL.mdcanonical path stays within the containment root viaensurePathContained()before anystat/readFileMAX_FILE_SIZE(1MB) are skipped without loading into memorySKILL.mdsymlinks from escaping project boundaries during skill discovery10. Project-root containment in
agent_skill_read/agent_skill_read_filereadAgentSkill(...)options withprojectContainmentRoot?: string | nullensurePathContained(projectContainmentRoot, skillDir)beforeruntime.stat()/readAgentSkillFromDir()continue(global/built-in fallback preserved)agent_skill_read.tsandagent_skill_read_file.tsnow passconfig.muxScope.projectRootas containment root in project scopeprojectRootis rejected in both read tools11. Test coverage
testHelpers.ts:createTestToolConfigaccepts optionalmuxScope(defaults to global scope pointing at tempDir)muxScopein configsapplyToolPolicyToNamesparity testsmux_global_agents.test.ts→mux_agents.test.tswith expanded scope coverageNoReadlinkFRemoteRuntimesubclass that fails onreadlink -fcommands, verifies split-root operations still succeed)skills_catalogtests updated: "rejects outside Chat with Mux workspace" → "allows from non-mux-chat workspace"agent_skill_listtests: escapingSKILL.mdsymlink skipped, oversizedSKILL.mdskippedagent_skill_read/agent_skill_read_filetests: project skill directory symlink escape rejectedRisks
effectiveAgentIddoesn't resolve toMUX_HELP_CHAT_AGENT_IDin the system workspace, MCP/secrets would incorrectly activate. Low risk — the resolution path for the system workspace always yields this agent ID.realpath+isPathInsideRootapproach is more permissive than the old blanket symlink rejection. Escaping symlinks are still rejected, but in-root symlinks are now allowed. This is intentional for repos with committedAGENTS.mdsymlinks.Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh• Cost:$76.32