Repository navigation
refactor(providers): consolidate compatible replay policies - #114669
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:03 PM ET / 18:03 UTC. ClawSweeper reviewWhat this changesThis PR replaces several provider-local OpenAI-compatible reasoning replay normalizers with one plugin-SDK helper, shares Ollama’s native transport/replay hooks, and routes xAI through the existing generic payload wrapper. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep this PR open for normal maintainer review. The refactor has a focused shared-policy shape and no concrete patch defect surfaced from the supplied diff, but it carries provider-compatibility risk and the PR body provides test/CI claims rather than after-fix real behavior proof. Likely related people: steipete (medium confidence, provider replay refactor contributor). Priority: P3 Review scores
Verification
How this fits togetherProvider plugins prepare model-specific stream payloads before OpenClaw sends requests to OpenAI-compatible and native provider transports. The shared replay helper determines whether historical assistant reasoning is retained, removed, or backfilled when tool-call conversations switch among those transports. flowchart LR
A[Conversation history] --> B[Provider stream wrapper]
B --> C[Shared reasoning replay policy]
C --> D{Provider transport rules}
D --> E[OpenAI-compatible payload]
D --> F[Ollama native payload]
E --> G[Provider API request]
F --> G
G --> H[Assistant stream and tool calls]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -123, Tests +98. Total -25 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the provider-specific option callbacks narrowly documented and land only after a redacted after-fix provider-session artifact confirms that a replayed tool-call conversation preserves each affected transport’s intended reasoning field behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is a provider-policy refactor, not a report of a currently reproducible user bug. The branch includes focused regression tests, but no failing current-main reproduction was supplied because the intended result is semantic preservation. Is this the best way to solve the issue? Yes, provisionally: centralizing identical replay-field transformations in the existing provider-stream SDK is the most maintainable shape, provided the provider-specific selection and null-handling options remain covered by both tests and real behavior proof. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fd0fdcc45814. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Users switching between OpenAI-compatible providers depend on replayed assistant reasoning being preserved, removed, or backfilled according to the selected model's actual transport. Maintaining those rules independently across Qwen, Baseten, Venice, OpenRouter, Kimi, and DeepSeek-compatible providers makes cross-provider tool-call replay vulnerable to subtle drift. Ollama's local and hosted providers also repeated their native transport and replay policies, and xAI maintained a separate copy of the standard payload-wrapper contract.
Why This Change Was Made
This maintainer-requested, AI-assisted refactor consolidates assistant reasoning replay in the existing provider-stream SDK, moves both Ollama providers onto one plugin-owned native transport/replay hook object, and uses the existing generic payload wrapper for xAI. Provider authentication, catalogs, model selection, request wire formats, callback ordering, cancellation, and public SDK paths remain unchanged.
User Impact
Cross-provider tool-call conversations preserve native reasoning consistently across Qwen, DeepSeek, Baseten, Venice, OpenRouter, Kimi, Xiaomi, and OpenCode Go. Ollama's local and cloud transport behavior remains unchanged. Removes 123 net production lines (+121/-244) without moving production logic into tests or adding a public SDK path.
Evidence
[].git diff --checkpasses.--engine codex --model gpt-5.6-sol --thinking xhigh; no accepted or actionable findings.tsgolanes, full formatting, changed-file checks, dead-code checks, and packaged build are validated on the same Testbox before marking ready.