[PR #1049] [MERGED] Fix OpenRouter remote model metadata #4899

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

📋 Pull Request Information

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

Base: staging ← Head: fix/issue-1031-openrouter-model-metadata-d


📝 Commits (1)

  • 5b0a802 Fix OpenRouter remote model metadata

📊 Changes

3 files changed (+51 additions, -17 deletions)

View changed files

📝 packages/client/src/components/connections/ConnectionEditor.tsx (+18 -12)
📝 packages/client/src/hooks/use-connections.ts (+8 -1)
📝 packages/server/src/routes/connections.routes.ts (+25 -4)

📄 Description

Linked issue

Closes #1031

Why this change

  • OpenRouter model fetches were discarding context_length and top_provider.max_completion_tokens, so API-fetched models could appear as unknown-capability models and save with the default 128k context instead of the provider-reported limit.

What changed

  • Preserved optional context and maxOutput values when normalizing OpenAI-compatible remote model payloads.
  • Updated the connection model fetch hook and editor state to carry fetched model metadata through the client.
  • Let API-fetched model selections update the connection context window and the existing max output override when provider metadata supplies those limits.

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

Manual verification notes

  • Codex reproduced the original metadata drop with packages/server/node_modules/.bin/tsx.cmd scratch/issue-1031-repro.ts --expect-broken before the fix.
  • Codex verified the fix with packages/server/node_modules/.bin/tsx.cmd scratch/issue-1031-repro.ts --expect-fixed; the script confirmed the reported OpenRouter payload preserves context: 1048576 and maxOutput: 65536.
  • Codex edge cases covered nested top_provider.context_length / string numeric limits and plain OpenAI-compatible models with no metadata.
  • Codex ran pnpm check successfully in the issue worktree.
  • Bunny pre-PR review passed for the current diff.
  • No true human-only verification blockers for the core claim.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs or release metadata changes were needed.

UI evidence (if applicable)

N/A. This is a metadata normalization/data-flow fix, not a visual UI change.


🔄 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/1049 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/20/2026 **Status:** ✅ Merged **Merged:** 5/20/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-1031-openrouter-model-metadata-d` --- ### 📝 Commits (1) - [`5b0a802`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b0a802dd31a29117ac8ccbdef52b629a417ecc3) Fix OpenRouter remote model metadata ### 📊 Changes **3 files changed** (+51 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/connections/ConnectionEditor.tsx` (+18 -12) 📝 `packages/client/src/hooks/use-connections.ts` (+8 -1) 📝 `packages/server/src/routes/connections.routes.ts` (+25 -4) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #1031 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - OpenRouter model fetches were discarding `context_length` and `top_provider.max_completion_tokens`, so API-fetched models could appear as unknown-capability models and save with the default 128k context instead of the provider-reported limit. ## What changed <!-- List the key changes in this PR --> - Preserved optional `context` and `maxOutput` values when normalizing OpenAI-compatible remote model payloads. - Updated the connection model fetch hook and editor state to carry fetched model metadata through the client. - Let API-fetched model selections update the connection context window and the existing max output override when provider metadata supplies those limits. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex reproduced the original metadata drop with `packages/server/node_modules/.bin/tsx.cmd scratch/issue-1031-repro.ts --expect-broken` before the fix. - Codex verified the fix with `packages/server/node_modules/.bin/tsx.cmd scratch/issue-1031-repro.ts --expect-fixed`; the script confirmed the reported OpenRouter payload preserves `context: 1048576` and `maxOutput: 65536`. - Codex edge cases covered nested `top_provider.context_length` / string numeric limits and plain OpenAI-compatible models with no metadata. - Codex ran `pnpm check` successfully in the issue worktree. - Bunny pre-PR review passed for the current diff. - No true human-only verification blockers for the core claim. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs or release metadata changes were needed. ## UI evidence (if applicable) N/A. This is a metadata normalization/data-flow fix, not a visual UI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:34 +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#4899
No description provided.