#15606: LLM Task: add explicit thinking level wiring
docs
extensions: llm-task
size: S
Cluster:
Agent Thinking Defaults Enhancement
## Problem
`llm-task` could resolve and pass `provider/model`, but it had no explicit `thinking` input and did not forward a thinking level to embedded runs.
As a result, workflow users could not intentionally set thinking behavior per `llm-task` call, and runs implicitly fell back to runner defaults.
## Summary of Solution
This PR adds explicit thinking-level support to `llm-task` and aligns validation behavior with existing OpenClaw patterns.
### What changed
- Added optional `thinking` parameter to `llm-task` tool input schema.
- Normalized and validated `thinking` values using shared thinking helpers.
- Added model-aware validation errors for invalid values.
- Added explicit `xhigh` guardrails using existing support checks.
- Passed validated thinking through to embedded runner as `thinkLevel`.
- Updated docs to include the new `thinking` parameter and example usage.
### Implementation details
- `extensions/llm-task/src/llm-task-tool.ts`
- Added `thinking` to tool parameters.
- Added normalization/validation:
- invalid value -> clear error with supported levels hint
- unsupported `xhigh` -> explicit model-support error
- Forwarded to runner:
- `runEmbeddedPiAgent(..., thinkLevel, ...)`
- `extensions/llm-task/src/llm-task-tool.test.ts`
- Added tests for:
- passing explicit thinking override
- alias normalization (`on` -> `low`)
- invalid thinking rejection
- unsupported `xhigh` rejection
- omitted thinking regression (`thinkLevel` not passed)
- Docs updated:
- `extensions/llm-task/README.md`
- `docs/tools/llm-task.md`
- `docs/tools/lobster.md`
## Verification / Tests Performed
### Targeted unit tests
- Command run:
- `pnpm test extensions/llm-task/src/llm-task-tool.test.ts`
- Result:
- `1` test file passed
- `13` tests passed
- `0` failures
### Smoke Test Results
1. thinking: "low" path
- Result payload: {"ok":true}
- Gateway logs confirm llm-task sub-run received thinking:
- provider=openai-codex model=gpt-5.3-codex thinking=low
2. Invalid thinking ("banana")
- Result payload text:
- Invalid thinking level "banana". Use one of: off, minimal, low, medium, high, xhigh.
- This matches the new validation behavior.
3. Unsupported xhigh for Anthropic model
- Result payload text:
- Thinking level "xhigh" is only supported for ...
- This matches the new xhigh guardrail behavior.
4. Omitted thinking (backward compatibility)
- Result payload: {"ok":true}
- Gateway logs confirm llm-task sub-run defaulted:
- provider=openai-codex model=gpt-5.3-codex thinking=off
## Notes
- No plugin config schema changes were introduced in this PR.
- Existing `llm-task` calls without `thinking` remain backward-compatible.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an optional `thinking` parameter to the `llm-task` extension tool schema, validates/normalizes it using the shared `src/auto-reply/thinking.ts` helpers, rejects unsupported `xhigh`, and forwards the validated level to embedded agent runs via `runEmbeddedPiAgent({ thinkLevel })`. Docs and unit tests were updated to cover the new parameter and basic validation/forwarding behavior.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are localized to the llm-task extension, rely on existing shared thinking normalization/validation helpers, and are covered by targeted unit tests. The forwarded `thinkLevel` matches the embedded runner parameter (`RunEmbeddedPiAgentParams.thinkLevel`).
- No files require special attention
<sub>Last reviewed commit: dad5fd0</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#22797: Feat/auto thinking mode
by jrthib · 2026-02-21
82.0%
#10998: fix(agents): pass session thinking/reasoning levels to session_stat...
by wony2 · 2026-02-07
80.3%
#6559: Fix LiteLLM reasoning-tag handling + fallback to <think> content
by Najia-afk · 2026-02-01
78.9%
#10097: fix: add empty thinking blocks to tool call messages when thinking is…
by cyxer000 · 2026-02-06
77.4%
#21614: fix: warn when thinking level xhigh falls back for unsupported models
by lbo728 · 2026-02-20
77.1%
#16298: feat(xai): switch grok-4-1-fast variants by thinking level
by avirweb · 2026-02-14
76.4%
#21558: config: support agents.list[].thinkingDefault
by Uarmagan · 2026-02-20
76.0%
#6685: fix: suppress thinking leak for Synthetic reasoning models
by AkiLetschne · 2026-02-01
76.0%
#13176: fix: resolve llm-task module import for global installs
by striking · 2026-02-10
76.0%
#16899: feat(config): per-agent and per-model thinking defaults
by jh280722 · 2026-02-15
75.9%