Skip to content

Open-source SEO, GEO, and marketing skills for AI agents.

fix(notfair-cmo): codex 0.144 compat + prune dead OpenClaw slash commands

Yuting Zhongf2cf662d2e3d
diff --git a/notfair-cmo/src/components/live-transcript.tsx b/notfair-cmo/src/components/live-transcript.tsx
index fff9d5a6..c943c71f 100644
--- a/notfair-cmo/src/components/live-transcript.tsx
+++ b/notfair-cmo/src/components/live-transcript.tsx
@@ -491,7 +491,7 @@ export function LiveTranscript({
// was sent programmatically (overrides are always real prompts).
const parsed = usingOverride ? null : parseSlashMessage(text);
if (parsed) {
- const action = executeLocalSlashCommand(parsed.command);
+ const action = executeLocalSlashCommand(parsed.command, parsed.args);
if (action) {
setInput("");
switch (action.kind) {
@@ -512,6 +512,40 @@ export function LiveTranscript({
case "stop":
abortRef.current?.abort();
return;
+ case "set-model": {
+ // Same store the selector next to Send uses.
+ const wanted = action.value.toLowerCase();
+ const names = [
+ "default",
+ ...modelOptions.map((m) => m.label),
+ ].join(", ");
+ if (!wanted) {
+ toast.message("Model", {
+ description: `Current: ${
+ modelOptions.find((m) => m.value === model)?.label ??
+ "Default"
+ }. Options: ${names}.`,
+ });
+ return;
+ }
+ if (wanted === "default") {
+ onPickModel("");
+ toast.success("Model reset to default.");
+ return;
+ }
+ const match = modelOptions.find(
+ (m) =>
+ m.value.toLowerCase() === wanted ||
+ m.label.toLowerCase() === wanted,
+ );
+ if (!match) {
+ toast.error(`Unknown model '${action.value}'. Options: ${names}.`);
+ return;
+ }
+ onPickModel(match.value);
+ toast.success(`Model set to ${match.label}.`);
+ return;
+ }
case "help":
toast.message("Slash commands", { description: action.content });
return;
@@ -636,7 +670,10 @@ export function LiveTranscript({
abortRef.current = null;
}
},
- [agentSlug, input, model, pollOnce, projectSlug, router, sendingChat, sessionKey, taskId, threadId],
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- onPickModel is
+ // stable in behavior (writes localStorage + state); modelOptions is a
+ // fresh array from the server component each render.
+ [agentSlug, input, model, modelOptions, pollOnce, projectSlug, router, sendingChat, sessionKey, taskId, threadId],
);
// ── Auto-kickoff for FIRST_TURN-style flows. ────────────────────────
diff --git a/notfair-cmo/src/components/slash-command-popover.test.tsx b/notfair-cmo/src/components/slash-command-popover.test.tsx
index 9d4116f2..34394fb3 100644
--- a/notfair-cmo/src/components/slash-command-popover.test.tsx
+++ b/notfair-cmo/src/components/slash-command-popover.test.tsx
@@ -103,19 +103,17 @@ describe("SlashCommandPopover", () => {
expect(onHover).toHaveBeenCalledWith(2);
});
- it("renders a 'local' badge for executeLocal commands and omits it otherwise", () => {
- const local = SLASH_COMMANDS.find((c) => c.executeLocal)!;
- const remote = SLASH_COMMANDS.find((c) => !c.executeLocal)!;
+ it("renders a 'local' badge on every command — the catalog is all-local now", () => {
render(
<SlashCommandPopover
- commands={[local, remote]}
+ commands={SLASH_COMMANDS}
selectedIndex={0}
onSelect={() => {}}
onHover={() => {}}
/>,
);
const localBadges = screen.getAllByText("local");
- expect(localBadges).toHaveLength(1);
+ expect(localBadges).toHaveLength(SLASH_COMMANDS.length);
});
it("shows the args hint next to commands that declare one", () => {
@@ -138,8 +136,8 @@ describe("SlashCommandPopover", () => {
});
it("filterSlashCommands falls back to substring match", () => {
- const filtered = filterSlashCommands("/ace"); // no prefix; substring "ace" → trace
- expect(filtered.map((c) => c.name)).toContain("trace");
+ const filtered = filterSlashCommands("/ode"); // no prefix; substring "ode" → model
+ expect(filtered.map((c) => c.name)).toContain("model");
});
it("calls scrollIntoView on the selected row after mount", () => {
diff --git a/notfair-cmo/src/components/slash-command-popover.tsx b/notfair-cmo/src/components/slash-command-popover.tsx
index 11538814..3c07a573 100644
--- a/notfair-cmo/src/components/slash-command-popover.tsx
+++ b/notfair-cmo/src/components/slash-command-popover.tsx
@@ -15,18 +15,12 @@ const CATEGORY_LABEL: Record<SlashCommand["category"], string> = {
session: "Session",
model: "Model",
status: "Status",
- agents: "Agents",
- tools: "Tools",
- advanced: "Advanced",
};
const CATEGORY_ACCENT: Record<SlashCommand["category"], string> = {
session: "text-[hsl(var(--notfair-ink-4))]",
model: "text-[hsl(var(--notfair-ink-4))]",
status: "text-[hsl(var(--notfair-ink-4))]",
- agents: "text-violet-600 dark:text-violet-400",
- tools: "text-cyan-600 dark:text-cyan-400",
- advanced: "text-[hsl(var(--notfair-ink-4))]",
};
export function SlashCommandPopover({
diff --git a/notfair-cmo/src/lib/slash-commands.test.ts b/notfair-cmo/src/lib/slash-commands.test.ts
index 408e3cfa..0ed8371d 100644
--- a/notfair-cmo/src/lib/slash-commands.test.ts
+++ b/notfair-cmo/src/lib/slash-commands.test.ts
@@ -18,17 +18,19 @@ describe("SLASH_COMMANDS catalog", () => {
expect(new Set(names).size).toBe(names.length);
});
- it("marks clear/new/stop/help as executeLocal", () => {
- for (const name of ["clear", "new", "stop", "help"]) {
- const cmd = findCommand(name);
- expect(cmd?.executeLocal).toBe(true);
+ it("marks every command as executeLocal — no dead OpenClaw passthroughs", () => {
+ // The catalog used to carry ~17 OpenClaw gateway directives
+ // (/compact, /status, /elevated, …) that were sent to the agent as
+ // literal text. notfair-cmo has no gateway; only commands the client
+ // itself handles belong here.
+ for (const cmd of SLASH_COMMANDS) {
+ expect(cmd.executeLocal).toBe(true);
}
- });
-
- it("does not mark pass-through commands as executeLocal", () => {
- for (const name of ["status", "compact", "model", "think", "elevated"]) {
- const cmd = findCommand(name);
- expect(cmd?.executeLocal).toBeFalsy();
+ for (const name of ["clear", "new", "stop", "model", "help"]) {
+ expect(findCommand(name)).toBeDefined();
+ }
+ for (const gone of ["status", "compact", "think", "elevated", "skill", "queue"]) {
+ expect(findCommand(gone)).toBeUndefined();
}
});
});
@@ -56,12 +58,12 @@ describe("filterSlashCommands", () => {
});
it("falls back to substring match when no prefix hits", () => {
- // "mp" does not prefix any command name, but `compact` contains it,
+ // "od" does not prefix any command name, but `model` contains it,
// so the substring fallback should surface it.
- const r = filterSlashCommands("mp");
+ const r = filterSlashCommands("od");
const names = r.map((c) => c.name);
- expect(names).toContain("compact");
- expect(names.every((n) => n.toLowerCase().startsWith("mp"))).toBe(false);
+ expect(names).toContain("model");
+ expect(names.every((n) => n.toLowerCase().startsWith("od"))).toBe(false);
});
it("returns empty list when nothing matches", () => {
@@ -69,11 +71,10 @@ describe("filterSlashCommands", () => {
});
it("prefers prefix matches over substring matches", () => {
- // "co" prefix-matches commands starting with co (`compact`, `commands`).
- // It should NOT fall back to substring, so e.g. `reasoning` (no "co") is
- // excluded — and the result must contain only prefix hits.
- const r = filterSlashCommands("co");
- expect(r.every((c) => c.name.toLowerCase().startsWith("co"))).toBe(true);
+ // "cl" prefix-matches `clear`. It should NOT fall back to substring,
+ // and the result must contain only prefix hits.
+ const r = filterSlashCommands("cl");
+ expect(r.every((c) => c.name.toLowerCase().startsWith("cl"))).toBe(true);
expect(r.length).toBeGreaterThan(0);
});
});
@@ -93,9 +94,9 @@ describe("parseSlashMessage", () => {
});
it("parses a slash command with args", () => {
- expect(parseSlashMessage("/skill audit ads")).toEqual({
- command: "skill",
- args: "audit ads",
+ expect(parseSlashMessage("/model gpt-5.5 codex")).toEqual({
+ command: "model",
+ args: "gpt-5.5 codex",
});
});
@@ -117,9 +118,9 @@ describe("parseSlashMessage", () => {
describe("findCommand", () => {
it("finds a known command by name", () => {
- const cmd = findCommand("status");
+ const cmd = findCommand("model");
expect(cmd).toBeDefined();
- expect(cmd?.key).toBe("status");
+ expect(cmd?.key).toBe("model");
});
it("returns undefined for an unknown command", () => {
@@ -144,21 +145,29 @@ describe("executeLocalSlashCommand", () => {
expect(executeLocalSlashCommand("stop")).toEqual({ kind: "stop" });
});
+ it("returns a set-model action for /model, carrying the argument", () => {
+ expect(executeLocalSlashCommand("model", "gpt-5.5")).toEqual({
+ kind: "set-model",
+ value: "gpt-5.5",
+ });
+ // No argument → empty value; the composer shows current + options.
+ expect(executeLocalSlashCommand("model")).toEqual({
+ kind: "set-model",
+ value: "",
+ });
+ });
+
it("returns a help action with rendered markdown content", () => {
const r = executeLocalSlashCommand("help");
expect(r?.kind).toBe("help");
if (r?.kind !== "help") return;
expect(r.content).toContain("Available commands");
expect(r.content).toContain("/clear");
- expect(r.content).toContain("/status");
- // Local commands marked, pass-through commands marked differently.
- expect(r.content).toContain("local");
- expect(r.content).toContain("sent to agent");
// Commands that declare args render them.
- expect(r.content).toContain("/skill <name>");
+ expect(r.content).toContain("/model <model>");
});
- it("returns null for a pass-through command", () => {
+ it("returns null for removed OpenClaw passthrough commands", () => {
expect(executeLocalSlashCommand("status")).toBeNull();
expect(executeLocalSlashCommand("compact")).toBeNull();
});
diff --git a/notfair-cmo/src/lib/slash-commands.ts b/notfair-cmo/src/lib/slash-commands.ts
index 9944ed9a..d97f7b0e 100644
--- a/notfair-cmo/src/lib/slash-commands.ts
+++ b/notfair-cmo/src/lib/slash-commands.ts
@@ -1,30 +1,19 @@
/**
* Slash command catalog + local executor.
*
- * Ported from OpenClaw's web UI:
- * - ui/src/ui/chat/slash-commands.ts (catalog + LOCAL_COMMANDS set)
- * - ui/src/ui/chat/slash-command-executor.ts (action-based dispatcher)
- *
- * Rules:
- * - executeLocal=true → command is handled by the client; not sent to the agent.
- * - Anything else → message goes to OpenClaw verbatim.
- *
- * For the V1 client we wire only the no-gateway-RPC locals (clear, new, help,
- * stop). The rest carry executeLocal=false and pass through to the agent.
+ * Every command here is handled CLIENT-SIDE by the chat composer. The
+ * catalog used to carry ~17 more entries ported from OpenClaw's web UI
+ * (/compact, /status, /elevated, /queue, …) marked "pass through to the
+ * agent" — but notfair-cmo no longer runs on OpenClaw, and neither
+ * `claude -p` nor `codex exec` interprets slash commands in the prompt,
+ * so those rows just sent literal "/compact" text to the agent. The
+ * catalog now lists only commands that actually do something.
*/
-export type SlashCommandCategory =
- | "session"
- | "model"
- | "status"
- | "agents"
- | "tools"
- | "advanced";
-
-export type SlashCommandTier = "essential" | "standard" | "power";
+export type SlashCommandCategory = "session" | "model" | "status";
export type SlashCommand = {
- /** Canonical key (matches OpenClaw registry where applicable). */
+ /** Canonical key. */
key: string;
/** Display name (without the leading slash). */
name: string;
@@ -33,29 +22,25 @@ export type SlashCommand = {
/** Optional argument hint shown beside the name. */
args?: string;
category: SlashCommandCategory;
- tier: SlashCommandTier;
- /** When true, AgentChat handles this client-side and does NOT call openclaw. */
- executeLocal?: boolean;
+ /** All current commands run locally; kept for the popover's grouping. */
+ executeLocal: true;
/** Text inserted into the textarea when the user picks this. Defaults to `/${name} `. */
insert?: string;
};
export const SLASH_COMMANDS: SlashCommand[] = [
- // Session — local-only in OpenClaw web UI
{
key: "clear",
name: "clear",
description: "Clear the visible chat buffer (trajectory on disk is kept).",
category: "session",
- tier: "essential",
executeLocal: true,
},
{
key: "new",
name: "new",
- description: "Start a new session (creates a fresh thread).",
+ description: "Start a new chat (creates a fresh thread).",
category: "session",
- tier: "essential",
executeLocal: true,
},
{
@@ -63,155 +48,30 @@ export const SLASH_COMMANDS: SlashCommand[] = [
name: "stop",
description: "Stop the in-flight response.",
category: "session",
- tier: "essential",
- executeLocal: true,
- },
- {
- key: "help",
- name: "help",
- description: "Show available commands.",
- category: "status",
- tier: "essential",
executeLocal: true,
},
-
- // Status — sent to the agent / OpenClaw handles
- {
- key: "commands",
- name: "commands",
- description: "List all slash commands.",
- category: "status",
- tier: "power",
- },
- {
- key: "status",
- name: "status",
- description: "Show current status.",
- category: "status",
- tier: "essential",
- },
- {
- key: "whoami",
- name: "whoami",
- description: "Show your identity / caller.",
- category: "status",
- tier: "standard",
- },
- {
- key: "usage",
- name: "usage",
- description: "Show token / cost usage for this session.",
- category: "status",
- tier: "standard",
- },
-
- // Tools
- {
- key: "tools",
- name: "tools",
- description: "List available runtime tools.",
- category: "tools",
- tier: "standard",
- },
- {
- key: "skill",
- name: "skill",
- description: "Run a skill by name.",
- args: "<name>",
- category: "tools",
- tier: "standard",
- insert: "/skill ",
- },
-
- // Session / context management — pass through to OpenClaw
- {
- key: "compact",
- name: "compact",
- description: "Compact the session context to reduce token use.",
- category: "session",
- tier: "standard",
- },
- {
- key: "reset",
- name: "reset",
- description: "Reset the current session.",
- category: "session",
- tier: "standard",
- },
-
- // Model / behaviour directives — pass through to OpenClaw
{
key: "model",
name: "model",
- description: "Override model for this turn.",
- args: "<id>",
+ description:
+ "Set the model override for this chat (same as the selector next to Send). No argument shows the options; `default` resets.",
+ args: "<model>",
category: "model",
- tier: "standard",
+ executeLocal: true,
insert: "/model ",
},
{
- key: "think",
- name: "think",
- description: "Directive: enable extended thinking.",
- category: "model",
- tier: "standard",
- },
- {
- key: "fast",
- name: "fast",
- description: "Directive: disable thinking for fastest response.",
- category: "model",
- tier: "standard",
- },
- {
- key: "verbose",
- name: "verbose",
- description: "Directive: verbose progress output.",
- category: "model",
- tier: "standard",
- },
- {
- key: "trace",
- name: "trace",
- description: "Directive: include trace details.",
- category: "model",
- tier: "power",
- },
- {
- key: "reasoning",
- name: "reasoning",
- description: "Directive: surface reasoning steps.",
- category: "model",
- tier: "power",
- },
-
- // Advanced
- {
- key: "elevated",
- name: "elevated",
- description: "Directive: request elevated permissions (gateway-controlled).",
- category: "advanced",
- tier: "power",
- },
- {
- key: "exec",
- name: "exec",
- description: "Directive: allow exec tool use (gateway-controlled).",
- category: "advanced",
- tier: "power",
- },
- {
- key: "queue",
- name: "queue",
- description: "Directive: queue the turn instead of running inline.",
- category: "advanced",
- tier: "power",
+ key: "help",
+ name: "help",
+ description: "Show available commands.",
+ category: "status",
+ executeLocal: true,
},
];
/**
* Filter commands by what the user has typed after the leading `/`.
- * Prefix match wins; substring is a fallback so `/cm` still finds /compact + /commands.
+ * Prefix match wins; substring is a fallback so `/od` still finds /model.
*/
export function filterSlashCommands(query: string): SlashCommand[] {
const q = query.trim().toLowerCase();
@@ -246,13 +106,18 @@ export type LocalSlashAction =
| { kind: "clear" }
| { kind: "new-session" }
| { kind: "stop" }
+ | { kind: "set-model"; value: string }
| { kind: "help"; content: string };
/**
- * Execute a slash command locally if it's marked executeLocal. Returns null
- * when the command should be sent to the agent verbatim.
+ * Execute a slash command locally if it's in the catalog. Returns null for
+ * unknown commands — those are sent to the agent verbatim (the user may
+ * legitimately start a message with "/" for other reasons).
*/
-export function executeLocalSlashCommand(command: string): LocalSlashAction | null {
+export function executeLocalSlashCommand(
+ command: string,
+ args = "",
+): LocalSlashAction | null {
const def = findCommand(command);
if (!def?.executeLocal) return null;
switch (command) {
@@ -262,6 +127,8 @@ export function executeLocalSlashCommand(command: string): LocalSlashAction | nu
return { kind: "new-session" };
case "stop":
return { kind: "stop" };
+ case "model":
+ return { kind: "set-model", value: args.trim() };
case "help":
return { kind: "help", content: renderHelp() };
default:
@@ -274,8 +141,7 @@ function renderHelp(): string {
const lines = ["**Available commands** (type `/` to open the menu):", ""];
for (const c of SLASH_COMMANDS) {
const args = c.args ? ` ${c.args}` : "";
- const local = c.executeLocal ? " · local" : " · sent to agent";
- lines.push(`• \`/${c.name}${args}\` — ${c.description}${local}`);
+ lines.push(`• \`/${c.name}${args}\` — ${c.description}`);
}
return lines.join("\n");
}
diff --git a/notfair-cmo/src/server/adapters/codex-local/parse.test.ts b/notfair-cmo/src/server/adapters/codex-local/parse.test.ts
index c55d0303..010c5bc4 100644
--- a/notfair-cmo/src/server/adapters/codex-local/parse.test.ts
+++ b/notfair-cmo/src/server/adapters/codex-local/parse.test.ts
@@ -140,6 +140,39 @@ describe("parseCodexLine", () => {
expect(state.assistantText).toBe("Sure thing.");
});
+ it("surfaces item-level error items as transient errors (codex 0.144+)", () => {
+ const state = makeCodexStreamState();
+ const out = parseCodexLine(
+ JSON.stringify({
+ type: "item.completed",
+ item: { id: "item_3", type: "error", message: "MCP call blew up" },
+ }),
+ state,
+ );
+ expect(out).toEqual([
+ { kind: "error", message: "MCP call blew up", transient: true },
+ ]);
+ // Item errors are non-fatal — the turn keeps going.
+ expect(state.finalized).toBe(false);
+ });
+
+ it("drops known advisory error items (skills-budget nudge on every run)", () => {
+ const state = makeCodexStreamState();
+ const out = parseCodexLine(
+ JSON.stringify({
+ type: "item.completed",
+ item: {
+ id: "item_0",
+ type: "error",
+ message:
+ "Skill descriptions were shortened to fit the 2% skills context budget. Codex can still see every skill, but some descriptions are shorter.",
+ },
+ }),
+ state,
+ );
+ expect(out).toEqual([]);
+ });
+
it("marks the turn finalized on turn.completed", () => {
const state = makeCodexStreamState();
state.assistantText = "Done";
diff --git a/notfair-cmo/src/server/adapters/codex-local/parse.ts b/notfair-cmo/src/server/adapters/codex-local/parse.ts
index c8fec471..2335224e 100644
--- a/notfair-cmo/src/server/adapters/codex-local/parse.ts
+++ b/notfair-cmo/src/server/adapters/codex-local/parse.ts
@@ -119,6 +119,15 @@ export function parseCodexLine(
toolCallId: item.id ?? "",
name: nameForToolishItem(item),
});
+ } else if (item.type === "error" && typeof item.message === "string") {
+ // Non-fatal, item-level errors (fatal ones arrive as turn.failed).
+ // Surface them — silently dropping used to hide real failures —
+ // EXCEPT known advisories that codex prints on every run for
+ // plugin-heavy installs; those would render as a scary red row on
+ // every single turn.
+ if (!isAdvisoryCodexItemError(item.message)) {
+ events.push({ kind: "error", message: item.message, transient: true });
+ }
}
return events;
}
@@ -174,6 +183,22 @@ export function isTransientCodexError(message: string): boolean {
return TRANSIENT_CODEX_ERROR_PATTERNS.some((re) => re.test(trimmed));
}
+/**
+ * Advisory `error` items codex (0.144+) emits on EVERY run in some
+ * configurations — informational config nudges, not turn failures.
+ * Rendering them would put a red error row on every single chat turn.
+ */
+const ADVISORY_CODEX_ITEM_ERROR_PATTERNS: RegExp[] = [
+ // Plugin-heavy installs: "Skill descriptions were shortened to fit the
+ // 2% skills context budget. Codex can still see every skill, …"
+ /^Skill descriptions were shortened/i,
+];
+
+export function isAdvisoryCodexItemError(message: string): boolean {
+ const trimmed = message.trim();
+ return ADVISORY_CODEX_ITEM_ERROR_PATTERNS.some((re) => re.test(trimmed));
+}
+
/**
* Derive the canonical tool `name` field the UI will see for any codex
* item type we route through as a tool event. The shape matters: the