[GH-ISSUE #2439] [Issue]: 11-PROV-RUNTIME-claude-subscription-sdk Claude Subscription session omits existing history #1193

Closed
opened 2026-10-21 05:28:36 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Promansis on GitHub (Jun 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2439

Originally assigned to: @SpicyMarinara on GitHub.

Summary

11-PROV-RUNTIME-claude-subscription-sdk: Claude Subscription chat-scoped session mode can omit existing Marinara conversation history when starting or resuming a Claude Code CLI session.

Linked tracker: #2410.

Expected behavior

Legacy Claude Subscription used the Claude Agent SDK SessionStore resume path to inject prior Marinara ChatMessage[] history as synthetic JSONL for each request, then sent the current turn separately. Existing user, assistant, tool, and image-capable history reached the provider as multi-turn context even when the local SDK session was new.

Actual behavior

Refactor Claude Subscription shells out to claude -p. When _marinara.chatId exists, it sends only the trailing/current prompt with a stable --session-id. It does not synthesize or inject stored prior Marinara history into a fresh CLI session, so a new local Claude Code session can miss the existing Marinara transcript.

Steps to reproduce

  1. Use a claude_subscription connection in a chat with existing prior messages.
  2. Ensure runtime parameters include _marinara.chatId and the request is not regeneration or impersonation.
  3. Trace claude_subscription_prompt: it selects session_id and render_claude_subscription_current_prompt, which returns only the trailing/current prompt.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor parityscan, static trace from #2410 Batch 14
  • Run mode: Tauri desktop / remote runtime provider transport
  • OS + version: not relevant; static trace only
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: Claude Subscription / Claude Code CLI

Logs, screenshots, or video

Proof:

  • Legacy selects Agent SDK resume and builds SessionStore entries from prior messages: main:packages/server/src/services/llm/providers/claude-subscription.provider.ts:171, :185, :206, :223; main:packages/server/src/services/llm/providers/claude-subscription/jsonl-entries.ts:294, :399.
  • Refactor injects _marinara.chatId for Claude Subscription generation: src/engine/generation/start-generation.ts:3263.
  • Refactor session path reads _marinara.chatId, selects a stable session id, and renders only current/trailing prompt: src-tauri/crates/llm/src/lib.rs:2901, :2993, :3378.
  • Refactor test confirms prior assistant text is not part of the session-mode prompt: src-tauri/crates/llm/src/lib.rs:5577.

Regression notes

Legacy main had synthetic JSONL session injection through Claude Agent SDK SessionStore. Refactor moved provider execution to Rust/Claude Code CLI and kept the session id but not per-request history injection.

Additional context

Acceptance criteria:

  • Claude Subscription session mode preserves existing Marinara history when the local Claude Code session is new or incomplete.
  • Regeneration and impersonation continue to use transcript-fold/no-session behavior as currently intended.
  • Empty-result, model-billing drift, curated model list, CLI availability check, and secret-redacted error behavior remain intact.
  • Add focused proof for the session/history selection behavior.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2439 Originally assigned to: @SpicyMarinara on GitHub. ## Summary `11-PROV-RUNTIME-claude-subscription-sdk`: Claude Subscription chat-scoped session mode can omit existing Marinara conversation history when starting or resuming a Claude Code CLI session. Linked tracker: #2410. ## Expected behavior Legacy Claude Subscription used the Claude Agent SDK `SessionStore` resume path to inject prior Marinara `ChatMessage[]` history as synthetic JSONL for each request, then sent the current turn separately. Existing user, assistant, tool, and image-capable history reached the provider as multi-turn context even when the local SDK session was new. ## Actual behavior Refactor Claude Subscription shells out to `claude -p`. When `_marinara.chatId` exists, it sends only the trailing/current prompt with a stable `--session-id`. It does not synthesize or inject stored prior Marinara history into a fresh CLI session, so a new local Claude Code session can miss the existing Marinara transcript. ## Steps to reproduce 1. Use a `claude_subscription` connection in a chat with existing prior messages. 2. Ensure runtime parameters include `_marinara.chatId` and the request is not regeneration or impersonation. 3. Trace `claude_subscription_prompt`: it selects `session_id` and `render_claude_subscription_current_prompt`, which returns only the trailing/current prompt. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [x] Chat mode - [x] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor parityscan, static trace from #2410 Batch 14 - Run mode: Tauri desktop / remote runtime provider transport - OS + version: not relevant; static trace only - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: Claude Subscription / Claude Code CLI ## Logs, screenshots, or video Proof: - Legacy selects Agent SDK resume and builds `SessionStore` entries from prior messages: `main:packages/server/src/services/llm/providers/claude-subscription.provider.ts:171`, `:185`, `:206`, `:223`; `main:packages/server/src/services/llm/providers/claude-subscription/jsonl-entries.ts:294`, `:399`. - Refactor injects `_marinara.chatId` for Claude Subscription generation: `src/engine/generation/start-generation.ts:3263`. - Refactor session path reads `_marinara.chatId`, selects a stable session id, and renders only current/trailing prompt: `src-tauri/crates/llm/src/lib.rs:2901`, `:2993`, `:3378`. - Refactor test confirms prior assistant text is not part of the session-mode prompt: `src-tauri/crates/llm/src/lib.rs:5577`. ## Regression notes Legacy `main` had synthetic JSONL session injection through Claude Agent SDK `SessionStore`. Refactor moved provider execution to Rust/Claude Code CLI and kept the session id but not per-request history injection. ## Additional context Acceptance criteria: - Claude Subscription session mode preserves existing Marinara history when the local Claude Code session is new or incomplete. - Regeneration and impersonation continue to use transcript-fold/no-session behavior as currently intended. - Empty-result, model-billing drift, curated model list, CLI availability check, and secret-redacted error behavior remain intact. - Add focused proof for the session/history selection behavior. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:28:36 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jun 6, 2026):

Fixed in refactor with commit 90c49729.

Behavior changed:

  • Claude Subscription chat-scoped session prompts now include prior non-system Marinara history when there is existing history, then send the current turn under the stable chat session id.
  • Single-turn session prompts keep the previous compact current-turn behavior.
  • Trailing assistant continue prompts now include the prior assistant turn as history and keep the synthetic continue turn.
  • Regeneration and impersonation continue to bypass session mode and use transcript-fold/no-session behavior.

Verification:

  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm claude_subscription -- --nocapture
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm check:architecture
<!-- gh-comment-id:4638237309 --> @SpicyMarinara commented on GitHub (Jun 6, 2026): Fixed in refactor with commit 90c49729. Behavior changed: - Claude Subscription chat-scoped session prompts now include prior non-system Marinara history when there is existing history, then send the current turn under the stable chat session id. - Single-turn session prompts keep the previous compact current-turn behavior. - Trailing assistant continue prompts now include the prior assistant turn as history and keep the synthetic continue turn. - Regeneration and impersonation continue to bypass session mode and use transcript-fold/no-session behavior. Verification: - cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm claude_subscription -- --nocapture - cargo check --manifest-path src-tauri/Cargo.toml --workspace - pnpm check:architecture
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#1193
No description provided.