Repository navigation
fix(providers): canonicalize model families and stream outcomes - #116998
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 31, 2026, 6:14 PM ET / 22:14 UTC. ClawSweeper reviewWhat this changesThis PR finalizes incomplete Amazon Bedrock stream blocks and centralizes OpenRouter model-family normalization so configured aliases and dated model names receive the intended cache, reasoning, replay, and assistant-prefill behavior. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open: current Likely related people: Priority: P2 Review scores
Verification
How this fits togetherProvider plugins turn configured model references and provider stream events into OpenClaw’s shared assistant-message flow. The Amazon Bedrock plugin owns Converse-stream block lifecycle, while the OpenRouter plugin owns provider-specific model-family and request-payload decisions. flowchart LR
Config[Configured model reference] --> OpenRouter[OpenRouter provider plugin]
ProviderStream[Bedrock Converse stream] --> Bedrock[Bedrock stream owner]
OpenRouter --> Payload[Normalized request payload]
Bedrock --> Events[Finalized assistant events]
Payload --> AgentLoop[Shared agent loop]
Events --> AgentLoop
AgentLoop --> Response[Assistant response]
Decision needed
Why: The repository policy requires live verification for external API behavior, but obtaining Bedrock/OpenRouter inference proof may require maintainer-controlled credentials and cost approval. Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +227. Total +225 across 6 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the plugin-owned normalization and Bedrock finalizer, then add redacted after-fix evidence from a real Bedrock stream and an authenticated OpenRouter request that exercise the affected terminal and payload paths before merging. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main leaves active Bedrock blocks without terminal events when Is this the best way to solve the issue? Yes. The patch repairs behavior at each provider owner, reuses Bedrock’s canonical block-finalization helper, and replaces scattered OpenRouter family parsing with one shared normalizer rather than adding a core fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3972c4151390. LabelsLabel 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
HistoryReview history (4 earlier review cycles)
|
|
Merged via squash.
|
…claw#116998) * fix(providers): canonicalize live model families and stream finalization * test(openrouter): use canonical typed stream fixture --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
contentBlockStop.~routes,z-aimodels, and dated DeepSeek V4 variants reach the correct cache, reasoning, replay, and assistant-prefill decisions.reasoning.enabled: falsewithout deleting a valid trailing assistant prefill.Current reviewed head and merge status
The earlier review referenced superseded head
a0c6fe8b; the current60df12e4follow-up repairs both previously failing CI gates with the canonical typed OpenRouter stream-test fixture.What was actually exercised
BedrockRuntimeClient.sendevent streamGET https://openrouter.ai/api/v1/models@aws-sdk/[email protected],[email protected], and@openrouter/[email protected]types/sourceNo credentials, private endpoints, account identifiers, or real customer content are included below. Synthetic tool identifiers and model-independent fixture content are redacted where appropriate.
Bedrock: redacted actual local provider-owner stream trace
extensions/amazon-bedrock/stream.runtime.lifecycle.test.tsinvokes the actualstreamSimpleBedrockowner. The AWS SDK client is mocked to return an HTTP-200 async event stream that deliberately omitscontentBlockStop:{ "evidence": "local provider-owner execution; mocked AWS SDK response", "model": "<bedrock-model-redacted>", "endpoint": "<bedrock-endpoint-redacted>", "sdkHttpStatus": 200, "providerEvents": [ { "messageStart": { "role": "assistant" } }, { "contentBlockDelta": { "contentBlockIndex": 0, "delta": { "text": "ready" } } }, { "messageStop": { "stopReason": "end_turn" } } ], "contentBlockStopEmittedByProvider": false, "observedTerminalOwnerEvents": ["text_end", "done"], "persistedContent": { "type": "text", "text": "ready" }, "persistedScratchFields": [] }The same actual provider-owner loop is exercised for all four fixture variants:
These are real outputs of the shipped provider owner driven by a synthetic SDK event stream; they are not presented as live Bedrock traffic. The directly inspected installed SDK declares
ContentBlockDeltaEvent,ContentBlockStopEvent,MessageStopEvent, and redacted-reasoning bytes in its public event contract.OpenRouter: redacted actual local owner request/response traces
extensions/openrouter/chat-owner-regression.test.tsregisters the actual OpenRouter plugin and invokes its real cache/thinking/stream-wrapper hooks. The following traces show deterministic in-process hook inputs and captured transformed payloads, not network requests or provider inference responses.Qualified references and live-catalog families
{ "evidence": "local plugin cache-hook execution; no provider network call", "isCacheTtlEligible": { "openrouter/anthropic/claude-sonnet-5": true, "openrouter/deepseek/deepseek-v4-pro": true, "openrouter/moonshotai/kimi-k3": true, "z-ai/glm-5.2": true, "openrouter/z-ai/glm-5.2": true, "~anthropic/claude-opus-latest": true, "~moonshotai/kimi-latest": true, "openai/gpt-5.4": false, "~openai/gpt-5.4": false, "openrouter/openai/gpt-5.4": false } }Dated DeepSeek V4 model: captured request transformation
{ "evidence": "local OpenRouter stream-wrapper payload capture; no HTTP request", "configuredModelReference": "deepseek/deepseek-v4-flash-0731", "thinkingProfile": { "defaultLevel": "high" }, "inputPayload": { "messages": [{ "role": "assistant", "content": "done" }] }, "capturedOutputPayload": { "reasoning": { "effort": "high" }, "messages": [ { "role": "assistant", "content": "done", "reasoning_content": "" } ] } }Qualified/latest Anthropic model: captured request transformation
{ "evidence": "local OpenRouter stream-wrapper payload capture; no HTTP request", "configuredModelReferences": [ "~anthropic/claude-opus-latest", "openrouter/~anthropic/claude-opus-latest" ], "inputPayload": { "reasoning": { "effort": "high" }, "messages": [ { "role": "user", "content": "Continue." }, { "role": "assistant", "content": "{" } ] }, "capturedOutputPayload": { "reasoning": { "effort": "high" }, "messages": [{ "role": "user", "content": "Continue." }] } }Explicitly disabled reasoning preserves assistant prefill
{ "evidence": "local OpenRouter stream-wrapper payload capture; no HTTP request", "configuredModelReference": "anthropic/claude-opus-5", "inputPayload": { "reasoning": { "enabled": false }, "messages": [ { "role": "user", "content": "Return JSON." }, { "role": "assistant", "content": "{" } ] }, "capturedOutputPayload": { "reasoning": { "enabled": false }, "messages": [ { "role": "user", "content": "Return JSON." }, { "role": "assistant", "content": "{" } ] } }Actual live public OpenRouter catalog response
An unauthenticated live call to
GET https://openrouter.ai/api/v1/modelsreturned all four affected public model identifiers:{ "evidence": "live public OpenRouter model-catalog response; no authenticated inference", "deepseek/deepseek-v4-flash-0731": true, "z-ai/glm-5.2": true, "~anthropic/claude-opus-latest": true, "~moonshotai/kimi-latest": true }This proves that the regression fixtures correspond to currently advertised model references; it does not claim that a live generation request was made.
Frozen-baseline red reproduction
Baseline commit:
36b80ada3ceae2de21b3d8710b883d778e4c4578.The failing cases cover missing Bedrock terminal events, leaked streaming scratch state, qualified/cacheable model families,
~aliases, explicitly disabled reasoning, and dated DeepSeek thinking/replay.Exact-current-head independent verification
The final candidate was fetched into a separate detached remote checkout with its immutable Git identity and clean tree asserted before running validation:
0; final Testbox lease stopped and independently verifiedcompleted.+33/-35, net -2.Independent full-branch review
Response to ClawSweeper rank-up moves
60df12e4, recorded the currentMERGEABLEstate, linked the successful current-head CI gates, and reproduced the previously failing full test-type/lint lanes plus all 111 owner tests on an independently clean exact-head checkout.Remaining evidence limitation: No credentialed live Bedrock or OpenRouter generation was executed. If real paid/authenticated provider inference is a strict merge requirement, this PR documents that limitation explicitly instead of presenting fixture output as live-provider traffic.