Skip to content

fix(slash): handle /model status locally[AI-assisted]#46894 - #46895

Closed
xiaoHEI-312 wants to merge 4 commits into
openclaw:mainfrom
xiaoHEI-312:codex/fix-webui-model-status-command
Closed

xiaoHEI-312 wants to merge 4 commits into
openclaw:mainfrom
xiaoHEI-312:codex/fix-webui-model-status-command

Conversation

@xiaoHEI-312

Copy link
Copy Markdown

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@greptile-apps

greptile-apps Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a UX bug where typing /model status (or /model list) would incorrectly attempt to switch the active model to the literal string "status" or "list" via sessions.patch, rather than displaying the current model and available options. The fix reserves those two keywords in executeModel — consistent with how executeFast already reserves "status" — and a new test confirms sessions.patch is not called for the "status" arg.

Key changes:

  • executeModel now checks normalizedArg === "status" and normalizedArg === "list" before falling through to the patch path, treating both as info-only requests.
  • Minor cleanup: args.trim() is computed once into rawArg and reused throughout the function.
  • New test "treats /model status as model info instead of a model patch" covers the reported case.
  • No test for the equivalent /model list keyword (see inline comment).

Confidence Score: 5/5

  • Safe to merge — minimal, focused fix with no side effects on other commands or existing behaviour.
  • The change is small and self-contained: two reserved-word checks added to one helper function, consistent with the existing pattern in executeFast. The existing test suite covers the happy path and the new test directly guards the regression. The only gap is a missing test for /model list, which is a style issue and not a correctness risk.
  • No files require special attention.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: ui/src/ui/chat/slash-command-executor.node.test.ts
Line: 268-301

Comment:
**Missing test for `/model list`**

The implementation now treats both `"status"` and `"list"` as info-only keywords (line 125 of `slash-command-executor.ts`), but only `/model status` is tested here. A corresponding test for `/model list` would ensure parity and guard against future regressions on that branch.

