Skip to content

fix(llm-task): tool fails when agents configure their own models - #188758

Merged
obviyus merged 6 commits into
openclaw:mainfrom
Yigtwxx:fix/llm-task-agent-default-model
Oct 30, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
Yigtwxx:fix/llm-task-agent-default-model

Conversation

@Yigtwxx

@Yigtwxx Yigtwxx commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

llm-task rejects no-override calls when models are configured per agent or the global primary is a configured alias. Its unconditional provider/model precheck runs before the existing completion owner can select the correct default.

Why This Change Was Made

Restrict that precheck to explicit/plugin-configured overrides. Calls without overrides already pass model selection to the completion runtime; let that owner resolve per-agent models and aliases. Explicit bad overrides remain rejected. No model policy, SDK, schema or prompt changes. Original fix by @Yigtwxx.

Evidence

Independent built CLI and real agent proof.

Per-agent and alias configurations each fail twice on main and complete twice on the candidate. The real Gateway agent discovers and dispatches llm-task; candidate isolated completions reach a local streaming provider and return JSON. Explicit bad-override controls remain rejected on both refs. No paid keys or host credentials.

Focused suite: 9 passed. Baseline: 2 regression failures, 1 qualified-default control passed, 6 skipped. Test delta +20/-21 (net -1); removed the 12-line allocation by consolidating into the existing fenced-JSON case. Production +2/-1.

Merge danger

Two-way door: revert restores the precheck; no migration or stored-format change. Blast radius is llm-task calls without model/provider overrides whose defaults require runtime resolution. Existing override validation and completion-owner authorization remain unchanged.

Without a model override the completion runtime already selects the
agent's model, but the tool still pre-validated agents.defaults.model
as a literal provider/model ref and threw before reaching the runtime.
Per-agent models (the multi-agent docs shape) and alias primaries made
every call fail. Apply the pre-check only to explicit overrides.
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Restrict llm-task’s provider/model precheck to explicit or plugin-configured overrides so the completion runtime can resolve default models.

Example: An agent uses anthropic/claude-sonnet-4-6 under agents.entries.chat.model and calls llm-task without overrides.

  • Before: The tool throws a provider/model resolution error before invoking completion.
  • After: The completion runtime selects the agent’s model and the tool returns parsed JSON.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, complete correction supported by shipped-entry-point evidence and reported red/green regressions; no migration is needed because stored formats and settings are unchanged.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): In #188758 (comment), obviyus records secretless Linux built-CLI runs where a real Gateway agent discovers and dispatches llm-task against a local streaming provider: both default-selection cases fail on main and return JSON on the candidate, while invalid explicit overrides remain rejected; inspected production owners are unchanged at the reviewed head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Valid per-agent models and configured alias defaults make no-override llm-task calls fail before inference.
Reason: Restores the existing runtime-owned default-selection contract without adding configuration, APIs, state or another selection owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current llm-task failure with a minimal owner-preserving change; no actionable defects remain, and exact-head CI is still pending.

Priority: P2
Reviewed head: d2227013232f25b29a963b3489f949acfde8f91e

Before merge

None.

Findings

None.

Agent review details

How this fits together

The optional llm-task plugin accepts a prompt, input and optional schema, delegates tool-free inference to the host completion runtime, and returns validated JSON.

flowchart LR
  A[Agent or workflow] --> B[llm-task tool]
  B --> C[Host completion runtime]
  C --> D[Agent model selection and policy]
  D --> E[Isolated provider completion]
  E --> F[JSON parsing and validation]
  F --> A
Loading

Technical review

Best possible solution:

Keep default model selection with the completion runtime and retain local validation for explicit overrides, as this PR does.

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

Current-main source deterministically rejects the two reported configurations before completion; the published built-CLI matrix independently records both failures and successful candidate results.

Is this the best way to solve the issue?

The existing hasModelOverride condition is the smallest complete correction: it removes an irrelevant precondition while preserving explicit-override validation and host-owned selection and policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 70134e42285b.

