[PR #6367] [MERGED] fix: respect connection output limits in AI translation #7151

Closed
opened 2026-10-23 04:17:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6367
Author: @SpicyMarinara
Created: 9/19/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/translation-output-limit


📝 Commits (2)

  • 655db6a chore: start translation token limit fix for #6366
  • 604a23f fix: use connection output budget for AI translations (#6366)

📊 Changes

3 files changed (+44 additions, -1 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/server/src/routes/translate.routes.ts (+8 -1)
📝 scripts/regressions/connection-test-parameters.regression.ts (+35 -0)

📄 Description

Linked issue

Closes #6366.

Why this change

An AI translation made through a connection configured for 8,192 output tokens still sent max_tokens: 4096, which could truncate long translations. The translation route omitted the budget and fell through to the provider default.

What changed

Reuse the existing stored-parameter helpers: translation requests use the connection's enabled Max Tokens value, or its output-token override when no value is configured, then the existing 4,096 fallback. Provider caps still apply, and disabling Max Tokens omits that parameter. Translation keeps its dedicated temperature of 0.3. This is nine lines in the existing route plus regression coverage and a changelog entry.

Validation

  • pnpm check passes locally
  • Container built and ran without issue
  • Manually verify a long translation against the reported KoboldCpp setup at 8,192 and 4,096 output tokens
  • Read and followed CONTRIBUTING.md

Observed automated evidence:

  • The HTTP regression failed before the fix: an 8,192-token connection sent 4,096. After the fix, all eight translation cases and the existing connection-test cases pass.
  • Cases cover 8,192/4,096/1,024 caps, the unset fallback, explicit connection defaults, a default above the cap, and disabled Max Tokens. Assertions inspect the request received by a real local HTTP server through the registered translation route and file-backed connection storage.
  • pnpm check passes, including localization, formatting, type checks, lint, and production builds. One existing GameNarration hook warning remains; no new warnings were introduced.
  • The production Docker image builds and runs. Calls through its actual connection and translation APIs send 8,192, 4,096, 2,048, and omitted token limits as configured.
  • Local CodeRabbit review completed with zero findings across all three changed files.

The physical KoboldCpp installation and real-model translation quality were not tested locally. No UI or user-guide changes are needed.

Summary by CodeRabbit

  • Bug Fixes
    • AI translations now honor the selected connection’s configured maximum token budget.
    • Translation fallback behavior now uses the existing Max Tokens setting instead of always applying a fixed limit.
    • Translation requests correctly apply connection-specific settings, provider defaults, and explicit overrides when determining the token budget.

🔄 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/6367 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/19/2026 **Status:** ✅ Merged **Merged:** 9/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/translation-output-limit` --- ### 📝 Commits (2) - [`655db6a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/655db6a6f17c4fd51e7356eb197fb36cf8657ec4) chore: start translation token limit fix for #6366 - [`604a23f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/604a23fe2c0e144682390c45223551a8f3875670) fix: use connection output budget for AI translations (#6366) ### 📊 Changes **3 files changed** (+44 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/server/src/routes/translate.routes.ts` (+8 -1) 📝 `scripts/regressions/connection-test-parameters.regression.ts` (+35 -0) </details> ### 📄 Description ## Linked issue Closes #6366. ## Why this change An AI translation made through a connection configured for 8,192 output tokens still sent `max_tokens: 4096`, which could truncate long translations. The translation route omitted the budget and fell through to the provider default. ## What changed Reuse the existing stored-parameter helpers: translation requests use the connection's enabled Max Tokens value, or its output-token override when no value is configured, then the existing 4,096 fallback. Provider caps still apply, and disabling Max Tokens omits that parameter. Translation keeps its dedicated temperature of 0.3. This is nine lines in the existing route plus regression coverage and a changelog entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container built and ran without issue - [ ] Manually verify a long translation against the reported KoboldCpp setup at 8,192 and 4,096 output tokens - [ ] Read and followed `CONTRIBUTING.md` Observed automated evidence: - The HTTP regression failed before the fix: an 8,192-token connection sent 4,096. After the fix, all eight translation cases and the existing connection-test cases pass. - Cases cover 8,192/4,096/1,024 caps, the unset fallback, explicit connection defaults, a default above the cap, and disabled Max Tokens. Assertions inspect the request received by a real local HTTP server through the registered translation route and file-backed connection storage. - `pnpm check` passes, including localization, formatting, type checks, lint, and production builds. One existing GameNarration hook warning remains; no new warnings were introduced. - The production Docker image builds and runs. Calls through its actual connection and translation APIs send 8,192, 4,096, 2,048, and omitted token limits as configured. - Local CodeRabbit review completed with zero findings across all three changed files. The physical KoboldCpp installation and real-model translation quality were not tested locally. No UI or user-guide changes are needed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * AI translations now honor the selected connection’s configured maximum token budget. * Translation fallback behavior now uses the existing Max Tokens setting instead of always applying a fixed limit. * Translation requests correctly apply connection-specific settings, provider defaults, and explicit overrides when determining the token budget. <!-- 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-23 04:17:00 +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#7151
No description provided.