[GH-ISSUE #2421] 11-PROV-RUNTIME-thinking-usage-metadata drops OpenAI Responses encrypted reasoning replay #1186

Closed
opened 2026-10-21 05:28:31 +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/2421

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Surface 11-PROV-RUNTIME-thinking-usage-metadata: refactor provider transport emits visible thinking and usage, but does not preserve OpenAI Responses encrypted reasoning items for replay/debug parity with legacy.

Linked tracker: #2410.

Expected behavior

OpenAI Responses reasoning metadata should be requested, preserved, and replayed where applicable, while existing thinking and usage events remain available. Legacy inserted prior encrypted reasoning items into the next Responses input and requested reasoning.encrypted_content.

Actual behavior

Refactor emits thinking and usage stream events and stores visible thinking/token info, but targeted static trace found no OpenAI Responses encrypted reasoning replay/preservation equivalent.

Steps to reproduce

  1. Use an OpenAI Responses model that returns encrypted reasoning items.
  2. Generate a turn, then generate a follow-up in the same chat.
  3. Inspect provider transport/request metadata and saved replay/debug metadata for preserved/replayed encrypted reasoning items.

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@09923989 parityscan receipt
  • Run mode: Tauri desktop / remote runtime provider transport
  • OS + version: not relevant; static trace
  • Node + pnpm versions: not relevant; static trace
  • Rust version, if relevant: not relevant; static trace
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: OpenAI Responses API reasoning models

Logs, screenshots, or video

Proof:

  • Legacy requests and replays encrypted reasoning: main:packages/server/src/services/llm/providers/openai.provider.ts:1362, :1384.
  • Legacy extracts completed response usage/reasoning metadata: main:packages/server/src/services/llm/providers/openai.provider.ts:1578, :1592.
  • Refactor emits OpenAI Responses thinking and usage events: src-tauri/crates/llm/src/lib.rs:2178, :2199.
  • Refactor emits Anthropic/Gemini thinking and usage events: src-tauri/crates/llm/src/lib.rs:3639, :3663, :4105.
  • Refactor saves visible thinking and usage-derived token info: src/engine/generation/start-generation.ts:1807, :2174, :3374, :3457.
  • Targeted search found no refactor equivalent for encryptedReasoningItems / reasoning.encrypted_content preservation.

Files inspected:

  • src-tauri/crates/llm/src/lib.rs
  • src/engine/generation/start-generation.ts
  • src/engine/generation/provider-visible-parameters.ts
  • main:packages/server/src/services/llm/providers/openai.provider.ts
  • main:packages/server/src/services/llm/providers/google.provider.ts
  • main:packages/server/src/routes/generate.routes.ts

Regression notes

Legacy preserved OpenAI Responses encrypted reasoning items for subsequent-turn continuity. Refactor appears to preserve visible thinking/usage only.

Additional context

Acceptance criteria:

  • OpenAI Responses requests include the needed encrypted reasoning item option when the provider/model supports it.
  • Returned encrypted reasoning items are preserved in replay/debug metadata without exposing secrets.
  • Subsequent OpenAI Responses turns replay preserved reasoning items in the correct request location.
  • Existing thinking and usage events for OpenAI Responses, Anthropic, and Gemini keep working.
  • Add focused mocked-provider proof for preservation and replay behavior.

Do not broaden into saved config or prompt assembly outside what is needed to replay provider metadata.

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/2421 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Surface `11-PROV-RUNTIME-thinking-usage-metadata`: refactor provider transport emits visible thinking and usage, but does not preserve OpenAI Responses encrypted reasoning items for replay/debug parity with legacy. Linked tracker: #2410. ## Expected behavior OpenAI Responses reasoning metadata should be requested, preserved, and replayed where applicable, while existing thinking and usage events remain available. Legacy inserted prior encrypted reasoning items into the next Responses input and requested `reasoning.encrypted_content`. ## Actual behavior Refactor emits `thinking` and `usage` stream events and stores visible thinking/token info, but targeted static trace found no OpenAI Responses encrypted reasoning replay/preservation equivalent. ## Steps to reproduce 1. Use an OpenAI Responses model that returns encrypted reasoning items. 2. Generate a turn, then generate a follow-up in the same chat. 3. Inspect provider transport/request metadata and saved replay/debug metadata for preserved/replayed encrypted reasoning items. ## Impact area - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [x] Chat mode - [x] Roleplay mode - [x] Game mode - [ ] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [x] 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@09923989 parityscan receipt - Run mode: Tauri desktop / remote runtime provider transport - OS + version: not relevant; static trace - Node + pnpm versions: not relevant; static trace - Rust version, if relevant: not relevant; static trace - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: OpenAI Responses API reasoning models ## Logs, screenshots, or video Proof: - Legacy requests and replays encrypted reasoning: `main:packages/server/src/services/llm/providers/openai.provider.ts:1362`, `:1384`. - Legacy extracts completed response usage/reasoning metadata: `main:packages/server/src/services/llm/providers/openai.provider.ts:1578`, `:1592`. - Refactor emits OpenAI Responses thinking and usage events: `src-tauri/crates/llm/src/lib.rs:2178`, `:2199`. - Refactor emits Anthropic/Gemini thinking and usage events: `src-tauri/crates/llm/src/lib.rs:3639`, `:3663`, `:4105`. - Refactor saves visible thinking and usage-derived token info: `src/engine/generation/start-generation.ts:1807`, `:2174`, `:3374`, `:3457`. - Targeted search found no refactor equivalent for `encryptedReasoningItems` / `reasoning.encrypted_content` preservation. Files inspected: - `src-tauri/crates/llm/src/lib.rs` - `src/engine/generation/start-generation.ts` - `src/engine/generation/provider-visible-parameters.ts` - `main:packages/server/src/services/llm/providers/openai.provider.ts` - `main:packages/server/src/services/llm/providers/google.provider.ts` - `main:packages/server/src/routes/generate.routes.ts` ## Regression notes Legacy preserved OpenAI Responses encrypted reasoning items for subsequent-turn continuity. Refactor appears to preserve visible thinking/usage only. ## Additional context Acceptance criteria: - OpenAI Responses requests include the needed encrypted reasoning item option when the provider/model supports it. - Returned encrypted reasoning items are preserved in replay/debug metadata without exposing secrets. - Subsequent OpenAI Responses turns replay preserved reasoning items in the correct request location. - Existing `thinking` and `usage` events for OpenAI Responses, Anthropic, and Gemini keep working. - Add focused mocked-provider proof for preservation and replay behavior. Do not broaden into saved config or prompt assembly outside what is needed to replay provider metadata. ## 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:31 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Fixed on refactor in 343142ee.\n\nWhat changed:\n- OpenAI Responses now requests reasoning.encrypted_content for regular OpenAI Responses calls and replays stored encrypted reasoning items in the Responses input before the last assistant item.\n- ChatGPT local auth Responses calls skip that encrypted reasoning include/replay path.\n- Responses completed payloads preserve encrypted reasoning items as providerMetadata; generation saves that metadata on assistant messages and replays it from assistant history without injecting it as prompt text.\n- Prompt snapshots and provider diagnostics redact encrypted_content so the opaque payload is not exposed in debug output.\n\nVerification:\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm openai_responses -- --nocapture\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm encrypted_reasoning -- --nocapture\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-security redact_sensitive_json -- --nocapture\n- pnpm typecheck\n- cargo check --manifest-path src-tauri/Cargo.toml --workspace\n- pnpm check:architecture

<!-- gh-comment-id:4638277634 --> @SpicyMarinara commented on GitHub (Jun 6, 2026): Fixed on refactor in 343142ee.\n\nWhat changed:\n- OpenAI Responses now requests reasoning.encrypted_content for regular OpenAI Responses calls and replays stored encrypted reasoning items in the Responses input before the last assistant item.\n- ChatGPT local auth Responses calls skip that encrypted reasoning include/replay path.\n- Responses completed payloads preserve encrypted reasoning items as providerMetadata; generation saves that metadata on assistant messages and replays it from assistant history without injecting it as prompt text.\n- Prompt snapshots and provider diagnostics redact encrypted_content so the opaque payload is not exposed in debug output.\n\nVerification:\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm openai_responses -- --nocapture\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm encrypted_reasoning -- --nocapture\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-security redact_sensitive_json -- --nocapture\n- pnpm typecheck\n- cargo check --manifest-path src-tauri/Cargo.toml --workspace\n- 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#1186
No description provided.