```suggestion
  it("treats /model status as model info instead of a model patch", async () => {
    const request = vi.fn(async (method: string, _payload?: unknown) => {
      if (method === "sessions.list") {
        return {
          defaults: { model: "default-model" },
          sessions: [
            row("agent:main:main", {
              model: "gpt-4.1-mini",
            }),
          ],
        };
      }
      if (method === "models.list") {
        return {
          models: [{ id: "gpt-4.1-mini" }, { id: "gpt-4.1" }],
        };
      }
      throw new Error(`unexpected method: ${method}`);
    });

    const result = await executeSlashCommand(
      { request } as unknown as GatewayBrowserClient,
      "main",
      "model",
      "status",
    );

    expect(result.content).toBe(
      "**Current model:** `gpt-4.1-mini`\n**Available:** `gpt-4.1-mini`, `gpt-4.1`",
    );
    expect(request).toHaveBeenNthCalledWith(1, "sessions.list", {});
    expect(request).toHaveBeenNthCalledWith(2, "models.list", {});
    expect(request).not.toHaveBeenCalledWith("sessions.patch", expect.anything());
  });

  it("treats /model list as model info instead of a model patch", async () => {
    const request = vi.fn(async (method: string, _payload?: unknown) => {
      if (method === "sessions.list") {
        return {
          defaults: { model: "default-model" },
          sessions: [
            row("agent:main:main", {
              model: "gpt-4.1-mini",
            }),
          ],
        };
      }
      if (method === "models.list") {
        return {
          models: [{ id: "gpt-4.1-mini" }, { id: "gpt-4.1" }],
        };
      }
      throw new Error(`unexpected method: ${method}`);
    });

    const result = await executeSlashCommand(
      { request } as unknown as GatewayBrowserClient,
      "main",
      "model",
      "list",
    );

    expect(result.content).toBe(
      "**Current model:** `gpt-4.1-mini`\n**Available:** `gpt-4.1-mini`, `gpt-4.1`",
    );
    expect(request).toHaveBeenNthCalledWith(1, "sessions.list", {});
    expect(request).toHaveBeenNthCalledWith(2, "models.list", {});
    expect(request).not.toHaveBeenCalledWith("sessions.patch", expect.anything());
  });
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: 8e72e93

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e72e93554

ℹ️ 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".

@xiaoHEI-312 xiaoHEI-312 changed the title fix(ui): handle /model status locally#46894 fix(ui): handle /model status locally[AI-assisted]#46894 Mar 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc6e8cb370

ℹ️ 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".

@xiaoHEI-312 xiaoHEI-312 changed the title fix(ui): handle /model status locally[AI-assisted]#46894 fix(slash): handle /model status locally[AI-assisted]#46894 Mar 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da9aca33e0

ℹ️ 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".

Comment on lines +280 to 283
if (method === "models.list") {
return {
models: [{ id: "gpt-4.1-mini" }, { id: "gpt-4.1" }],
it("mirrors resolved provider-qualified model refs after /model changes", async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore parsable syntax in slash-command executor tests

The new /model status test is inserted before the models.list branch is closed, so the callback body becomes syntactically invalid at this point (and later leaves stray tokens from the displaced /model patch test). With this malformed structure, Vitest cannot parse ui/src/ui/chat/slash-command-executor.node.test.ts, which prevents this test file from loading and blocks the regression coverage this commit intended to add.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: current main and the latest release still route Control UI /model status and /model list through model mutation, and the same-author canonical issue remains open. This PR is a useful candidate fix direction, but it is not merge-ready because the branch conflicts with current main, lacks real behavior proof, and collapses documented list/status behavior into the bare /model summary path.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #46894
Summary: This PR is a candidate fix for the open canonical Control UI /model status and /model list bug, while a sibling attempted PR is closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows /model status and /model list parse into non-empty args, then current Control UI executeModel sends those args as model in sessions.patch, matching the reporter's logs.

Is this the best way to solve the issue?

No. Avoiding the bad sessions.patch call is necessary, but this patch routes list and status to the bare summary branch instead of the documented list/status flows and still needs a current-main refresh plus proof.

Security review:

Security review cleared: The diff is limited to Control UI slash-command branching and colocated tests, with no dependency, workflow, secret, permission, or supply-chain surface change.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-03-15T05:01:53Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • BunsDev: Live commit metadata for the Control UI chat infrastructure slice added slash-command-executor.ts, slash-commands.ts, and the initial executor tests. (role: introduced Control UI slash-command surface; confidence: high; commits: c5ea6134d041, f76a3c5225bb; files: ui/src/ui/chat/slash-command-executor.ts, ui/src/ui/chat/slash-command-executor.node.test.ts, ui/src/ui/chat/slash-commands.ts)
  • steipete: Recent current-main history shows focused Control UI model reference handling, configured model list, and slash-command model qualification work near the affected executor branch. (role: recent model-command path contributor; confidence: high; commits: 7e8f5ca71b7d, 25d52b56a0e1, 870d993eb85c; files: ui/src/ui/chat/slash-command-executor.ts, ui/src/ui/chat/slash-command-executor.node.test.ts, ui/src/ui/chat-model-ref.ts)
  • Mule-ME: Merged Control UI model metadata work touched the same executor/test area and related model-picker/catalog behavior. (role: adjacent Control UI model-selection contributor; confidence: medium; commits: 4977c4ab8221; files: ui/src/ui/chat/slash-command-executor.ts, ui/src/ui/chat/slash-command-executor.node.test.ts, ui/src/ui/chat-model-ref.ts)
  • vignesh07: Commit history attributes the shared /models and /model list UX contract to this author, which is relevant for aligning the Control UI fix with sibling command semantics. (role: shared model-list contract contributor; confidence: medium; commits: 41d56c06b941; files: src/auto-reply/reply/directive-handling.model.ts, src/auto-reply/reply/directive-handling.model.test.ts, docs/tools/slash-commands.md)

Codex review notes: model internal, reasoning high; reviewed against d68ba5edc598.

@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label May 17, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: blank-template Candidate: PR template appears mostly untouched. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 17, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels May 18, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 6, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 6, 2026
@clawsweeper clawsweeper Bot removed the status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. label Jun 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jun 7, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 11, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 1, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 2, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 3, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. I’m closing this stale PR because the latest review rated the current branch F: it still lacks the requested real-behavior proof or merge-ready branch shape, and there has been no human follow-up after the review. A fresh, focused PR against current main with the requested proof is welcome.

@steipete steipete closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: blank-template Candidate: PR template appears mostly untouched. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants