mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8276] [MERGED] fix(llm): send a prompt cache key on OpenAI and ChatGPT requests #8260
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#8260
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/8276
Author: @kolacheee
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @kolacheee
Base:
staging← Head:claude/project-thread-r412n9📝 Commits (10+)
6e67660Eval-only GM tail layouts and a harness to compare thema69a88dSend a prompt cache key on OpenAI and ChatGPT requests2bfcba8Log the Responses request body in Debug mode3cb6d90Eval: find where consecutive request bodies stop sharing a prefix516e5baEval: strip logger colour codes before reading request bodiesac03fb6Revert "Eval: strip logger colour codes before reading request bodies"ad8db36Revert "Eval: find where consecutive request bodies stop sharing a prefix"45bc3b1Revert "Eval-only GM tail layouts and a harness to compare them"c95910eMerge remote-tracking branch 'origin/staging' into claude/project-thread-r412n9bd45af3Say the logged Responses body is the one built, before any retry📊 Changes
2 files changed (+146 additions, -13 deletions)
View changed files
📝
packages/server/src/services/llm/providers/openai.provider.ts(+76 -13)➕
scripts/regressions/openai-prompt-cache-key.regression.ts(+70 -0)📄 Description
Linked issue
Closes #8275
Why this change
prompt_cache_keyto the machine that already holds its prefix. Marinara never sent one, so the turns of a chat landed on different machines. On the ChatGPT (Codex) route, Game Master turns with a byte-identical ~7k-token prefix reported 0 cached tokens.What changed
prompt_cache_key, on chat completions and the Responses API alike. The key ismarinara-plus 32 hex characters of a hash of the chat id, so the chat id itself never leaves the server. A request outside any chat gets no key.openaiprovider when it points athttps://api.openai.com. A custom or compatible endpoint may refuse a field it doesn't know, so it never receives one.[debug/openai] raw usage). It also logs the Responses request body as built ([debug/openai] responses request body), so a cache miss can be traced to the first byte where two requests differ.Validation
tsc --noEmitpasses, and Prettier is clean on the changed filesopenai-prompt-cache-key: one chat keeps one key, another chat gets another key, no chat means no key, the raw chat id never appears in the key, and compatible endpoints never get itCONTRIBUTING.mdManual verification notes
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)The branch history includes an eval prototype that is reverted inside this PR, so the net diff is only the two files above. A squash merge keeps
staginghistory clean.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.