[PR #427] [MERGED] Keep custom OpenAI-compatible requests conservative #4615

Closed
opened 2026-10-22 04:09:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/427
Author: @TheLonelyDevil9
Created: 5/5/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @TheLonelyDevil9

Base: main ← Head: codex/fix-venice-glm-reasoning


📝 Commits (1)

  • e675d8f Keep custom OpenAI-compatible requests conservative

📊 Changes

5 files changed (+174 additions, -19 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/services/llm/provider-registry.ts (+17 -2)
📝 packages/server/src/services/llm/providers/local-sidecar.provider.ts (+1 -1)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+75 -12)
📝 packages/server/test/openai-provider-reasoning.test.ts (+80 -4)

📄 Description

Summary

  • Treat custom OpenAI-compatible connections as conservative generic endpoints instead of applying provider/model-name heuristics.
  • Keep OpenAI, OpenRouter, xAI, Cohere, and local-sidecar provider routes on their existing specialized request behavior.
  • Prevent custom endpoints like Venice from receiving provider-specific fields such as enable_thinking, reasoning_effort, max_completion_tokens, GPT-5 verbosity, OpenRouter routing metadata, or forced GPT-5.5 streaming just because a fetched model ID matches a known naming pattern.
  • Preserve the escape hatch: Custom Parameters still merge into the outgoing request body for users who need provider-specific fields.
  • Tighten native GLM endpoint detection to parse the hostname instead of matching path/query text.
  • Add regression coverage for Venice-shaped GLM IDs, native Z.AI provider routes, custom endpoint standard bodies, GPT-5.5 custom bodies, Custom Parameters, and adversarial host-like URL paths.
  • Note the broader fix in the changelog.

Context

A user reported that Venice.ai's OpenAI-compatible API accepts model fetching and connection tests, but test messages fail with Unrecognized key(s) in object: 'enable_thinking' when selecting zai-org-glm-5-1. The root issue is broader than GLM: generic custom OpenAI-compatible endpoints can be strict, so Marinara should not infer nonstandard provider fields from model names or endpoint-looking substrings unless the user selected a first-class provider route.

No linked issue exists yet. One should be opened before this PR is submitted, per CONTRIBUTING.md.

Validation

  • Manually verify a Venice.ai custom OpenAI-compatible connection using https://api.venice.ai/api/v1 and zai-org-glm-5-1 can send a test message.
  • Manually verify a native Z.AI/BigModel GLM provider route still receives enable_thinking when reasoning effort is configured.
  • Manually verify a custom endpoint can opt into provider-specific request fields through Custom Parameters when needed.
  • Manually verify a non-GLM custom OpenAI-compatible endpoint still sends normal test messages.

Automated checks run locally:

  • pnpm --filter @marinara-engine/server test -- openai-provider-reasoning.test.ts
  • pnpm --filter @marinara-engine/server lint
  • pnpm check

Note: local commands emitted the repo engine warning because this shell is on Node v22.22.0 while package.json wants Node >=24 <26.

Summary by CodeRabbit

  • Bug Fixes

    • Custom OpenAI-compatible endpoints no longer receive unintended provider-specific request fields.
    • GLM "enable_thinking" feature now properly scoped to native Z.AI/BigModel endpoints only.
  • Tests

    • Expanded test coverage for custom endpoint provider handling and endpoint-specific behaviors.

🔄 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/427 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 5/5/2026 **Status:** ✅ Merged **Merged:** 5/5/2026 **Merged by:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Base:** `main` ← **Head:** `codex/fix-venice-glm-reasoning` --- ### 📝 Commits (1) - [`e675d8f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e675d8faaa14a59ecdf168c873237471f6f5e68e) Keep custom OpenAI-compatible requests conservative ### 📊 Changes **5 files changed** (+174 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/services/llm/provider-registry.ts` (+17 -2) 📝 `packages/server/src/services/llm/providers/local-sidecar.provider.ts` (+1 -1) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+75 -12) 📝 `packages/server/test/openai-provider-reasoning.test.ts` (+80 -4) </details> ### 📄 Description ## Summary - Treat `custom` OpenAI-compatible connections as conservative generic endpoints instead of applying provider/model-name heuristics. - Keep OpenAI, OpenRouter, xAI, Cohere, and local-sidecar provider routes on their existing specialized request behavior. - Prevent custom endpoints like Venice from receiving provider-specific fields such as `enable_thinking`, `reasoning_effort`, `max_completion_tokens`, GPT-5 verbosity, OpenRouter routing metadata, or forced GPT-5.5 streaming just because a fetched model ID matches a known naming pattern. - Preserve the escape hatch: Custom Parameters still merge into the outgoing request body for users who need provider-specific fields. - Tighten native GLM endpoint detection to parse the hostname instead of matching path/query text. - Add regression coverage for Venice-shaped GLM IDs, native Z.AI provider routes, custom endpoint standard bodies, GPT-5.5 custom bodies, Custom Parameters, and adversarial host-like URL paths. - Note the broader fix in the changelog. ## Context A user reported that Venice.ai's OpenAI-compatible API accepts model fetching and connection tests, but test messages fail with `Unrecognized key(s) in object: 'enable_thinking'` when selecting `zai-org-glm-5-1`. The root issue is broader than GLM: generic custom OpenAI-compatible endpoints can be strict, so Marinara should not infer nonstandard provider fields from model names or endpoint-looking substrings unless the user selected a first-class provider route. No linked issue exists yet. One should be opened before this PR is submitted, per CONTRIBUTING.md. ## Validation - [ ] Manually verify a Venice.ai custom OpenAI-compatible connection using `https://api.venice.ai/api/v1` and `zai-org-glm-5-1` can send a test message. - [ ] Manually verify a native Z.AI/BigModel GLM provider route still receives `enable_thinking` when reasoning effort is configured. - [ ] Manually verify a custom endpoint can opt into provider-specific request fields through Custom Parameters when needed. - [ ] Manually verify a non-GLM custom OpenAI-compatible endpoint still sends normal test messages. Automated checks run locally: - `pnpm --filter @marinara-engine/server test -- openai-provider-reasoning.test.ts` - `pnpm --filter @marinara-engine/server lint` - `pnpm check` Note: local commands emitted the repo engine warning because this shell is on Node v22.22.0 while package.json wants Node >=24 <26. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Custom OpenAI-compatible endpoints no longer receive unintended provider-specific request fields. * GLM "enable_thinking" feature now properly scoped to native Z.AI/BigModel endpoints only. * **Tests** * Expanded test coverage for custom endpoint provider handling and endpoint-specific behaviors. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:11 +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#4615
No description provided.