[GH-ISSUE #2414] [Issue]: 11-PROV-CONTRACT-llm-request-gateway / 11-PROV-RUNTIME-llm-complete-provider-fanout drops rich completion result #1182

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

Originally assigned to: @SpicyMarinara on GitHub.

Summary

11-PROV-CONTRACT-llm-request-gateway and 11-PROV-RUNTIME-llm-complete-provider-fanout are not on par: refactor public non-stream LLM completion returns only a string, so rich provider result fields such as tool calls, finish reason, usage, and provider metadata are not exposed through the gateway.

Linked tracker: #2410

Expected behavior

Legacy main exposes a provider-neutral request/response contract where non-stream completions can return assistant text plus tool calls, finish reason, usage, and provider metadata. The provider fanout routes OpenAI-compatible, Responses API, Anthropic, Google/Vertex, Claude Subscription, ChatGPT local auth, Cohere, and local-compatible/custom providers through that richer shape.

Acceptance criteria:

  • 11-PROV-CONTRACT-llm-request-gateway exposes a rich non-stream completion result at the shared gateway/API boundary, not only string.
  • 11-PROV-RUNTIME-llm-complete-provider-fanout preserves text plus tool calls, finish reason, usage, and provider metadata where providers return them.
  • Anthropic, Google/Vertex, Claude Subscription, ChatGPT local auth, OpenAI Responses, OpenAI-compatible/custom/local-compatible, and Cohere paths are either mapped to the rich result or explicitly documented with proven intentional limitations.
  • Existing string-only callers keep working through a compatibility helper or narrow adapter.

Actual behavior

Refactor LlmGateway.complete returns Promise<string>, llmApi.complete invokes llm_complete, Tauri llm_complete returns Value::String, and Rust complete() discards complete_rich() fields. Rust has internal rich parsing for some providers, but the public non-stream command/gateway drops it, and Anthropic, Google/Vertex, and Claude Subscription are currently mapped to text-only rich results with empty tool calls.

Steps to reproduce

  1. Inspect the shared gateway and Tauri command path for llm_complete on refactor.
  2. Compare against legacy main provider contract and provider.chatComplete generation use.
  3. Observe that refactor has no public non-stream rich result equivalent for the listed surfaces.

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, compared with legacy main
  • Run mode: static trace
  • OS + version: not relevant
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: text LLM provider transport

Logs, screenshots, or video

Proof used: static trace only.

Legacy proof:

  • main:packages/server/src/services/llm/base-provider.ts:42, :75, :143 define ChatMessage, ChatOptions, and rich ChatCompletionResult.
  • main:packages/server/src/services/llm/provider-registry.ts:46-105 fans out provider construction.
  • main:packages/server/src/routes/generate.routes.ts:7437, :7487, :7505, :7510 consumes provider.chatComplete, usage, tool calls, and provider metadata.

Refactor proof:

  • src/engine/capabilities/llm.ts:16-23, :39-43 defines LlmRequest and string-only complete.
  • src/shared/api/llm-api.ts:35-39 invokes llm_complete without a rich wrapper.
  • src-tauri/src/commands/storage/llm.rs:41-91 builds the request and returns Value::String for llm_complete.
  • src-tauri/crates/llm/src/lib.rs:72-105 defines internal LlmCompletion and provider fanout.
  • src-tauri/crates/llm/src/lib.rs:79-80 discards complete_rich() fields in complete().
  • src-tauri/crates/llm/src/lib.rs:1957-2013, :4236-4295 parse tool calls for some OpenAI/Responses-compatible results.
  • src-tauri/crates/llm/src/lib.rs:85-101, :3486-3498, :3883-3898 map Anthropic, Google/Vertex, and Claude Subscription to text-only rich results.

Regression notes

Confirmed parity gap from Target 11 Batch 1 Text LLM Gateway parityscan. No live provider calls were run.

Additional context

Surfaces:

  • 11-PROV-CONTRACT-llm-request-gateway
  • 11-PROV-RUNTIME-llm-complete-provider-fanout

Follow-ups not chased in this issue: streaming/cancel/remote route proof, provider diagnostics, embeddings, image, TTS, translation, and broader Target 11 rows.

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/2414 Originally assigned to: @SpicyMarinara on GitHub. ## Summary 11-PROV-CONTRACT-llm-request-gateway and 11-PROV-RUNTIME-llm-complete-provider-fanout are not on par: refactor public non-stream LLM completion returns only a string, so rich provider result fields such as tool calls, finish reason, usage, and provider metadata are not exposed through the gateway. Linked tracker: #2410 ## Expected behavior Legacy `main` exposes a provider-neutral request/response contract where non-stream completions can return assistant text plus tool calls, finish reason, usage, and provider metadata. The provider fanout routes OpenAI-compatible, Responses API, Anthropic, Google/Vertex, Claude Subscription, ChatGPT local auth, Cohere, and local-compatible/custom providers through that richer shape. Acceptance criteria: - `11-PROV-CONTRACT-llm-request-gateway` exposes a rich non-stream completion result at the shared gateway/API boundary, not only `string`. - `11-PROV-RUNTIME-llm-complete-provider-fanout` preserves text plus tool calls, finish reason, usage, and provider metadata where providers return them. - Anthropic, Google/Vertex, Claude Subscription, ChatGPT local auth, OpenAI Responses, OpenAI-compatible/custom/local-compatible, and Cohere paths are either mapped to the rich result or explicitly documented with proven intentional limitations. - Existing string-only callers keep working through a compatibility helper or narrow adapter. ## Actual behavior Refactor `LlmGateway.complete` returns `Promise<string>`, `llmApi.complete` invokes `llm_complete`, Tauri `llm_complete` returns `Value::String`, and Rust `complete()` discards `complete_rich()` fields. Rust has internal rich parsing for some providers, but the public non-stream command/gateway drops it, and Anthropic, Google/Vertex, and Claude Subscription are currently mapped to text-only rich results with empty tool calls. ## Steps to reproduce 1. Inspect the shared gateway and Tauri command path for `llm_complete` on `refactor`. 2. Compare against legacy `main` provider contract and `provider.chatComplete` generation use. 3. Observe that refactor has no public non-stream rich result equivalent for the listed surfaces. ## 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 - [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` parityscan, compared with legacy `main` - Run mode: static trace - OS + version: not relevant - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: text LLM provider transport ## Logs, screenshots, or video Proof used: static trace only. Legacy proof: - `main:packages/server/src/services/llm/base-provider.ts:42`, `:75`, `:143` define `ChatMessage`, `ChatOptions`, and rich `ChatCompletionResult`. - `main:packages/server/src/services/llm/provider-registry.ts:46-105` fans out provider construction. - `main:packages/server/src/routes/generate.routes.ts:7437`, `:7487`, `:7505`, `:7510` consumes `provider.chatComplete`, usage, tool calls, and provider metadata. Refactor proof: - `src/engine/capabilities/llm.ts:16-23`, `:39-43` defines `LlmRequest` and string-only `complete`. - `src/shared/api/llm-api.ts:35-39` invokes `llm_complete` without a rich wrapper. - `src-tauri/src/commands/storage/llm.rs:41-91` builds the request and returns `Value::String` for `llm_complete`. - `src-tauri/crates/llm/src/lib.rs:72-105` defines internal `LlmCompletion` and provider fanout. - `src-tauri/crates/llm/src/lib.rs:79-80` discards `complete_rich()` fields in `complete()`. - `src-tauri/crates/llm/src/lib.rs:1957-2013`, `:4236-4295` parse tool calls for some OpenAI/Responses-compatible results. - `src-tauri/crates/llm/src/lib.rs:85-101`, `:3486-3498`, `:3883-3898` map Anthropic, Google/Vertex, and Claude Subscription to text-only rich results. ## Regression notes Confirmed parity gap from Target 11 Batch 1 Text LLM Gateway parityscan. No live provider calls were run. ## Additional context Surfaces: - `11-PROV-CONTRACT-llm-request-gateway` - `11-PROV-RUNTIME-llm-complete-provider-fanout` Follow-ups not chased in this issue: streaming/cancel/remote route proof, provider diagnostics, embeddings, image, TTS, translation, and broader Target 11 rows. ## 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:29 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Fixed on refactor in 3067a9c7.\n\nWhat changed:\n- The shared LLM capability now exposes LlmCompletion and optional completeRich while keeping complete as the string-only compatibility helper.\n- llmApi.completeRich normalizes both rich objects and legacy string responses; llmApi.complete returns only content as before.\n- Tauri llm_complete now returns the serialized rich completion result from marinara_llm::complete_rich.\n- Rust LlmCompletion now carries content, toolCalls, finishReason, usage, and providerMetadata.\n- OpenAI-compatible/custom/local-compatible, OpenAI Responses/ChatGPT local auth, Cohere, Anthropic, Google/Vertex, and Claude Subscription now route through rich completion results where their current non-stream responses expose those fields. Anthropic/Google/Claude remain no-tool-call non-stream paths unless their provider response includes tool calls in a parser we support.\n\nVerification:\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm rich -- --nocapture\n- pnpm typecheck\n- cargo check --manifest-path src-tauri/Cargo.toml --workspace\n- pnpm check:architecture

<!-- gh-comment-id:4638308983 --> @SpicyMarinara commented on GitHub (Jun 6, 2026): Fixed on refactor in 3067a9c7.\n\nWhat changed:\n- The shared LLM capability now exposes LlmCompletion and optional completeRich while keeping complete as the string-only compatibility helper.\n- llmApi.completeRich normalizes both rich objects and legacy string responses; llmApi.complete returns only content as before.\n- Tauri llm_complete now returns the serialized rich completion result from marinara_llm::complete_rich.\n- Rust LlmCompletion now carries content, toolCalls, finishReason, usage, and providerMetadata.\n- OpenAI-compatible/custom/local-compatible, OpenAI Responses/ChatGPT local auth, Cohere, Anthropic, Google/Vertex, and Claude Subscription now route through rich completion results where their current non-stream responses expose those fields. Anthropic/Google/Claude remain no-tool-call non-stream paths unless their provider response includes tool calls in a parser we support.\n\nVerification:\n- cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm rich -- --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#1182
No description provided.