mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6326] [MERGED] fix: send per-chat session headers to OpenCode endpoints #7136
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7136
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6326
Author: @SpicyMarinara
Created: 9/18/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @SpicyMarinara
Base:
staging← Head:codex/opencode-session📝 Commits (5)
b60f746chore: start OpenCode session header support55600c8fix: send chat-scoped sessions to OpenCode API endpoints5273bd4Merge staging before final OpenCode session validation493477afix: drop OpenCode session headers when redirects leave the API85207efMerge branch 'staging' into codex/opencode-session📊 Changes
9 files changed (+224 additions, -1 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
e2e/chat-sweep.e2e.ts(+2 -0)📝
packages/client/src/hooks/use-translate.ts(+1 -0)📝
packages/client/src/lib/translate-text.ts(+1 -0)📝
packages/server/src/app.ts(+4 -0)📝
packages/server/src/routes/translate.routes.ts(+1 -0)➕
packages/server/src/utils/opencode-session.ts(+50 -0)📝
packages/server/src/utils/security.ts(+11 -1)➕
scripts/regressions/opencode-session.regression.ts(+152 -0)📄 Description
Linked issue
Closes #6325.
Why this change
OpenCode Go requires a stable session header for each conversation. A fixed Custom Request Headers value sends every chat through the same session; without it, requests can be rejected. Existing OpenAI-compatible connections now derive the session from the originating chat and identify the client as Marinara Engine. No new provider option or connection setting is added.
What changed
x-opencode-sessionandUser-Agent: Marinara-Engine/<version>only to HTTPS OpenCode Go/Zen API destinations. Re-evaluate the destination on every redirect and strip configured session headers when leaving the API, including same-origin redirects to non-API paths.The upstream contract is documented in OpenCode Go: Where can I use it?.
Validation performed
pnpm checkpasses, including localization, formatting, lint/types and production builds.pnpm checkand the focused provider/session regressions also pass on the combined code.createRequirepattern to resolve Fastify from its owning server package. The final initial review covered all nine files and returned zero findings. GitHub review found a same-origin API-to-docs redirect edge case; its new regression fails before the fix and passes after it, and local review of the three changed files returned zero findings.Before/after logs and validation
Claim boundaries and manual verification
The regression exercises the real OpenAI-compatible provider and safe-fetch code with synthetic DNS/fetch responses. It makes no paid API calls. This verifies header transport, not live account access or upstream client approval; requests identify Marinara honestly.
Docs and release impact
Added an Unreleased entry. Existing OpenAI-compatible connection setup is unchanged, so no user-facing documentation or localization keys changed. No version bump.
Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.