Provenance checked

  • Provider/model precheck changes intended behavior with a stated reason (12d398d: The cited simplification inlined model-key construction while preserving behavior; this PR explains why its unconditional validation conflicts with runtime-owned defaults established by feat(agents): add tool-free isolated completion #114343.)
  • Consolidated llm-task tests keeps the original intent (test(providers,ui,qa): remove low-value tests (batch d633) #185072: Earlier test cleanups consolidated fixtures and removed repeated assertions while retaining distinct boundaries; this change extends an existing case with the two failing configurations and reduces net test lines.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +1, Tests -1. Total 0 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 1 +1
Tests 1 20 21 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 22 22 0

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: A focused bug prevents optional llm-task workflows from using valid per-agent models or alias defaults.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-30T22:28:27.811Z sha 69da996 :: needs changes before merge. :: [P2] [P2] Allocate the added regression-test lines
  • reviewed 2026-10-30T22:49:22.554Z sha 6822d2a :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 7:37 PM ET / 23:37 UTC (Revision 3).

@Yigtwxx

Yigtwxx commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 30, 2026
@obviyus

obviyus commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Built CLI / real agent proof

Final head: 7dd1764. Production build: c70a8e2; the subsequent commit only consolidates tests/removes the allocation. Baseline main: 1d2e0b2. Contributor @Yigtwxx's commit is preserved.

Independently built main and candidate in a secretless Node 24.22.1 Linux container. Ran the built CLI through normal Gateway agent turns with a local OpenAI-compatible streaming fixture, isolated HOME/state/config, and exact-binary config/session path reports. The agent performed actual tool_search, tool_describe and dispatch_action calls to the bundled llm-task plugin. No direct plugin invocation or mocked completion owner; the candidate's isolated completion made an additional real provider HTTP request.

Configuration Main, twice Candidate, twice
Model only under agents.entries.main provider/model resolution error; 0 isolated completions JSON {"ok":true}; 1 isolated completion each
Configured alias as defaults.model.primary provider/model resolution error; 0 isolated completions JSON {"ok":true}; 1 isolated completion each

Control in both configurations on both refs: explicit provider-only override with no resolvable model remains rejected (provider=fixture, model=), with zero isolated completion requests. Total: 12 real agent turns, four successful candidate isolated completions. All CLI turn commands exited 0, including tool-error cases: the verdict is grounded in actual tool results and provider requests, not CLI exit code. Four Gateway processes were SIGTERM-stopped and awaited after the matrix.

Pueue proof task 12607 succeeded. Raw requests/results are retained in results.json; Gateway logs and path receipts are retained alongside proof.mjs. Initial setup corrections (obsolete agents.list configuration and assuming eagerly exposed tool names) are excluded from the successful matrix; the final harness uses current keyed entries and actual discovery/dispatch contracts.

Focused candidate owner suite: 9 passed. Same consolidated default-selection tests on baseline: 2 failed (per-agent and alias resolution), 1 passed (qualified default), 6 skipped. Format passed. Overall test diff +20/-21 (net -1); the 12-line allocation is removed. Consolidation preserves fenced JSON parsing, model-selection regression, prompt contract, schema validation, explicit qualified override, invalid thinking and cancellation, while dropping incidental undefined-option/default and prompt-copy echoes. Production remains +2/-1: no policy, SDK, schema or prompt changes.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: imessage Channel integration: imessage labels Oct 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: byteplus extensions: codex extensions: openshell extensions: clickclack labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Final head: d2227013232f25b29a963b3489f949acfde8f91e. Integrated current main 80f16147e4a8f because after-push detected GitHub/local changed-file disagreement; the helper now confirms the same two files and requested exact-head re-review. This integration changes neither the llm-task plugin nor the inspected completion runtime owner paths. The built runtime proof and focused results linked above remain applicable to that unchanged owner correction; the production build SHA is recorded there. No source repush or CI rerun was used to chase a green result.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@obviyus
obviyus merged commit b65961b into openclaw:main Oct 30, 2026
126 of 144 checks passed
@obviyus

obviyus commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Landed in b65961b. Thanks @Yigtwxx. llm-task now works with per-agent and alias default models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: llm-task Extension: llm-task P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants