agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

[Bug]: AO chat agent runs a sibling product's CLI (Superset on macOS, Wmux on Windows) instead of `ao`

Open Vaibhaav-Tiwari opened this issue 2 months ago • 5 comments

What went wrong?

I had not used Superset's CLI. I opened the AO desktop app and told it to open x.com — that was all I did. Instead of AO handling it through the AO CLI (ao browser / ao preview), the agent in the session started using the Superset CLI. The same thing happens on Windows, where it may start using the Wmux CLI instead of the AO CLI.

Possibly related: #2195, #2844, #4677

Agent-collected evidence

Collected 2026-09-17 against a main worktree (agent-orchestrator-57).

  • AO injects its using-ao skill only as a prose pointer in the agent system prompt (backend/internal/session_manager/manager.go:4230); the skill itself lives at ~/.ao/skills/using-ao, not in any harness user-skill directory.
  • The only guard against foreign browser tooling in that prompt is a prose sentence (manager.go:4241): "Do not use Codex/host in-app browser connectors ... or a browser MCP for the AO Browser panel."
  • Session spawn env never restricts the harness's discovery of user-level configuration (manager.go:4374 spawnEnv, manager.go:4407 runtimeEnv).
  • Kimi sessions isolate KIMI_CODE_HOME into an AO-managed home (backend/internal/adapters/agent/kimi/kimi.go:64), but per the official docs ~/.agents/skills/ is scanned regardless of KIMI_CODE_HOME because it "stays under the real OS home so it can be shared across tools" (Agent Skills docs). On the reporter's machine, superset-* skills are installed at user scope (~/.agents/skills/superset-*), and the superset-browser skill's trigger description matches "open a URL / preview a web app" requests.
  • AO itself never writes skills or MCP servers into user-level config; its only user-global harness write is the additive per-workspace hasTrustDialogAccepted key in ~/.claude.json (backend/internal/adapters/agent/claudecode/claudecode.go:570). The suspected vector is Superset's/Wmux's own user-level installs (skills; Wmux advertises MCP auto-registration), which AO sessions then load.
  • Daemon mix-up was ruled out: the desktop attach path fails closed on identity mismatch (frontend/src/shared/daemon-attach.ts:140, frontend/src/shared/daemon-launch.ts:79), and neither the daemon nor the desktop executes binaries named superset/wmux — the foreign CLI must have been invoked by the agent process.

Limits: the exact in-session trigger (auto-invoked skill vs auto-registered MCP) was not captured from the affected session's logs, and the harness running in the affected session is unconfirmed.

Vaibhaav-Tiwari avatar Sep 17 '26 15:09 Vaibhaav-Tiwari

Image

Vaibhaav-Tiwari avatar Sep 17 '26 15:09 Vaibhaav-Tiwari

RCA (agent-collected, 2026-09-17)

