Repository navigation
fix(llm-task): tool fails when agents configure their own models - #188758
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRestrict 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe 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
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests -1. Total 0 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 30, 2026, 7:37 PM ET / 23:37 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Built CLI / real agent proofFinal 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.
Control in both configurations on both refs: explicit provider-only override with no resolvable model remains rejected ( 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. |
|
🦞👀 Re-review progress:
|
|
Final head: |
What Problem This Solves
llm-taskrejects 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.