[PR #8576] [MERGED] fix(llm): preserve requested tools for uncatalogued models #8684

Closed
opened 2026-11-07 17:38:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8576
Author: @ylli-selmani
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ylli-selmani

Base: staging ← Head: fix/mari-provider-tools


📝 Commits (2)

  • 011580c fix(llm): preserve requested tools for uncatalogued models
  • 7924a53 fix(llm): retain textual tool mode for Google completions

📊 Changes

4 files changed (+164 additions, -38 deletions)

View changed files

📝 packages/server/src/services/llm/provider-registry.ts (+2 -9)
📝 packages/server/src/services/llm/providers/google.provider.ts (+25 -17)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+7 -12)
➕ scripts/regressions/provider-unknown-model-tools.regression.ts (+130 -0)

📄 Description

Linked issue

Part of #8564. The reporter's exact provider/model combination and the cause of every reported refusal remain unconfirmed.

Why this change

Professor Mari and other tool callers can request tools but receive an ordinary text answer because an uncatalogued model silently loses its tool definitions. The model catalog's compatibility guard should suppress optional sampling parameters without removing the requested tool protocol.

What changed

  • Preserve native tools and tool choice for uncatalogued models through OpenAI Chat Completions and Responses, retaining textual-tool and provider-specific exclusions.
  • Keep Google tool completions on the tool-aware path while retaining unknown-model sampling suppression.
  • Remove the obsolete custom-provider tool bypass and preserve the factory's positional argument compatibility.
  • Add an HTTP regression for tool delivery and returned calls, buffered/streaming completion calls, OpenAI chat(), no-tool requests, textual mode, and explicit endpoint rejection. Endpoints that reject tools now report their error instead of silently receiving a tool-less request.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Evidence: pnpm check passed (exit 0; existing client hook/build warnings). The new regression failed before the fix on the missing OpenAI tools payload and passed afterward. Selected provider regressions: six passed on the first run; provider-compat caught changed Google JSON key order, which was restored and then passed on rerun.

Final verification: node scripts/run-regressions.mjs --filter provider- --concurrency 2 passed 7/7 after the review fix (exit 0).

Local CodeRabbit ran on the whole change and again on the substantive review fix. One finding fixed: Google must honor explicit textual-tool mode. Three findings declined after tracing code: chat() has a text/usage contract (tool callers use the tested chatComplete()); Google base text-path debug logging was already absent; and no production caller requests Google textual parsing (the flag is set only by the OpenAI sidecar, while Mari parses textual replies upstream). No claim of zero findings.

Manual verification notes

  • Manually verify Mari can read a lorebook with the reporter's LinkAPI connection using its exact provider type and model ID, then verify a fresh NanoGPT chat separately.
  • Manually verify an endpoint without native tool support shows its provider error; use an explicitly supported textual-tool connection where needed.
  • Live LinkAPI/reporter testing and container/browser testing have not been performed. No client UI changes.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened
  • Version/release files updated (only if this PR includes a version bump)

No release metadata or user-facing documentation changes.

UI evidence (if applicable)

Not applicable; provider request shaping only.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8576 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `fix/mari-provider-tools` --- ### 📝 Commits (2) - [`011580c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/011580c8748223386ea2d9bd6fa98e4dd38e55c0) fix(llm): preserve requested tools for uncatalogued models - [`7924a53`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7924a5318eff07bffd4b27eaf90a918b77068546) fix(llm): retain textual tool mode for Google completions ### 📊 Changes **4 files changed** (+164 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/llm/provider-registry.ts` (+2 -9) 📝 `packages/server/src/services/llm/providers/google.provider.ts` (+25 -17) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+7 -12) ➕ `scripts/regressions/provider-unknown-model-tools.regression.ts` (+130 -0) </details> ### 📄 Description ## Linked issue Part of #8564. The reporter's exact provider/model combination and the cause of every reported refusal remain unconfirmed. ## Why this change Professor Mari and other tool callers can request tools but receive an ordinary text answer because an uncatalogued model silently loses its tool definitions. The model catalog's compatibility guard should suppress optional sampling parameters without removing the requested tool protocol. ## What changed - Preserve native tools and tool choice for uncatalogued models through OpenAI Chat Completions and Responses, retaining textual-tool and provider-specific exclusions. - Keep Google tool completions on the tool-aware path while retaining unknown-model sampling suppression. - Remove the obsolete custom-provider tool bypass and preserve the factory's positional argument compatibility. - Add an HTTP regression for tool delivery and returned calls, buffered/streaming completion calls, OpenAI chat(), no-tool requests, textual mode, and explicit endpoint rejection. Endpoints that reject tools now report their error instead of silently receiving a tool-less request. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Evidence: `pnpm check` passed (exit 0; existing client hook/build warnings). The new regression failed before the fix on the missing OpenAI tools payload and passed afterward. Selected provider regressions: six passed on the first run; provider-compat caught changed Google JSON key order, which was restored and then passed on rerun. Final verification: `node scripts/run-regressions.mjs --filter provider- --concurrency 2` passed 7/7 after the review fix (exit 0). Local CodeRabbit ran on the whole change and again on the substantive review fix. One finding fixed: Google must honor explicit textual-tool mode. Three findings declined after tracing code: `chat()` has a text/usage contract (tool callers use the tested `chatComplete()`); Google base text-path debug logging was already absent; and no production caller requests Google textual parsing (the flag is set only by the OpenAI sidecar, while Mari parses textual replies upstream). No claim of zero findings. ### Manual verification notes - Manually verify Mari can read a lorebook with the reporter's LinkAPI connection using its exact provider type and model ID, then verify a fresh NanoGPT chat separately. - Manually verify an endpoint without native tool support shows its provider error; use an explicitly supported textual-tool connection where needed. - Live LinkAPI/reporter testing and container/browser testing have not been performed. No client UI changes. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) No release metadata or user-facing documentation changes. ## UI evidence (if applicable) Not applicable; provider request shaping only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:38:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8684
No description provided.