Skip to content

Conversation

@ThomasK33
Copy link
Member

Fixes agent skills slash commands (e.g. /mux-docs) by making skill discovery/resolution resilient and debuggable.

  • Backend: align agent skill discovery runtime context with send-message path (workspaceName for Docker containerName derivation, in-place workspace handling).
  • Backend: treat Docker as a remote runtime for skill directory listing and use a stable remote cwd.
  • Frontend: surface failures from agentSkills.list/get with toasts instead of falling through to “Unknown command”.
  • UI: display muxMetadata.rawCommand for agent-skill user messages.
  • Tests: cover agentSkills.list/get with workspaceId and add a transcript display regression test.

📋 Implementation Plan

Plan: Restore agent skills as slash commands (suggestions + execution + display)

Findings (what changed + when)

  • Feature merged: c172866ade9de0a61996b6eb6174ce864aa72d78Mon Jan 19, 2026🤖 feat: expose agent skills as slash commands (#1673)
    • Adds agentSkills.list/get oRPC endpoints + ChatInput interception for /{skill}.

Current symptoms (from your repro)

  • Skills do not appear in / suggestions (even with prefix filtering and after scrolling).
  • Manually typing /mux-docs results in “Unknown command”.
  • Normal chat works, so this is likely isolated to skill discovery/lookup.

Most likely failure point

In src/browser/components/ChatInput/index.tsx:

  • Suggestions require agentSkillDescriptors loaded via api.agentSkills.list(...).
  • Execution requires api.agentSkills.get(...) to resolve unknown slash commands into a skill invocation.
  • Both calls can fail today without user-visible error details (list logs to console; get is fully swallowed), which makes real backend failures look like “Unknown command”.

Recommended approach (fix root cause + add guardrails)

Approach A (recommended): Make skill lookup reliable + make failures debuggable

Net LoC (product code only): ~40–120

  1. Surface the real error (frontend)

    • File: src/browser/components/ChatInput/index.tsx
    • When api.agentSkills.list(...) fails, show a non-spammy toast like “Failed to load agent skills” with a short error message.
    • When the user enters /{something} and api.agentSkills.get(...) throws, show a toast like:
      • “Failed to resolve skill ‘{name}’: {error}”
      • (instead of silently falling through to “Unknown command”).
  2. Harden agent skills discovery/lookup (backend)

    • Goal: agentSkills.list/get should be best-effort and never take down the feature due to a runtime-specific edge.

    Concrete hardening targets:

    • src/node/orpc/router.tsresolveAgentDiscoveryContext(...)
      • Align runtime construction with the send-message path (pass workspaceName, and add a defensive fallback if runtimeConfig is missing/corrupt).
      • Consider mirroring the “in-place workspace” logic used by aiService.sendMessage (projectPath === name).
    • src/node/services/agentSkills/agentSkillsService.ts
      • Ensure discovery cannot throw due to remote runtime issues.
      • Fix remote-runtime directory listing: Docker is a remote runtime too; don’t use local FS reads for Docker paths.
        • Prefer switching the runtime instanceof SSHRuntime check to a RemoteRuntime-based check (SSH + Docker).
  3. Add a regression test that matches your repro

    • Add a node-side test that exercises the router/service and asserts:
      • agentSkills.list({ workspaceId }) returns at least the built-ins (e.g. mux-docs)
      • agentSkills.get({ workspaceId, skillName: "mux-docs" }) succeeds
    • Add a small UI/unit test (if feasible) that verifies:
      • failing agentSkills.get produces a skill-specific error toast (not generic “unknown command”).

Approach B (follow-up): Fix transcript display for skill invocations

Net LoC (product code only): ~5–15

Once skills execute again, also fix the display regression so the transcript shows the original slash command (muxMetadata.rawCommand) instead of the synthetic “Run the … skill” text.

  • Likely regression commit: 5e45e7cc74af3351892650849ffe1f87116bf6ed (🤖 fix: add compact retry shortcut for stream errors (#1752)).
  • File: src/browser/utils/messages/StreamingMessageAggregator.ts

Validation / exit criteria

  • Typing /mux-docs runs the skill (no “Unknown command”).
  • Skill suggestions appear in the / menu (and via prefix filtering like /mux).
  • (After follow-up) transcript displays the original slash command.
  • make typecheck + make static-check pass.
Notes
  • If the underlying failure is runtime-specific (SSH/Coder/Docker), the backend hardening step is the highest ROI: it prevents skills from disappearing due to transient runtime issues.
  • Skill shadowing by built-in slash commands (same name) is still expected behavior.

Generated with mux • Model: openai:gpt-5.2 • Thinking: xhigh • Cost: $4.36

@ThomasK33
Copy link
Member Author

@codex review

I've restored the agent skills and implemented the emoji-to-icon migration. I also ensured that the "Cost" tab is the default for new workspaces and fixed a Makefile issue where shellcheck was linting node_modules.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ThomasK33 ThomasK33 force-pushed the agent-skills-nn1e branch 3 times, most recently from 24078e7 to 0441cf2 Compare January 20, 2026 17:10
- Fix runtime context for agent skill discovery (docker containerName, in-place workspaces)

- Treat Docker as a remote runtime for skill directory listing

- Show actionable toasts when skill discovery/resolution fails

- Display raw /{skill} command in transcript; add regression tests

Change-Id: Ic6aac59aeb71e22efb4c763ce01d95069b615fd1
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: If598ba419859755ac177bd91b9d904191e4e9d45
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ifbb4bae2b32f0a9e065f69ad8890c3460d5c23cd
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I90192188e2c5012fc764dbdd18fc2bd90d4b87fa
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ia8565830deb5cc21d6e814548794148de86d6322
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I1c47997210b39d216089b5b22c468cc49f658d9c
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: I5a62b5c2349050fdc1d8d05a7a083a4a8930e907
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Exclude common non-repo directories like node_modules and venvs from\nSHELL_SRC_FILES to reduce noise and avoid scanning vendored scripts.

Change-Id: Iad8b1fcbe40631754709e60fa210c243e0023337
Signed-off-by: Thomas Kosiewski <tk@coder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant