[PR #2093] [MERGED] fix(otome-forge): 0.7.6 caching follow-ups from the second review round (0.8.1) #2113

Closed
opened 2026-11-07 16:39:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/2093
Author: @SpicyMarinara
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/otome-cache-followups


📝 Commits (1)

  • 261e450 fix(otome-forge): the 0.7.6 caching follow-ups from the second review round (0.8.1)

📊 Changes

20 files changed (+367 additions, -144 deletions)

View changed files

➕ artifacts/otome-forge-0.8.1.zip (+0 -0)
📝 catalog/preview/catalog.json (+6 -6)
📝 catalog/preview/notes.json (+6 -6)
📝 catalog/preview/v2/catalog.json (+6 -6)
📝 catalog/preview/v2/notes.json (+6 -6)
📝 catalog/preview/v3/catalog.json (+6 -6)
📝 catalog/preview/v3/notes.json (+6 -6)
📝 packages/otome-forge/CHANGELOG.md (+5 -0)
📝 packages/otome-forge/manifest.json (+3 -3)
📝 packages/otome-forge/server.mjs (+57 -57)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/generation.ts (+8 -6)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/memory/memory.ts (+5 -5)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/memory/timeline.ts (+1 -1)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/prompts.ts (+25 -15)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/story/canon.ts (+18 -12)
📝 packages/otome-forge/src/engine/packages/server/src/services/otome-forge/story/chapters.ts (+9 -1)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/otome-forge-beats.regression.ts (+117 -3)
📝 tests/otome-forge-generation.regression.ts (+34 -0)
📝 tests/otome-forge-memory-audience.regression.ts (+48 -4)

📄 Description

Pull request

Linked issue

Closes #2094 (follow-up to #2091 and #2092)

Why this change

#2092 (0.7.6, merged) made Otome Hearth's prompt cache stable across a chapter. A second local review round on it, with five lenses and every finding adversarially verified, finished after the merge. It confirmed one real story-continuity defect and a few smaller costs and test gaps, all fixed here.

What changed

  • Love interests keep their own side stories while memory catches up. When the story memory isn't ready yet, Otome uses the canonical history. A cached prompt's private part (another love interest's own chapters and dates) only got what the shared part left of the history's bound. The shared chapter that didn't fit was charged against it too. So of a love interest's dates and private chapters played since the previous chapter, only the newest reached his own scenes. Each part now has its own bound, newest first. A ponytail: note says the two parts can together hold twice the bound while memory isn't ready.
  • No hour-long cache paid for nothing. P5 (the chapter plan) marked its story context even when plans run on a different connection from the scenes, so it paid the 2× write and nothing could read it. It now marks nothing in that case. The check is resolveConnectionId(world, "structured") === resolveConnectionId(world, "narration").
  • Docs:
    • Removed mentions of the old apart option.
    • Updated the generation header's give-way order.
    • Softened "never repeats", with a pointer to the timeline's ponytail: note.
    • Fixed that note's end condition.
    • Added a ponytail: note: private canon told after the cached part is no longer in story order among the rest.
  • Version 0.8.1, with release notes, rebuilt bundle, catalogs and artifact.

Package and security impact

  • Affected package IDs: otome-forge (0.8.0 → 0.8.1)
  • Engine compatibility impact: none (capability API floor unchanged at 1.386; cacheTtl still needs 1.815 and is ignored by older Engines)
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none (no stored data changes)

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • With memory still summarizing right after a date, play a main-chapter scene with that love interest. Check the debug log: the date is in the scene's last message.
  • With a different connection for planning than for narration, start a main chapter. Check the plan's debug log shows no cache marks or cache use.

Agent-run checks (for reference):

  • pnpm test:otome-forge: 650 + 13 pass, 0 fail.
  • node scripts/typecheck-packages.mjs otome-forge: no strict errors.
  • ESLint and Prettier on the changed files: no errors. Four existing unused-variable warnings remain in chapters.ts.
  • New regressions, each checked to fail when its fix or wiring is removed:
    • a cached prompt's own canon has a bound of its own in the canonical history: both of a love interest's dates played after the previous chapter stay. It fails on the 0.7.6 code.
    • in his own route chapter, a love interest's own canon is cached with the rest: his date sits in every scene's messages[0]. It fails if side chapters stop passing li.
    • a cached prompt's own canon gives way before the cached part's summaries: the fitter's recalls-first order. It fails if the order is reverted.
    • The cached-prefix test now has the Lead's own route chapter, which pins P5's cached wiring.
    • The split test checks that each part keeps its own newest summary.
    • A builder test pins which messages P5, P6, P12 and P12c mark, including P5 on its own connection.

Not changed (reviewed and left, with reasons):

  • Readiness still depends on the cast. Memory readiness can still depend on the cast (two unsummarized dates) or on the job's connection. This is documented as a ponytail: and is unchanged from before 0.7.6.
  • The fitter near the reply floor. Near the reply floor, the fitter can rewrite the cached context per call. That was there before this branch, and the maintainer chose to skip fitter changes.
  • One small cache write on the last scene. The last scene's newest settled-scene mark writes one scene's worth of cache that nothing reads. That's small (about one scene at 2×) and was left as is.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

UI evidence (if applicable)

Not applicable: no UI change.

🤖 Generated with Claude Code


🔄 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-Agents/pull/2093 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/3/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/otome-cache-followups` --- ### 📝 Commits (1) - [`261e450`](https://github.com/Pasta-Devs/Marinara-Agents/commit/261e4500da9223b78391af5cd5189d034119ce96) fix(otome-forge): the 0.7.6 caching follow-ups from the second review round (0.8.1) ### 📊 Changes **20 files changed** (+367 additions, -144 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/otome-forge-0.8.1.zip` (+0 -0) 📝 `catalog/preview/catalog.json` (+6 -6) 📝 `catalog/preview/notes.json` (+6 -6) 📝 `catalog/preview/v2/catalog.json` (+6 -6) 📝 `catalog/preview/v2/notes.json` (+6 -6) 📝 `catalog/preview/v3/catalog.json` (+6 -6) 📝 `catalog/preview/v3/notes.json` (+6 -6) 📝 `packages/otome-forge/CHANGELOG.md` (+5 -0) 📝 `packages/otome-forge/manifest.json` (+3 -3) 📝 `packages/otome-forge/server.mjs` (+57 -57) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/generation.ts` (+8 -6) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/memory/memory.ts` (+5 -5) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/memory/timeline.ts` (+1 -1) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/prompts.ts` (+25 -15) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/story/canon.ts` (+18 -12) 📝 `packages/otome-forge/src/engine/packages/server/src/services/otome-forge/story/chapters.ts` (+9 -1) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/otome-forge-beats.regression.ts` (+117 -3) 📝 `tests/otome-forge-generation.regression.ts` (+34 -0) 📝 `tests/otome-forge-memory-audience.regression.ts` (+48 -4) </details> ### 📄 Description # Pull request ## Linked issue Closes #2094 (follow-up to #2091 and #2092) ## Why this change #2092 (0.7.6, merged) made Otome Hearth's prompt cache stable across a chapter. A second local review round on it, with five lenses and every finding adversarially verified, finished after the merge. It confirmed one real story-continuity defect and a few smaller costs and test gaps, all fixed here. ## What changed - **Love interests keep their own side stories while memory catches up.** When the story memory isn't ready yet, Otome uses the canonical history. A cached prompt's private part (another love interest's own chapters and dates) only got what the shared part left of the history's bound. The shared chapter that didn't fit was charged against it too. So of a love interest's dates and private chapters played since the previous chapter, only the newest reached his own scenes. Each part now has its own bound, newest first. A `ponytail:` note says the two parts can together hold twice the bound while memory isn't ready. - **No hour-long cache paid for nothing.** P5 (the chapter plan) marked its story context even when plans run on a different connection from the scenes, so it paid the 2× write and nothing could read it. It now marks nothing in that case. The check is `resolveConnectionId(world, "structured") === resolveConnectionId(world, "narration")`. - **Docs:** - Removed mentions of the old `apart` option. - Updated the generation header's give-way order. - Softened "never repeats", with a pointer to the timeline's `ponytail:` note. - Fixed that note's end condition. - Added a `ponytail:` note: private canon told after the cached part is no longer in story order among the rest. - Version 0.8.1, with release notes, rebuilt bundle, catalogs and artifact. ## Package and security impact - Affected package IDs: `otome-forge` (0.8.0 → 0.8.1) - Engine compatibility impact: none (capability API floor unchanged at 1.386; `cacheTtl` still needs 1.815 and is ignored by older Engines) - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none (no stored data changes) ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - [ ] With memory still summarizing right after a date, play a main-chapter scene with that love interest. Check the debug log: the date is in the scene's last message. - [ ] With a different connection for planning than for narration, start a main chapter. Check the plan's debug log shows no cache marks or cache use. Agent-run checks (for reference): - `pnpm test:otome-forge`: 650 + 13 pass, 0 fail. - `node scripts/typecheck-packages.mjs otome-forge`: no strict errors. - ESLint and Prettier on the changed files: no errors. Four existing unused-variable warnings remain in `chapters.ts`. - New regressions, each checked to fail when its fix or wiring is removed: - `a cached prompt's own canon has a bound of its own in the canonical history`: both of a love interest's dates played after the previous chapter stay. It fails on the 0.7.6 code. - `in his own route chapter, a love interest's own canon is cached with the rest`: his date sits in every scene's messages[0]. It fails if side chapters stop passing `li`. - `a cached prompt's own canon gives way before the cached part's summaries`: the fitter's recalls-first order. It fails if the order is reverted. - The cached-prefix test now has the Lead's own route chapter, which pins P5's `cached` wiring. - The split test checks that each part keeps its own newest summary. - A builder test pins which messages P5, P6, P12 and P12c mark, including P5 on its own connection. **Not changed (reviewed and left, with reasons):** - **Readiness still depends on the cast.** Memory readiness can still depend on the cast (two unsummarized dates) or on the job's connection. This is documented as a `ponytail:` and is unchanged from before 0.7.6. - **The fitter near the reply floor.** Near the reply floor, the fitter can rewrite the cached context per call. That was there before this branch, and the maintainer chose to skip fitter changes. - **One small cache write on the last scene.** The last scene's newest settled-scene mark writes one scene's worth of cache that nothing reads. That's small (about one scene at 2×) and was left as is. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation ## UI evidence (if applicable) Not applicable: no UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:39:35 +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-Agents#2113
No description provided.