Causal chain, link by link:

  1. Foreign skills enter via the shared user tier. Superset distributes its agent skills by installing superset-* into ~/.agents/skills/ — the cross-tool shared tier. Wmux uses the parallel MCP channel (auto-registration into the user's agent MCP config). AO never writes to either (its only user-global write is the additive per-workspace trust key in ~/.claude.json).
  2. AO sessions spawn harnesses with no capability masking. Chat launches return nil env overrides (chatdriver/kimiacp/driver.go:33-41); session env only adds AO vars (session_manager/manager.go:4407). Grep confirms zero use of --strict-mcp-config, --bare, safe-mode, --skills-dir, or any skill/MCP disable anywhere in harness launch paths.
  3. The one isolation AO has doesn't cover the shared tier. KIMI_CODE_HOME=<dataDir>/kimi (kimi/kimi.go:60-65) relocates kimi's own state, but per the official docs ~/.agents/skills/ "stays under the real OS home so it can be shared across tools" and is always scanned. (Kimi MCP is isolated this way — mcp.json follows KIMI_CODE_HOME.)
  4. The model picks the registered skill over AO's prose. All skills' name/description/whenToUse are visible to the model; auto-invocation fires on trigger match. superset-browser's trigger ≈ "open a URL / preview a web app" — an exact match for "open x.com". AO's using-ao reaches the model only as a prose pointer appended to the system prompt (manager.go:4230), a pointer that has to compete with a first-class registered skill.
  5. For claude sessions the MCP channel is wide open by design. The claude ACP driver documents its intent: "login, subscription, settings, MCP configuration, hooks … remain the user's own" (chatdriver/claudeacp/driver.go:3-6) — so auto-registered foreign MCP servers (Wmux) are live tools in AO claude chats.

Root cause: AO's "never touch user config" hygiene is only half a defense. It makes AO a good citizen of the shared user tier, but nothing shields AO sessions from what other products write there — and AO's only in-session countermeasures (the using-ao pointer, the "do not use a browser MCP" sentence at manager.go:4241) are prose, not enforcement. The shared ~/.agents/skills/ convention is simultaneously every product's distribution channel and every product's attack surface.

Per-harness isolation levers verified against official docs (2026-09-17):

Harness Foreign skills Foreign MCP
Kimi --skills-dir <dir> replaces all auto-discovered skill dirs for the session (verified: overrides doc). ~/.agents/skills cannot be excluded individually. Already isolated via KIMI_CODE_HOME (mcp.json follows it).
Claude Code No per-session disable of ~/.claude/skills (--bare/--safe-mode kill AO's hooks too). --strict-mcp-config (with no --mcp-config ⇒ zero MCP) — unused by AO; passing it through the ACP adapter layer is unverified.
Codex No documented per-session skill disable. No strict flag; CODEX_HOME relocation is the only full isolation (AO already manages codex auth in data-dir slots, so seeding a managed home is feasible).
Gemini ~/.agents/skills alias tier, no documented disable. mcp.allowed server-name allowlist in settings.

Proposed solution (layered)

Layer 1 — close the kimi hole + parity for using-ao (small, surgical):

  • Pass kimi --skills-dir <AO-managed dir> on chat and TUI launches; the managed dir contains only AO's using-ao (plus optional user-allowed entries). This removes the ~/.agents/skills tier from kimi sessions entirely. Flag position on the acp argv needs one verification pass.
  • Register using-ao as a real skill for kimi ($KIMI_CODE_HOME/skills/using-ao/), claude (worktree .claude/skills/using-ao/, reusing the proven opencode sentinel+gitignore pattern from opencode/hooks.go:188), and codex (repo-scope skill, location to verify). opencode already gets this treatment — the other three never did (skillassets installs to ~/.ao/skills, which no harness scans).
  • Strengthen the system-prompt rule from "do not use a browser MCP" to an explicit priority rule: AO-owned surfaces (browser panel, preview, spawn) are handled only via ao commands; foreign orchestrator skills/MCP (Superset, Wmux, cmux-style) must not be used inside AO sessions even when installed.

Layer 2 — per-project session capability policy (the real fix, ties into #2195/#2844):

  • Add a project/user setting sessionCapabilities: inherit | isolated.
  • isolated applies, per harness: kimi --skills-dir; claude --strict-mcp-config (plus AO's own --mcp-config for AO-managed chat MCP — the plumbing exists at ports/chat.go:337); codex seeded CODEX_HOME (mirroring the kimi managed-home pattern, credentials from AO's existing codex account slots); gemini mcp.allowed allowlist.
  • Precedent already exists in-tree: the reviewer gateway overrides HOME/XDG (reviewgateway/gateway.go:65-71) and reviewer adapters use --allowedTools allowlists — the mechanism philosophy just hasn't been applied to normal sessions.
  • Default is a product call (cf. the naked-by-default debate in #2844); shipping as opt-in first avoids silently breaking users who legitimately want their MCP in AO chats.

Layer 3 — detect and warn:

  • Extend the system check to scan ~/.agents/skills/ and user MCP config for known foreign orchestrator integrations (superset-*, wmux, cmux/multica-style entries) and surface a settings warning with a one-click "exclude from AO sessions" that flips the Layer-2 policy.

Layer 4 — convention-level (upstream):

  • Propose skill-frontmatter metadata for the .agents/skills convention (e.g. an origin/orchestrator field and an opt-out marker) so orchestrators can filter foreign skills without excluding the whole tier. Until that lands, Layers 1–2 are the only reliable defense.

Caveats: claude skills have no documented per-session disable short of --bare/--safe-mode (which break AO's hooks), so claude's foreign-~/.claude/skills exposure needs either managed-settings (CLAUDE_CONFIG_DIR with credential seeding) or the Layer-4 convention; kimi's config seeding (kimi/hooks.go:194) may copy a user's extra_skill_dirs into the managed home and should be filtered when isolated.

Vaibhaav-Tiwari avatar Sep 17 '26 17:09 Vaibhaav-Tiwari

From the Sep 28 daily call — the team dug into this exact bug.

What was said: khushi reported that a user with both AO and Superset installed asks the agent to do something ("open AO") and the agent ends up running Superset's CLI instead. -Prasad- reproduced the mechanism: Superset installs pre-tool-use hooks that run their own logic before any tool call and override local hooks, so they take over actions. prateek called it "super invasive" and asked whether there's a simple way to disable that category of hooks for agents running inside AO. Dhruv Sharma took ownership of investigating ("can you look into this?" — "I'll do it"). vaibhaav noted the same pattern happens with Wmux on Windows, which the issue body already documents.

Decisions: khushi was asked to pick up other issues in the meantime; first step is to debug/understand the hook mechanism, and a detection + user-prompt UX (e.g. "we detected invasive hooks on your system") was floated as a possible direction.

"Is there, like, a GitHub issue that somebody has reported on this?" — prateek. This is that issue's thread now.

Source: Call Meeting Sep 28 thread

OrcInc avatar Sep 29 '26 14:09 OrcInc

@Annieeeee11

Vaibhaav-Tiwari avatar Nov 02 '26 16:11 Vaibhaav-Tiwari

i can test this on windows @Vaibhaav-Tiwari

codebanditssss avatar Nov 02 '26 20:11 codebanditssss