Skip to content

feat: complete OpenAI-compatible web-provider contracts - #14103

Merged
diegosouzapw merged 7 commits into
diegosouzapw:release/v3.8.52from
arashashrafii:fix/openai-compatible-web-provider-contract
Oct 8, 2026
Merged

diegosouzapw merged 7 commits into
diegosouzapw:release/v3.8.52from
arashashrafii:fix/openai-compatible-web-provider-contract

Conversation

@arashashrafii

Copy link
Copy Markdown
Contributor

Summary

This PR completes the OpenAI-compatible contract layer with a focused implementation for web-cookie provider tool calling and parallel tool calls.

Included

  • Canonical OpenAI request/response/stream/error/model-list contracts and validation.
  • Provider-neutral web tool-call normalization with provider-specific DeepSeek DSML handling.
  • Stable call IDs and ordering, parallel calls, JSON-string arguments, streaming/non-streaming serialization, and tool-result replay.
  • Fail-closed handling for unknown tools, malformed invocations, ordinary JSON, prose, and unsupported capabilities.
  • Sanitized batch creation errors and explicit documentation that /v1/realtime is unsupported.
  • Documentation and changelog updates describing existing auxiliary endpoints without claiming they were newly implemented.

Issue scope

Validation

  • Focused contract/web-provider/batch tests: 105 passed.
  • Protocol client E2E: 2 passed.
  • Contributor build: passed.
  • Full integration suite: one unrelated batch E2E timeout remains in tests/integration/batch-e2e-rate-limit.test.ts; the same test independently reproduced a pending promise/timeout and is not related to web-provider parsing.
  • Full markdown lint remains blocked by pre-existing repository-wide documentation violations; changed documentation was checked separately.

Architecture note

The architecture and implementation direction were informed by my prior independent WM Adapter project, especially its provider-neutral normalization boundary, strict provider-specific adapters, fail-closed parsing, and preservation of streaming tool-call state. WM Adapter is referenced as prior architectural inspiration only; this PR implements the behavior within OmniRoute’s existing contracts and abstractions.

Closes #14033
Closes #14034
Closes #14035
Closes #14036
Closes #14037

@diegosouzapw diegosouzapw added the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Sep 25, 2026
@diegosouzapw diegosouzapw changed the title feat: complete OpenAI-compatible web-provider contracts [defer] feat: complete OpenAI-compatible web-provider contracts Sep 25, 2026
@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.51 to release/v3.8.52 September 29, 2026 11:24
@diegosouzapw

Copy link
Copy Markdown
Owner

Re-homed to release/v3.8.52: v3.8.51 entered its release freeze, so the branch now belongs to the release captain and development continues on the next cycle. Nothing is wrong with this PR — it just needed a live base. No action needed from you; CI will re-run against the new base.

@diegosouzapw diegosouzapw changed the title [defer] feat: complete OpenAI-compatible web-provider contracts feat: complete OpenAI-compatible web-provider contracts Oct 1, 2026
@diegosouzapw diegosouzapw removed the deferred-v3.8.52 Grande demais / suspeito para o lote atual; precisa de sessão dedicada no ciclo v3.8.52 label Oct 1, 2026
arashashrafii and others added 7 commits October 3, 2026 12:00
Removes src/shared/contracts/openai.ts and its test — the module was
never imported by any route/handler (verified via grep across
open-sse/, src/, tests/), so it added maintenance surface with zero
runtime effect. Fixes the two OPENAI_COMPATIBILITY.md doc-links that
pointed at the removed test file to point at existing coverage
instead (chat-completions-route-shape-gate.test.ts,
audio-transcription-handler.test.ts, audio-speech-handler.test.ts).

Also drops the src/app/api/v1/batches/route.ts sanitizeErrorMessage()
hunk from this PR: it duplicates the same Hard Rule diegosouzapw#12 fix already
proposed standalone in diegosouzapw#14115 and diegosouzapw#14145, so it is left for whichever
of those lands first rather than triple-implemented here.

The real fix in this PR — DSML tool-call normalization for
DeepSeek-shaped web providers in webTools.ts/deepseekWebTools.ts —
is unaffected and remains the mergeable core.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
…ratchet

Fixes a real regression this PR's own DSML changes introduced against the
pre-existing tests/unit/deepseek-web-tools-salvage-leading-json.test.ts
suite: parseFullWidthDsmlCalls() treated the mere presence of a stray/
corrupted "||DSML||" delimiter fragment (e.g. trailing garbage after an
otherwise well-formed <tool>{json} block with no actual <invoke name="...">
tag) as "recognized", short-circuiting parseDeepSeekToolCalls() before the
canonical tag parser's JSON-salvage fallback ever ran. It now only reports
recognized:true when a structurally well-formed invoke tag was found
(matching the "malformed or unknown native markers remain content"
contract for genuinely well-formed-but-unresolvable invokes).

Also splits the new parseNativeDeepSeekCalls/parseFullWidthDsmlCalls
functions (deepseekWebTools.ts) and resolveImageBaseUrl (imageGeneration.ts)
into smaller helpers to clear the complexity/cognitive-complexity ratchet
this PR's diff newly crossed (verified via
scripts/check/check-complexity-ratchets.mjs --base-ref
origin/release/v3.8.51, now 0/0 new violations) — no behavior change beyond
the recognized-flag fix above.

Corrects the changelog fragment: it used the wrong format for
check:changelog-integrity (prose + "Closes #N" lines instead of a "- "
bullet) and, per review, overclaimed a "canonical contract" this PR does
not ship — rewritten to describe only what is actually wired.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@arashashrafii
arashashrafii force-pushed the fix/openai-compatible-web-provider-contract branch from d7e43f7 to 61e871a Compare October 3, 2026 12:07
@diegosouzapw
diegosouzapw merged commit 64b2b94 into diegosouzapw:release/v3.8.52 Oct 8, 2026
3 checks passed
diegosouzapw added a commit to arashashrafii/OmniRoute that referenced this pull request Oct 8, 2026
diegosouzapw#14103 landed on the base as a squash; the 7 inherited commits now merge
to the base content, leaving only this PR's own commit as the delta.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants