Honor provider cooldown hints and add gateway OpenAI compat#1233
Merged
gh-xj merged 10 commits intoeastreams:devfrom Apr 14, 2026
Merged
Honor provider cooldown hints and add gateway OpenAI compat#1233gh-xj merged 10 commits intoeastreams:devfrom
gh-xj merged 10 commits intoeastreams:devfrom
Conversation
2ec715e to
3eba385
Compare
Collaborator
LoongClaw QA Review — PR #1233Reviewed commit: Findings
Coverage
Open Questions
VerdictBlocking findings on the current head; rebase onto |
Merges dev into the PR branch to clear the current conflict set. The release support drift docs moved on dev, so the stale top-level report stays deleted and the updated support-side artifact wins. Constraint: PR eastreams#1233 is currently CONFLICTING against dev Rejected: Keep the deleted top-level drift report | dev already removed that path Confidence: high Scope-risk: narrow Directive: Re-run CI-parity gates after any follow-up code edits on top of this merge Tested: Merge conflict resolution only Not-tested: Runtime/code changes after the merge
The compat gateway branch now rebuilds streamed OpenAI tool calls and keeps upstream HTTP status classes visible on the non-streaming gateway surface. This keeps the PR aligned with the shared runtime after the dev merge while preserving client-visible retry and auth behavior. Constraint: PR eastreams#1233 had to absorb origin/dev before follow-up fixes could land Constraint: Gateway turns currently surface provider failures as strings, so status preservation had to reuse embedded failover snapshots Rejected: Keep generic HTTP 500 mapping | breaks OpenAI-compatible retry/auth semantics Rejected: Duplicate failover snapshot parsing inside the gateway | reuse the existing provider parser instead Confidence: high Scope-risk: moderate Directive: If streamed OpenAI turns gain richer chunk shapes, extend the parser/tests before widening observer-backed streaming further Tested: cargo fmt --all -- --check; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo test -p loongclaw-app reconstructs_openai_tool_calls -- --nocapture; cargo test -p loongclaw gateway_openai_chat_completion_preserves_provider_rate_limit_status -- --nocapture; cargo test -p loongclaw-app provider:: -- --nocapture; cargo test -p loongclaw gateway_openai_chat_completion -- --nocapture; cargo test --workspace; cargo test --workspace --all-features Not-tested: loongclaw-dev wrapper-path QA rerun from a clean slot after these fixes
The governance workflow regenerates the tracked monthly architecture drift report from the merged tree. The compat parser and gateway updates changed those tracked metrics, so the checked-in report needed to be refreshed to match the new merged reality. Constraint: governance requires docs/releases/support/architecture-drift-2026-04.md to match a fresh generated report on the PR merge commit Rejected: Leave the stale report in place | keeps governance red even though the code is otherwise mergeable Confidence: high Scope-risk: narrow Directive: Whenever provider/chat/turn-coordinator size shifts on a release-tracked branch, refresh the monthly drift report before expecting governance to pass Tested: bash scripts/check_architecture_drift_freshness.sh docs/releases/support/architecture-drift-2026-04.md Not-tested: Full governance workflow rerun before push
gh-xj
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The provider cooldown path ignored shorter provider retry hints, and the gateway still lacked a complete OpenAI-compatible
/v1/chat/completions+/v1/modelssurface that inherited shared runtime semantics.Ignoring provider rate-limit hints causes unnecessary wait or premature retries, and a provider-only gateway compat path drifts from shared turn/runtime behavior, usage reporting, and streaming semantics expected by OpenAI-compatible clients.
Added provider rate-limit observation/parsing and threaded it through transport/failover/cooldown selection; made cooldown resolution honor provider hints when present; added the gateway OpenAI-compatible surface; routed accepted compat requests through the shared runtime path with usage propagation; disambiguated duplicate model ids; ensured streaming error termination with
[DONE]; tightened Feishu/WeCom streaming request assertions.Tool calling on the OpenAI-compatible gateway surface is still explicitly unsupported; channel entrypoints did not gain a new high-level fallback integration test for streaming-disabled transports.
Linked Issues
Change Type
Touched Areas
Risk Track
If Track B, fill these in:
This changes provider cooldown behavior, provider request parsing, shared turn/runtime wiring, gateway request validation, and streaming behavior.
Gateway compat rejects unsupported tool fields and non-
user-ending message sequences; duplicate model ids are surfaced asprofile_id:model; package-level tests cover provider, gateway, and channel paths.Revert commit
6b617e3f(and follow-up doc commit if needed) to restore the pre-change provider cooldown and gateway behavior.Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --lockedcargo test --workspace --all-features --lockedCommands and evidence:
User-visible / Operator-visible Changes
/v1/modelsand/v1/chat/completionson the gateway and get shared-runtime behavior, usage propagation, stable duplicate-model aliases, and terminated SSE streams.Failure Recovery
Revert the branch tip or disable use of the OpenAI-compatible gateway surface until the revert lands.
Unexpected 400s for malformed/non-
user-ending gateway chat payloads, incorrect model alias selection, missing usage in non-streaming compat responses, or channels no longer sending"stream": truein provider requests.Reviewer Focus
crates/app/src/provider/rate_limit.rsandcrates/app/src/provider/model_candidate_cooldown_runtime.rs.crates/daemon/src/gateway/openai_compat.rs,crates/app/src/agent_runtime.rs,crates/app/src/chat.rs, andcrates/app/src/conversation/turn_coordinator.rs.crates/app/src/channel/feishu/webhook.rs,crates/app/src/channel/feishu/websocket.rs, andcrates/app/src/channel/wecom.rs.