[PR #2213] [MERGED] Retry malformed lorebook maker batches #5478

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2213
Author: @Promansis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Promansis

Base: refactor ← Head: fix/lorebook-maker-batch-retry


📝 Commits (5)

  • d962007 Retry malformed lorebook maker batches
  • 6884544 Buffer retry batch tokens
  • c78f6d6 Repair lorebook maker retry streaming
  • 9584087 Merge remote-tracking branch 'upstream/refactor' into repair/lorebook-maker-retry-streaming
  • ff7cb02 Fix storage atomic row clippy lint

📊 Changes

2 files changed (+74 additions, -23 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+6 -2)
📝 src/engine/generation/makers.ts (+68 -21)

📄 Description

Linked issue

Closes #2198

Why this change

  • Lorebook Maker parsed each generated batch once and continued after malformed or empty output. Legacy retried one failed batch before accepting the partial result, which made transient provider formatting failures less likely to drop entries.

What changed

  • Adds a one-retry parse recovery loop around each Lorebook Maker batch.
  • Emits a warning before the retry and preserves the existing final batch_warning event shape if the second attempt still yields no valid entries.
  • Keeps the retry inside the engine-owned maker path without changing the modal, storage API, shared API, or provider transport boundaries.

Refactor impact

Primary owner:

  • Engine generation / Lorebook Maker.

Impact areas reviewed:

  • Catalog Lorebook Maker UI event handling.
  • Shared maker request path for streaming and non-streaming LLM completions.

Boundary notes:

  • Engine-only change; no React component, storage adapter, Tauri command, or remote runtime routing changes.

Pressure points touched:

  • generateLorebookMaker batch request, parse, warning, and continuation flow.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm typecheck passed locally.
  • pnpm check passed locally.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix only; no new discoverable user workflow or setting.

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

UI evidence

  • Not applicable; engine-only retry behavior fix with no visible UI change.

🔄 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/2213 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/lorebook-maker-batch-retry` --- ### 📝 Commits (5) - [`d962007`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d96200724ed09fff410179e7882682c4bae52921) Retry malformed lorebook maker batches - [`6884544`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68845442c576f72f43573f680392056c746009a9) Buffer retry batch tokens - [`c78f6d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c78f6d6f9746fd2c2ca100694ccb09213a32fd46) Repair lorebook maker retry streaming - [`9584087`](https://github.com/Pasta-Devs/Marinara-Engine/commit/95840877c19180777c166353be7744a82c0e292c) Merge remote-tracking branch 'upstream/refactor' into repair/lorebook-maker-retry-streaming - [`ff7cb02`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ff7cb0208bd3da8fc60dc346024459ce6ca3d644) Fix storage atomic row clippy lint ### 📊 Changes **2 files changed** (+74 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+6 -2) 📝 `src/engine/generation/makers.ts` (+68 -21) </details> ### 📄 Description ## Linked issue Closes #2198 ## Why this change - Lorebook Maker parsed each generated batch once and continued after malformed or empty output. Legacy retried one failed batch before accepting the partial result, which made transient provider formatting failures less likely to drop entries. ## What changed - Adds a one-retry parse recovery loop around each Lorebook Maker batch. - Emits a warning before the retry and preserves the existing final `batch_warning` event shape if the second attempt still yields no valid entries. - Keeps the retry inside the engine-owned maker path without changing the modal, storage API, shared API, or provider transport boundaries. ## Refactor impact Primary owner: - Engine generation / Lorebook Maker. Impact areas reviewed: - Catalog Lorebook Maker UI event handling. - Shared maker request path for streaming and non-streaming LLM completions. Boundary notes: - Engine-only change; no React component, storage adapter, Tauri command, or remote runtime routing changes. Pressure points touched: - `generateLorebookMaker` batch request, parse, warning, and continuation flow. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `pnpm typecheck` passed locally. - `pnpm check` passed locally. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix only; no new discoverable user workflow or setting. ## Docs and release impact - [x] 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 ## UI evidence - Not applicable; engine-only retry behavior fix with no visible UI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:41 +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#5478
No description provided.