Skip to content

fix(chatgpt-web): wire tool/function calling via shared webTools shim (#5240) - #5349

Merged
diegosouzapw merged 2 commits into
release/v3.8.41from
fix/5240-chatgpt-web-tools
Jun 29, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.41from
fix/5240-chatgpt-web-tools

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #5240.

Problem

The chatgpt-web provider silently drops tool/function calls — it answers in prose even when the request carries tools.

Root cause

chatgpt-web was the only web-session executor that never wired the shared prompt-emulation tool layer (open-sse/translator/webTools.ts). It never read body.tools; both response builders hardcoded finish_reason:"stop" and emitted only content. The shim is shipped and used by 9 sibling executors (qwen-web, perplexity-web, deepseek-web, …) — chatgpt-web was just omitted from the #3259 rollout.

Fix

Wire it exactly like the siblings: prepareToolMessages prepends a <tool>-contract system message; on the response side buildToolAwareResult parses <tool>{…}</tool> back into OpenAI tool_calls. Tool mode buffers the full answer and emits tool_calls + finish_reason:"tool_calls" (a single terminal chunk when streaming), gated off the image-gen path. Plain chat (no tools) is unchanged. Orchestration lives in a new chatgptWebTools.ts so the frozen executor stays within its size cap.

Validation (Hard Rule #18)

  • TDD — tests/unit/chatgpt-web-tools-5240.test.ts (4): request-side <tool> contract; non-stream tool_calls; stream terminal delta.tool_calls; no-tools regression → plain content + stop. Red→green. The frozen chatgpt-web.test.ts (80 tests) is byte-identical/untouched. typecheck + eslint clean; chatgpt-web.ts kept ≤ its frozen size cap.

Contradicts the earlier by-design triage: the shim isn't new — it's shipped and used by 9 providers.

…#5240)

chatgpt-web was the only web-session executor that never read body.tools —
both response builders hardcoded finish_reason:stop and emitted only content,
so tool calls were silently dropped. Now uses the shared webTools prompt-emulation
shim (<tool> contract + response parsing) like its 9 sibling executors; it was
omitted from the #3259 rollout. Tool mode buffers + emits tool_calls (gated off
image-gen); plain chat unchanged. Orchestration extracted to chatgptWebTools.ts
to keep the frozen executor within its size cap.

Regression guard: tests/unit/chatgpt-web-tools-5240.test.ts.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 98c9f5b into release/v3.8.41 Jun 29, 2026
diegosouzapw added a commit that referenced this pull request Jun 29, 2026
…rges

The sequential squash-merges of #5351/#5349/#5347 onto release/v3.8.41
auto-resolved the CHANGELOG and progressively ate sibling bullets — the
section was left with only the oauth (#5326) bullet + a duplicate
'### Bug Fixes' header, dropping routing/cli/dashboard/rerank (batch 3) and
opencode (#5217) / chatgpt-web (#5240). All code landed correctly; this
restores every bullet verbatim under a single header. Additive restore.
@diegosouzapw
diegosouzapw deleted the fix/5240-chatgpt-web-tools branch June 29, 2026 18:44
bxsang added a commit to bxsang/OmniRoute that referenced this pull request Jul 29, 2026
The per-model registry toolCalling:false stays (it honestly means no
NATIVE tool calling, matching chatgpt-web after diegosouzapw#5349). Combo/auto tools
filters key off the provider-level toolCalling:"emulated" marker via
providerSupportsEmulatedToolCalling() (diegosouzapw#8488/diegosouzapw#5240) — without it a combo
carrying tools would filter out every copilot-m365 target even though
the prompt-emulation shim now handles them.
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…diegosouzapw#5240) (diegosouzapw#5349)

Integrated into release/v3.8.41 — wire tool/function calling into chatgpt-web via shared webTools shim (diegosouzapw#5240). Test: chatgpt-web-tools-5240 green (4/4).
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…rges

The sequential squash-merges of diegosouzapw#5351/diegosouzapw#5349/diegosouzapw#5347 onto release/v3.8.41
auto-resolved the CHANGELOG and progressively ate sibling bullets — the
section was left with only the oauth (diegosouzapw#5326) bullet + a duplicate
'### Bug Fixes' header, dropping routing/cli/dashboard/rerank (batch 3) and
opencode (diegosouzapw#5217) / chatgpt-web (diegosouzapw#5240). All code landed correctly; this
restores every bullet verbatim under a single header. Additive restore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant