[PR #982] [MERGED] Fix lorebook vectorization timeout #4869

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/982
Author: @cha1latte
Created: 5/18/2026
Status: ✅ Merged
Merged: 5/18/2026
Merged by: @cha1latte

Base: staging ← Head: fix/issue-979-vectorization-timeout


📝 Commits (2)

  • 9442236 Fix embedding vectorization timeout
  • ec7af19 Harden embedding timeout parsing

📊 Changes

5 files changed (+27 additions, -7 deletions)

View changed files

📝 .env.example (+2 -0)
📝 docs/CONFIGURATION.md (+2 -1)
📝 packages/server/src/config/runtime-config.ts (+10 -0)
📝 packages/server/src/services/llm/base-provider.ts (+6 -4)
📝 packages/server/src/services/llm/providers/local-sidecar.provider.ts (+7 -2)

📄 Description

Linked issue

Closes #979

Why this change

  • Lorebook vectorization used the embedding provider path, which aborted embedding HTTP requests after 60 seconds. Slow CPU-only local embedding servers can need several minutes to return a batch, so larger lorebooks timed out before the embedding job finished.

What changed

  • Added EMBEDDING_TIMEOUT_MS with a 300000 ms default for embedding provider requests.
  • Applied that timeout to generic OpenAI-compatible embeddings and local sidecar OpenAI/legacy embedding calls.
  • Matched the undici headers timeout to the embedding timeout for embedding requests so raising the env var can actually allow slow first-byte responses.
  • Documented the new timeout in .env.example and docs/CONFIGURATION.md.

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

  • Codex reproduced the old timeout path with packages\server\node_modules\.bin\tsx.cmd scratch\issue-979-embedding-timeout-repro.ts before: the provider requested AbortSignal.timeout(60000) and the scaled fake slow embedding response was aborted.
  • Codex verified the fix with packages\server\node_modules\.bin\tsx.cmd scratch\issue-979-embedding-timeout-repro.ts after: the provider requested 300000 ms and completed the fake slow embedding response.
  • Codex verified configurability with EMBEDDING_TIMEOUT_MS=200000 using the same scratch harness: the provider requested 200000 ms and completed the fake slow embedding response.
  • Codex ran pnpm check; impeccable context check, lint, and build passed.
  • No human-only verification is required for the core claim; this is a non-visual provider timeout change proven with a local fake embedding endpoint.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Docs updated: .env.example and docs/CONFIGURATION.md now include EMBEDDING_TIMEOUT_MS. No version or release files changed.

UI evidence (if applicable)

N/A - non-visual backend/configuration fix.

Summary by CodeRabbit

  • New Features

    • Added configurable embedding request timeout (default: 5 minutes) via EMBEDDING_TIMEOUT_MS environment variable for improved support of slow local embedding servers.
  • Documentation

    • Updated configuration guide with new embedding timeout setting and restart requirements.

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/982 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/18/2026 **Status:** ✅ Merged **Merged:** 5/18/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/issue-979-vectorization-timeout` --- ### 📝 Commits (2) - [`9442236`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9442236e274e9ebd21390d976caa7ba88571765c) Fix embedding vectorization timeout - [`ec7af19`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ec7af198ac488c6bcff195667ee17a52025104bb) Harden embedding timeout parsing ### 📊 Changes **5 files changed** (+27 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+2 -0) 📝 `docs/CONFIGURATION.md` (+2 -1) 📝 `packages/server/src/config/runtime-config.ts` (+10 -0) 📝 `packages/server/src/services/llm/base-provider.ts` (+6 -4) 📝 `packages/server/src/services/llm/providers/local-sidecar.provider.ts` (+7 -2) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes #979 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Lorebook vectorization used the embedding provider path, which aborted embedding HTTP requests after 60 seconds. Slow CPU-only local embedding servers can need several minutes to return a batch, so larger lorebooks timed out before the embedding job finished. ## What changed <!-- List the key changes in this PR --> - Added `EMBEDDING_TIMEOUT_MS` with a 300000 ms default for embedding provider requests. - Applied that timeout to generic OpenAI-compatible embeddings and local sidecar OpenAI/legacy embedding calls. - Matched the undici headers timeout to the embedding timeout for embedding requests so raising the env var can actually allow slow first-byte responses. - Documented the new timeout in `.env.example` and `docs/CONFIGURATION.md`. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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 <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex reproduced the old timeout path with `packages\server\node_modules\.bin\tsx.cmd scratch\issue-979-embedding-timeout-repro.ts before`: the provider requested `AbortSignal.timeout(60000)` and the scaled fake slow embedding response was aborted. - Codex verified the fix with `packages\server\node_modules\.bin\tsx.cmd scratch\issue-979-embedding-timeout-repro.ts after`: the provider requested `300000` ms and completed the fake slow embedding response. - Codex verified configurability with `EMBEDDING_TIMEOUT_MS=200000` using the same scratch harness: the provider requested `200000` ms and completed the fake slow embedding response. - Codex ran `pnpm check`; impeccable context check, lint, and build passed. - No human-only verification is required for the core claim; this is a non-visual provider timeout change proven with a local fake embedding endpoint. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Docs updated: `.env.example` and `docs/CONFIGURATION.md` now include `EMBEDDING_TIMEOUT_MS`. No version or release files changed. ## UI evidence (if applicable) N/A - non-visual backend/configuration fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added configurable embedding request timeout (default: 5 minutes) via `EMBEDDING_TIMEOUT_MS` environment variable for improved support of slow local embedding servers. * **Documentation** * Updated configuration guide with new embedding timeout setting and restart requirements. <!-- 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/982?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:11:19 +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#4869
No description provided.