[PR #7448] [MERGED] fix(claude-subscription): stop the hidden title request and the extra coding-agent context #7739

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7448
Author: @JurijPietrowicz
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/claude-subscription-title-and-context


📝 Commits (10+)

  • eed5fee fix(claude-subscription): skip the CLI's hidden session-title request
  • 822c5e4 fix(claude-subscription): drop the coding-agent context Claude Code adds
  • 345e0e2 Merge branch 'staging' into fix/claude-subscription-title-and-context
  • 6353e03 fix(claude-subscription): refuse to chat without the chat-context mod
  • bbda913 docs(changelog): say when the Claude chat-context plugin can't help
  • 0795e48 docs(changelog): say the Claude fix doesn't reach agent packages yet
  • 45058e5 docs(changelog): shorten the Claude (Subscription) entry
  • 83da78a Merge branch 'staging' into fix/claude-subscription-title-and-context
  • 148f278 Merge branch 'staging' into fix/claude-subscription-title-and-context
  • 9eb647f fix(claude-subscription): keep Claude Code's generated mod types out of format:check

📊 Changes

8 files changed (+167 additions, -4 deletions)

View changed files

📝 .prettierignore (+2 -0)
➕ packages/server/src/assets/claude-code-plugin/.claude-plugin/plugin.json (+6 -0)
➕ packages/server/src/assets/claude-code-plugin/.gitignore (+3 -0)
➕ packages/server/src/assets/claude-code-plugin/hooks/hooks.json (+4 -0)
➕ packages/server/src/assets/claude-code-plugin/hooks/register.mjs (+9 -0)
📝 packages/server/src/routes/connections.routes.ts (+2 -0)
📝 packages/server/src/services/llm/providers/claude-subscription.provider.ts (+57 -4)
➕ scripts/regressions/claude-subscription-chat-context.regression.ts (+84 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7447

Why this change

Claude (Subscription) chats run on Claude Code, which adds work meant for a coding agent:

  • A hidden title request. Claude Code makes a second request to name every new session. Marinara hit it on the first message of each chat, on every one-off request (summaries, agents, scene analysis, connection tests) and on every message in fold mode. That spends the user's subscription limits for nothing.
  • Extra context. Claude Code puts messages of its own between Marinara's system prompt and the chat: the account email, an empty CLAUDE.md section, the server's environment (working directory, OS, shell), the model name, a token budget and the date. A roleplay needs none of it, it can change how the model plays the character, and the email shouldn't go out with every chat.

What changed

  • Title: the provider passes the SDK's title option ("Title"), so Claude Code skips the naming request. The connection test in connections.routes.ts passes it too.
  • Context: a one-hook Claude Code mod, packages/server/src/assets/claude-code-plugin/, drops every prompt.attachment. The provider loads it with the SDK's plugins option.
    • Dropping every attachment, rather than a list of names, also covers new kinds a future Claude Code adds.
    • The hooks module is plain .mjs, so tsc leaves it alone. The existing copyRuntimeAssets() step copies src/assets into dist/assets, so it ships in source, Docker and Android (esbuild) builds with no build changes.
    • Claude Code writes type files and a tsconfig.json beside a mod each time it loads it. The types folder ignores itself, and a .gitignore in the plugin folder covers tsconfig.json, so source installs don't get untracked files.
  • Missing plugin: chat() checks the plugin's files before the SDK starts and stops with an error when any is missing, so nothing is sent. This is the check CodeRabbit asked for, moved earlier: throwing when init reports a load error doesn't stop the request, because the CLI sends it without waiting. In a live probe, 2 of 3 runs still sent and answered the chat.
  • Init guard: the provider's init debug log lists loaded plugins. It warns when Claude Code reports a load error for this plugin only; a built-in plugin's error doesn't bring the context back.
  • Regression: claude-subscription-chat-context.regression.ts checks that the provider sends title and plugins, that the plugin files exist where the provider points, and that the hook drops attachments without handing them on. The title check moved there from the cache regression.
  • Format check (maintainer review fix): .prettierignore skips packages/server/src/assets/claude-code-plugin/.claude-plugin/types/. Claude Code writes about 790 KB of mod API declarations there each time a source checkout loads the plugin. Prettier doesn't read that folder's own .gitignore, so pnpm check failed after one dev-mode chat.

Not changed: the billing header and the line You are a Claude agent, built on Anthropic's Claude Agent SDK. sit before Marinara's system prompt, and no SDK option or mod event controls them. The CLI also leaves an empty system message where the environment block was. It has no content.

Follow-up: the downloadable Noodle, Slurp2 and Conversation Calls packages bundle their own copy of the provider, so they need a separate Marinara-Agents update to get this fix.

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

Done by the agent:

  • Maintainer-side review: Claude Code 2.1.293 pointed at a local capture server, with a throwaway account email. With staging's options, the request carried the email, # Environment, model note, date and token budget. With this branch's provider, it carried only the system prompt and the message, and the reply came back normally.
  • pnpm check passed (the one client lint warning was already on staging). pnpm --filter ./packages/server build copies the plugin to dist/assets/claude-code-plugin/. The claude-subscription-* regressions pass. claude plugin validate passes on the plugin.
  • Live probe of the real provider on Claude Haiku 5.5 with OTEL_LOG_RAW_API_BODIES, on both the installed Claude Code 2.1.296 and the bundled 2.1.293. Cases: new chat, resume path with history, fold path, and a message with an image. Every case sent one sdk request and no generate_session_title. The request body had no email, # Environment, model note, token budget or date, and the reply was normal. The image still reached the model (it named the colour).
  • The plugin loads (marinara-chat-context in the init plugins list, no plugin_errors), including from a read-only folder, as in Docker where the app user can't write to /app/packages.
  • With hooks/register.mjs removed, a chat stops with the new error and no request is captured.

Done by the human:

  • Manually verified in the app: with OTEL_LOG_RAW_API_BODIES=file:<folder> in .env, starting a new chat and sending a full sentence. <folder>/index.jsonl has one sdk request and no generate_session_title, and the request file has no email, # Environment, model or date lines.
  • Manually verified the connection test still reports the right model family.

Still to verify by hand:

  • Manually verify a Docker build: the server log at LOG_LEVEL=debug lists marinara-chat-context under plugins in SDK init surface.
  • Manually verify on Windows that the plugin loads (path with backslashes and possibly spaces).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs/ page describes what Claude Code adds to requests, so there's nothing to translate. The CHANGELOG.md entry was dropped: pull requests no longer add changelog entries.

UI evidence (if applicable)

Not applicable (server-side only).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Claude subscription chats now load a local chat-context plugin to manage prompt attachments.
  • Bug Fixes
    • Chat requests use a consistent session title.
    • Plugin-loading issues are reported without interrupting requests when possible.

🔄 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/7448 **Author:** [@JurijPietrowicz](https://github.com/JurijPietrowicz) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/claude-subscription-title-and-context` --- ### 📝 Commits (10+) - [`eed5fee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eed5feeb57f4e2c1f97f3c02318a8ace6f7c04ae) fix(claude-subscription): skip the CLI's hidden session-title request - [`822c5e4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/822c5e44d410b40faead6d9852573599cab08085) fix(claude-subscription): drop the coding-agent context Claude Code adds - [`345e0e2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/345e0e2b169138ed7aa9d2f035f918481396040a) Merge branch 'staging' into fix/claude-subscription-title-and-context - [`6353e03`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6353e03bce1d9f8f30e9145b484209e6a45626e7) fix(claude-subscription): refuse to chat without the chat-context mod - [`bbda913`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bbda913d4f371afab6202d9ef325ebcfc3ad8cc8) docs(changelog): say when the Claude chat-context plugin can't help - [`0795e48`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0795e4831aff19ee2f3c8896e3ff5127a6d92eb9) docs(changelog): say the Claude fix doesn't reach agent packages yet - [`45058e5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45058e561e0c3b396dbcdbc7178c95f7eefbe00d) docs(changelog): shorten the Claude (Subscription) entry - [`83da78a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/83da78aec442a43c83de9d89036eec1913eccf41) Merge branch 'staging' into fix/claude-subscription-title-and-context - [`148f278`](https://github.com/Pasta-Devs/Marinara-Engine/commit/148f2782b276454bea63266333adde6961384a81) Merge branch 'staging' into fix/claude-subscription-title-and-context - [`9eb647f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9eb647fc82bdcdf796f7f9cb9b8d0c7fc992e453) fix(claude-subscription): keep Claude Code's generated mod types out of format:check ### 📊 Changes **8 files changed** (+167 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `.prettierignore` (+2 -0) ➕ `packages/server/src/assets/claude-code-plugin/.claude-plugin/plugin.json` (+6 -0) ➕ `packages/server/src/assets/claude-code-plugin/.gitignore` (+3 -0) ➕ `packages/server/src/assets/claude-code-plugin/hooks/hooks.json` (+4 -0) ➕ `packages/server/src/assets/claude-code-plugin/hooks/register.mjs` (+9 -0) 📝 `packages/server/src/routes/connections.routes.ts` (+2 -0) 📝 `packages/server/src/services/llm/providers/claude-subscription.provider.ts` (+57 -4) ➕ `scripts/regressions/claude-subscription-chat-context.regression.ts` (+84 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7447 ## Why this change Claude (Subscription) chats run on Claude Code, which adds work meant for a coding agent: - **A hidden title request.** Claude Code makes a second request to name every new session. Marinara hit it on the first message of each chat, on every one-off request (summaries, agents, scene analysis, connection tests) and on **every** message in fold mode. That spends the user's subscription limits for nothing. - **Extra context.** Claude Code puts messages of its own between Marinara's system prompt and the chat: the account email, an empty CLAUDE.md section, the server's environment (working directory, OS, shell), the model name, a token budget and the date. A roleplay needs none of it, it can change how the model plays the character, and the email shouldn't go out with every chat. ## What changed - **Title:** the provider passes the SDK's `title` option (`"Title"`), so Claude Code skips the naming request. The connection test in `connections.routes.ts` passes it too. - **Context:** a one-hook Claude Code mod, `packages/server/src/assets/claude-code-plugin/`, drops every `prompt.attachment`. The provider loads it with the SDK's `plugins` option. - Dropping every attachment, rather than a list of names, also covers new kinds a future Claude Code adds. - The hooks module is plain `.mjs`, so tsc leaves it alone. The existing `copyRuntimeAssets()` step copies `src/assets` into `dist/assets`, so it ships in source, Docker and Android (esbuild) builds with no build changes. - Claude Code writes type files and a `tsconfig.json` beside a mod each time it loads it. The types folder ignores itself, and a `.gitignore` in the plugin folder covers `tsconfig.json`, so source installs don't get untracked files. - **Missing plugin:** `chat()` checks the plugin's files before the SDK starts and stops with an error when any is missing, so nothing is sent. This is the check CodeRabbit asked for, moved earlier: throwing when `init` reports a load error doesn't stop the request, because the CLI sends it without waiting. In a live probe, 2 of 3 runs still sent and answered the chat. - **Init guard:** the provider's `init` debug log lists loaded plugins. It warns when Claude Code reports a load error for this plugin only; a built-in plugin's error doesn't bring the context back. - **Regression:** `claude-subscription-chat-context.regression.ts` checks that the provider sends `title` and `plugins`, that the plugin files exist where the provider points, and that the hook drops attachments without handing them on. The title check moved there from the cache regression. - **Format check (maintainer review fix):** `.prettierignore` skips `packages/server/src/assets/claude-code-plugin/.claude-plugin/types/`. Claude Code writes about 790 KB of mod API declarations there each time a source checkout loads the plugin. Prettier doesn't read that folder's own `.gitignore`, so `pnpm check` failed after one dev-mode chat. **Not changed:** the billing header and the line `You are a Claude agent, built on Anthropic's Claude Agent SDK.` sit before Marinara's system prompt, and no SDK option or mod event controls them. The CLI also leaves an empty `system` message where the environment block was. It has no content. **Follow-up:** the downloadable **Noodle**, **Slurp2** and **Conversation Calls** packages bundle their own copy of the provider, so they need a separate Marinara-Agents update to get this fix. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Done by the agent: - Maintainer-side review: Claude Code 2.1.293 pointed at a local capture server, with a throwaway account email. With `staging`'s options, the request carried the email, `# Environment`, model note, date and token budget. With this branch's provider, it carried only the system prompt and the message, and the reply came back normally. - `pnpm check` passed (the one client lint warning was already on `staging`). `pnpm --filter ./packages/server build` copies the plugin to `dist/assets/claude-code-plugin/`. The `claude-subscription-*` regressions pass. `claude plugin validate` passes on the plugin. - Live probe of the real provider on Claude Haiku 5.5 with `OTEL_LOG_RAW_API_BODIES`, on both the installed Claude Code 2.1.296 and the bundled 2.1.293. Cases: new chat, resume path with history, fold path, and a message with an image. Every case sent one `sdk` request and no `generate_session_title`. The request body had no email, `# Environment`, model note, token budget or date, and the reply was normal. The image still reached the model (it named the colour). - The plugin loads (`marinara-chat-context` in the `init` plugins list, no `plugin_errors`), including from a read-only folder, as in Docker where the app user can't write to `/app/packages`. - With `hooks/register.mjs` removed, a chat stops with the new error and no request is captured. Done by the human: - Manually verified in the app: with `OTEL_LOG_RAW_API_BODIES=file:<folder>` in `.env`, starting a new chat and sending a full sentence. `<folder>/index.jsonl` has one `sdk` request and no `generate_session_title`, and the request file has no email, `# Environment`, model or date lines. - Manually verified the connection test still reports the right model family. Still to verify by hand: - Manually verify a Docker build: the server log at `LOG_LEVEL=debug` lists `marinara-chat-context` under `plugins` in `SDK init surface`. - Manually verify on Windows that the plugin loads (path with backslashes and possibly spaces). ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No `docs/` page describes what Claude Code adds to requests, so there's nothing to translate. The `CHANGELOG.md` entry was dropped: pull requests no longer add changelog entries. ## UI evidence (if applicable) Not applicable (server-side only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Claude subscription chats now load a local chat-context plugin to manage prompt attachments. * **Bug Fixes** * Chat requests use a consistent session title. * Plugin-loading issues are reported without interrupting requests when possible. <!-- 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-24 04:07:02 +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#7739
No description provided.