Repository navigation
improve(ollama): cover literal fenced command replies - #166561
Conversation
|
🦞👀 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 changesAdds an Ollama stream test confirming that fenced PowerShell command text remains a normal, literal assistant reply. Example: Ollama returns a PowerShell fence containing exec(command="echo hello") while exec is available.
Review scores
ProductKind: Test only · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR provides useful preservation coverage consistent with the maintainer’s fenced-Markdown decision; no actionable code findings remain. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Ollama plugin converts native provider responses into assistant stream events; shared compatibility handling protects Markdown while recognizing supported textual tool-call formats. flowchart LR
A[Agent request and tools] --> B[Ollama plugin]
B --> C[Native Ollama response]
C --> D[Stream compatibility handling]
D --> E[Literal assistant text]
D --> F[Structured tool events]
Technical reviewBest possible solution: Retain the focused preservation test while investigating the unresolved Windows/Qwen execution failure separately. Do we have a high-confidence way to reproduce the issue? This PR preserves existing behavior rather than fixing a reproduced defect; the supplied Gateway controls establish literal fenced output but do not reproduce the original Windows NO_REPLY symptom. Is this the best way to solve the issue? The focused native-stream test protects the reported PowerShell shape without introducing intent heuristics, fatal diagnostics, or executable interpretation of Markdown. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eda41b03a1a0. TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +29. Total +29 across 1 file. 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 HistoryReview history (7 earlier review cycles)
Reviewed October 14, 2026, 12:31 AM ET / 04:31 UTC (Revision 8). |
|
Maintainer investigation: this PR cannot be treated as a tool-execution fix for #165787. I built current main Observed results:
Thus the non-execution of fenced text is observable, but the reported Decision: do not convert fenced Markdown into executable tool calls in this PR. That changes the existing protected-Markdown contract: the transport regression at At head The remaining design question is whether and where to expose a non-fatal unsupported-output diagnostic while preserving requested literal examples and authoritative length completions. A fatal syntax-only detector cannot distinguish those examples from failed invocation intent. Resolving that diagnostic product contract is separate from repairing a demonstrated native adapter defect; no evidence here justifies changing fenced-text execution semantics. |
|
Updated in b2addd2: fenced diagnostics now skip authoritative done_reason=length terminals and preserve explicit literal/example requests, while still reporting likely unintended fenced tool calls. @clawsweeper re-review |
|
修订已推送:eb7e2da5。移除了基于 prompt 关键词的意图猜测和致命 fenced-tool-call 诊断,删除相关诊断模块;保留文本原样返回与 done_reason=length 的终止处理。这样不会把用户要求原样展示的 fenced 内容误报为 provider failure。请重新评审。 @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
CI 暴露了旧测试仍期待 fatal diagnostic;已在 a045320 更新回归测试,改为断言 fenced PowerShell 文本原样作为 assistant text 返回、stop reason 为 stop,且不产生 error。 @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* commit '98116a50c5e3191283f12ee210aa774273f2b8fc': (4815 commits) chore(ui): refresh control ui locales (#171839) fix(gateway): server tests time out when a parallel shard starts cold (#171289) fix(agentsapi): allow shared compaction tuning in hosted sessions (#171813) test(live): prepare runtime config for admitted fixtures test(update): stub state-read retry in restart module fixture fix(test): pnpm test fails on small cloud containers (#171732) fix(code-mode): recover safely from invalid wait IDs (#128886) test(update): load acquisition owner in restart regression perf(gateway): avoid full row warmup for project and catalog pickers (#171714) fix(telegram): voice mentions are ignored in groups when audio scope rules match on chat type (#163746) fix(workboard): only promote todo cards to ready (#171743) perf(sqlite): avoid repeated admission registry publication (#171788) perf: skip unused size accounting for sole session actors (#171777) improve(ollama): cover literal fenced command replies (#166561) refactor(talk): admit cross-store voice writes once (#171721) fix(gateway): recover a Gateway stuck in startup instead of blocking every start (#171678) fix(muse): offer Muse Code sign-in from Provider Access (#171790) perf: avoid full device lists during silent pairing (#171703) docs(cloud): one coherent zero-setup cloud environments guide (#171767) fix(test): include cloud move in sidebar action inventory ...
* commit '98116a50c5e3191283f12ee210aa774273f2b8fc': (185 commits) chore(ui): refresh control ui locales (#171839) fix(gateway): server tests time out when a parallel shard starts cold (#171289) fix(agentsapi): allow shared compaction tuning in hosted sessions (#171813) test(live): prepare runtime config for admitted fixtures test(update): stub state-read retry in restart module fixture fix(test): pnpm test fails on small cloud containers (#171732) fix(code-mode): recover safely from invalid wait IDs (#128886) test(update): load acquisition owner in restart regression perf(gateway): avoid full row warmup for project and catalog pickers (#171714) fix(telegram): voice mentions are ignored in groups when audio scope rules match on chat type (#163746) fix(workboard): only promote todo cards to ready (#171743) perf(sqlite): avoid repeated admission registry publication (#171788) perf: skip unused size accounting for sole session actors (#171777) improve(ollama): cover literal fenced command replies (#166561) refactor(talk): admit cross-store voice writes once (#171721) fix(gateway): recover a Gateway stuck in startup instead of blocking every start (#171678) fix(muse): offer Muse Code sign-in from Provider Access (#171790) perf: avoid full device lists during silent pairing (#171703) docs(cloud): one coherent zero-setup cloud environments guide (#171767) fix(test): include cloud move in sidebar action inventory ...
* fix(ollama): diagnose fenced text tool calls * style(ollama): apply repository formatting * fix(ollama): preserve literal fenced replies and length stops * fix(ollama): preserve fenced text replies * test(ollama): preserve fenced text replies * test(ollama): keep fenced command replies literal --------- Co-authored-by: Peter Steinberger <[email protected]>
Related: #165787
What Problem This Solves
Protects Ollama's existing behavior of returning fenced command-looking prose as literal assistant text, including the reported PowerShell
exec(...)shape.User Impact
There is no runtime behavior change. Fenced Markdown remains visible text and is never converted into executable tool calls. This test does not fix or close the unresolved Windows/Qwen execution report in #165787.
Why This Change Was Made
The earlier fatal diagnostic and prompt-keyword heuristics were removed. This PR now only tests the native Ollama stream boundary: tool availability must not turn a fenced example into a call or provider error. The test uses typed messages/schema, a synthetic path, exact visible content, and normal completion. It continues @67-luck's work and preserves their commits.
Production changes: 0 lines. No configuration, prompt, dependency-version, or migration changes.
Evidence
macOS main baseline through
pnpm openclaw ... agent, an isolated Gateway, and a native Ollama fixture returned the fenced response literally, withsuccessfulToolNames: [], terminal dispositionvisible, and no marker created (8.93s). A separately structured nativeexeccall ran (10.19s); real Ollamaqwen3:8breturned the requested control text (14.91s). This did not reproduce the reporter'sNO_REPLYsymptom and is not Windows or Telegram validation.Focused native-stream and real-HTTP transport suites: 49 tests passed in 235.60s including shared fixture preparation. The new PowerShell case asserts the complete text event sequence, exact literal content, normal stop, and no error/tool events. Scoped test types passed in 13.74s. This is preservation coverage for existing behavior, not a newly fixed production defect.
The final diff is +29 test lines and zero production lines. Formatting, whitespace checks, and all seven required baseline ratchets passed. Codex autoreview of
cebf9f70be4f3a79a121c639a2b7c3ad8453959e: no actionable P0–P2 findings.Scoped type-aware lint passed (764.01s, dominated by plugin SDK declaration preparation). The first attempt hit that preparation step's 300s deadline; the retry used the tool's supported extended preparation budget. No test timeout, rule, or assertion was relaxed.
Exact-head CI run 38509620221 passed, including
openclaw/ci-gate. ClawSweeper reviewedcebf9f70be4f3a79a121c639a2b7c3ad8453959ewith no code findings; its remaining hold requested current-head Gateway evidence.Reviewed-head macOS Gateway proof is now complete. Built with
pnpm build qaRuntime(938.34s wall), then started an isolatedpnpm openclaw --profile text-normalize-166561 gateway runand exercised/v1/chat/completionsthrough the normal agent path and native Ollama adapter:normalization-live-okThe fence/structured cases are deterministic provider-boundary controls through the built Gateway; the Qwen case is live local inference. These establish macOS Gateway behavior, not Windows, Telegram, or the reporter's original model-output cause. ClawSweeper's last reviewed-head comment predates these new proof results and contains no code finding.