[PR #1581] [MERGED] [codex] Harden provider connection errors #5128

Closed
opened 2026-10-22 04:13:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1581
Author: @Xelvanis
Created: 5/29/2026
Status: ✅ Merged
Merged: 5/29/2026
Merged by: @Xelvanis

Base: refactor ← Head: codex/provider-connection-errors


📝 Commits (4)

  • f78966f Harden provider connection errors
  • c018b91 Redact provider transport URL errors
  • 8b1f582 Mark NanoGPT connection checks as warnings
  • 4e249b3 Address provider error review findings

📊 Changes

11 files changed (+708 additions, -186 deletions)

View changed files

📝 src-tauri/Cargo.lock (+2 -0)
📝 src-tauri/crates/llm/src/lib.rs (+100 -44)
📝 src-tauri/crates/security/Cargo.toml (+2 -0)
📝 src-tauri/crates/security/src/lib.rs (+262 -0)
📝 src-tauri/src/commands/storage/images/providers.rs (+73 -38)
📝 src-tauri/src/commands/storage/integrations/discord.rs (+8 -3)
📝 src-tauri/src/commands/storage/integrations/tts.rs (+17 -23)
📝 src-tauri/src/commands/storage/llm.rs (+175 -30)
📝 src/engine/contracts/types/connection.ts (+3 -0)
📝 src/features/catalog/connections/types.ts (+5 -1)
📝 src/features/shell/connections/components/ConnectionEditor.tsx (+61 -47)

📄 Description

Linked issue

Closes #1567
Closes #1568
Closes #1569

Why this change

Provider and connection-test failures could surface upstream error text without a Marinara-owned final redaction pass. NanoGPT could also show a green connection-test success for a model-list lookup even though generation auth/payment was still unverified. The OpenAI ChatGPT setup UI also needed clearer local credential-file guidance.

What changed

  • Added shared Rust redaction helpers for provider error text and JSON details, covering API keys, auth tokens, bearer values, sensitive query params, payment/retrieval URLs, and common provider key prefixes.
  • Applied redaction to LLM provider HTTP errors, malformed response details, stream error events, Claude subscription diagnostics, connection model lookup errors, image provider errors, TTS provider errors, and Discord webhook response details.
  • Redacted provider transport URL/network errors so query-string credentials such as Google ?key=... values are not echoed back.
  • Changed NanoGPT connection tests to require a saved API key, label model-list reachability as generation/payment-unverified, and return/render the result as a warning instead of success.
  • Updated OpenAI ChatGPT connection helper text to explain the local Codex auth.json credential-file flow and locked fields.

Refactor impact

Primary owner:

Rust provider transport/security plus Connections shell UI.

Impact areas reviewed:

  • Rust marinara-security redaction helpers and consumers.
  • Rust LLM provider transport and connection-test command paths.
  • Image provider, TTS, and Discord integration failure-body surfaces.
  • Connections catalog/shell result types and warning-card rendering.
  • Hostable/runtime boundary shape for existing connection commands; no new command was added.

Boundary notes:

  • Redaction lives in src-tauri/crates/security and is reused by privileged Rust provider/integration boundaries.
  • React UI changes stay in src/features/shell/connections; shared result typing stays in existing connection contract/type owners.
  • No engine-to-Tauri or feature raw-invoke boundary was added.
  • Remote runtime allowlists/dispatch were not changed because the existing connection commands and DTO shape are reused.

Pressure points touched:

  • No ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs registration, or import workflow changes.
  • Existing broad provider command files were touched only at the relevant error and connection-test surfaces.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

Commands and checks run locally:

  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-security -p marinara-llm
  • cargo test --manifest-path src-tauri/Cargo.toml nanogpt_connection
  • cargo test --manifest-path src-tauri/Cargo.toml connection_models_marks_fallback_when_provider_lookup_fails
  • cargo test --manifest-path src-tauri/Cargo.toml image_provider_error_sanitizer_redacts_secrets
  • cargo test --manifest-path src-tauri/Cargo.toml openai_voice_lookup_marks_fallback_when_provider_fails
  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm openai_chatgpt_missing_auth_message_hides_local_path
  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm ensure_url_allowed_redacts_query_secret
  • cargo test --manifest-path src-tauri/Cargo.toml model_url_rejection_redacts_query_secret
  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm provider_http_error_redacts_sensitive_error_body
  • pnpm typecheck
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm check:architecture
  • pnpm build
  • git diff --check origin/refactor...HEAD -- . ':(exclude)graphify-out/**'

Native Tauri QA:

  • Ran the native WebDriver smoke against a current debug Tauri executable built from this branch; verified React mounted in the native window with title Marinara Engine.
  • In the native Connections UI, created a temporary NanoGPT connection pointed at a local fake model-list endpoint, clicked Test Connection, and observed Connection Test: Warning plus the “does not verify generation auth/payment” copy. The card did not show Connection Test: Success.
  • Deleted the temporary connection after the QA pass.

Proof gaps:

  • No real NanoGPT account/payment or live provider credentials were used.
  • Remote runtime smoke was not run because this change reuses existing command routing and the focused risk was provider error/result handling.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs files were changed; this is covered by existing issue reports and does not change run commands, architecture ownership, or contributor workflow.

UI evidence

Local native WebDriver screenshot evidence was captured for the NanoGPT warning card during Tauri QA. No screenshot artifact is committed in this PR.

Summary by CodeRabbit

  • New Features

    • Connection tests now display warning states separately from failures, providing clearer diagnostic feedback.
  • Bug Fixes

    • Improved redaction of sensitive information (API credentials, tokens, file paths) from error messages and diagnostic logs across all integrated providers.
    • Enhanced error handling to prevent credential leaks in connection validation and model retrieval responses.
  • Improvements

    • Connection status UI now visually distinguishes between warnings and failures.

Review Change Stack


🔄 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/1581 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `codex/provider-connection-errors` --- ### 📝 Commits (4) - [`f78966f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f78966ffab7ecab93576ea48689dd2f70ca3cb84) Harden provider connection errors - [`c018b91`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c018b914b2e3476e8f5ac71c26f7ec46095c2156) Redact provider transport URL errors - [`8b1f582`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8b1f58261a32ba0e3a203ecfa35c474673212e3b) Mark NanoGPT connection checks as warnings - [`4e249b3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e249b35bf5a68c88731083fe1e318bcd7db2d8a) Address provider error review findings ### 📊 Changes **11 files changed** (+708 additions, -186 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/Cargo.lock` (+2 -0) 📝 `src-tauri/crates/llm/src/lib.rs` (+100 -44) 📝 `src-tauri/crates/security/Cargo.toml` (+2 -0) 📝 `src-tauri/crates/security/src/lib.rs` (+262 -0) 📝 `src-tauri/src/commands/storage/images/providers.rs` (+73 -38) 📝 `src-tauri/src/commands/storage/integrations/discord.rs` (+8 -3) 📝 `src-tauri/src/commands/storage/integrations/tts.rs` (+17 -23) 📝 `src-tauri/src/commands/storage/llm.rs` (+175 -30) 📝 `src/engine/contracts/types/connection.ts` (+3 -0) 📝 `src/features/catalog/connections/types.ts` (+5 -1) 📝 `src/features/shell/connections/components/ConnectionEditor.tsx` (+61 -47) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1567 Closes #1568 Closes #1569 ## Why this change Provider and connection-test failures could surface upstream error text without a Marinara-owned final redaction pass. NanoGPT could also show a green connection-test success for a model-list lookup even though generation auth/payment was still unverified. The OpenAI ChatGPT setup UI also needed clearer local credential-file guidance. ## What changed - Added shared Rust redaction helpers for provider error text and JSON details, covering API keys, auth tokens, bearer values, sensitive query params, payment/retrieval URLs, and common provider key prefixes. - Applied redaction to LLM provider HTTP errors, malformed response details, stream error events, Claude subscription diagnostics, connection model lookup errors, image provider errors, TTS provider errors, and Discord webhook response details. - Redacted provider transport URL/network errors so query-string credentials such as Google `?key=...` values are not echoed back. - Changed NanoGPT connection tests to require a saved API key, label model-list reachability as generation/payment-unverified, and return/render the result as a warning instead of success. - Updated OpenAI ChatGPT connection helper text to explain the local Codex `auth.json` credential-file flow and locked fields. ## Refactor impact Primary owner: Rust provider transport/security plus Connections shell UI. Impact areas reviewed: - Rust `marinara-security` redaction helpers and consumers. - Rust LLM provider transport and connection-test command paths. - Image provider, TTS, and Discord integration failure-body surfaces. - Connections catalog/shell result types and warning-card rendering. - Hostable/runtime boundary shape for existing connection commands; no new command was added. Boundary notes: - Redaction lives in `src-tauri/crates/security` and is reused by privileged Rust provider/integration boundaries. - React UI changes stay in `src/features/shell/connections`; shared result typing stays in existing connection contract/type owners. - No engine-to-Tauri or feature raw-invoke boundary was added. - Remote runtime allowlists/dispatch were not changed because the existing connection commands and DTO shape are reused. Pressure points touched: - No ModeSurface, GameSurface, shared mode UI, `src-tauri/src/lib.rs` registration, or import workflow changes. - Existing broad provider command files were touched only at the relevant error and connection-test surfaces. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [x] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [x] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Commands and checks run locally: - `cargo test --manifest-path src-tauri/Cargo.toml -p marinara-security -p marinara-llm` - `cargo test --manifest-path src-tauri/Cargo.toml nanogpt_connection` - `cargo test --manifest-path src-tauri/Cargo.toml connection_models_marks_fallback_when_provider_lookup_fails` - `cargo test --manifest-path src-tauri/Cargo.toml image_provider_error_sanitizer_redacts_secrets` - `cargo test --manifest-path src-tauri/Cargo.toml openai_voice_lookup_marks_fallback_when_provider_fails` - `cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm openai_chatgpt_missing_auth_message_hides_local_path` - `cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm ensure_url_allowed_redacts_query_secret` - `cargo test --manifest-path src-tauri/Cargo.toml model_url_rejection_redacts_query_secret` - `cargo test --manifest-path src-tauri/Cargo.toml -p marinara-llm provider_http_error_redacts_sensitive_error_body` - `pnpm typecheck` - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` - `pnpm check:architecture` - `pnpm build` - `git diff --check origin/refactor...HEAD -- . ':(exclude)graphify-out/**'` Native Tauri QA: - Ran the native WebDriver smoke against a current debug Tauri executable built from this branch; verified React mounted in the native window with title `Marinara Engine`. - In the native Connections UI, created a temporary NanoGPT connection pointed at a local fake model-list endpoint, clicked `Test Connection`, and observed `Connection Test: Warning` plus the “does not verify generation auth/payment” copy. The card did not show `Connection Test: Success`. - Deleted the temporary connection after the QA pass. Proof gaps: - No real NanoGPT account/payment or live provider credentials were used. - Remote runtime smoke was not run because this change reuses existing command routing and the focused risk was provider error/result handling. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs files were changed; this is covered by existing issue reports and does not change run commands, architecture ownership, or contributor workflow. ## UI evidence Local native WebDriver screenshot evidence was captured for the NanoGPT warning card during Tauri QA. No screenshot artifact is committed in this PR. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Connection tests now display warning states separately from failures, providing clearer diagnostic feedback. * **Bug Fixes** * Improved redaction of sensitive information (API credentials, tokens, file paths) from error messages and diagnostic logs across all integrated providers. * Enhanced error handling to prevent credential leaks in connection validation and model retrieval responses. * **Improvements** * Connection status UI now visually distinguishes between warnings and failures. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1581?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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-22 04:13:33 +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#5128
No description provided.