[PR #7267] [MERGED] fix(memory): only show the decision recall the inspected character can access #7653

Closed
opened 2026-10-24 04:06:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7267
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/decision-recall-accessible-only


📝 Commits (1)

  • 37959d3 fix(memory): show each character's own decision recall in the inspector

📊 Changes

10 files changed (+110 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+8 -2)
📝 packages/client/src/components/chat/DecisionDebugPanel.tsx (+6 -1)
📝 packages/client/src/components/chat/PeekPromptModal.tsx (+3 -1)
📝 packages/client/src/components/chat/chat-area.types.ts (+2 -0)
📝 packages/client/src/hooks/use-decision-debug.ts (+4 -2)
📝 packages/client/src/localization/locales/en.json (+2 -1)
📝 packages/server/src/routes/generate/dry-run-route.ts (+3 -0)
📝 scripts/regressions/advanced-memory-post-generation.regression.ts (+59 -0)
📝 scripts/regressions/advanced-memory-recall-shortlist.regression.ts (+22 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7264

Why this change

  • Mari tested an individual Roleplay group chat (characters reply one by one) with Advanced Memory and Use Decision model set to Jev. She added Cyno, whose knowledge starts where he joined. His prompt correctly had no older scenes, but Peek Prompt's Decision diagnostics still showed Jev scoring scene summaries. That looked like wasted Decision calls and a recall that offers characters memories they cannot access.
  • Recall itself was already correct. A fake Jev provider recorded 0 memory requests for Cyno's turn, and his receipt said no-recall-candidates. Access filtering (knowledge starts, per-reader visibility, scene audience, live overlap) already runs before both Decision passes from #7187, so no inaccessible summary can reach a call made for him.
  • The inspector misattributed the report in two ways:
    1. dry-run-route.ts showed the newest saved decisionRecall in the whole chat. Cyno's receipt has none because he had nothing to recall, so the inspector skipped it and showed Tighnari's or Maukie's report, with their scene summaries.
    2. The Decision diagnostics panel never sent the inspected reply's character. In an individual Advanced Memory chat the preview fell back to the first character in the chat, so inspecting Cyno's reply previewed Maukie's turn.

What changed

  • Server (packages/server/src/routes/generate/dry-run-route.ts): in individual group chats, the saved recall report comes only from the previewed character's own replies. Merged and single-character chats keep today's behaviour, so the existing post-generation pin (report equals status().latestReceipt.decisionRecall) still holds.
  • Client: Peek Prompt on a reply in an individual group chat remembers that reply's character (ChatArea.tsx, chat-area.types.ts). PeekPromptModal passes it to DecisionDebugPanel, and useDecisionDebug sends it as forCharacterId. Preview inputs and Test decisions now preview the inspected character instead of the first character in the chat. The header live preview, with no message selected, is unchanged.
  • Copy (en.json only): the memory scope note says that, when characters reply one by one, recall shows only this character's own. A new line explains a missing recall when only a scene check is saved: "No saved recall yet. The Decision model is asked only when there are earlier scenes to recall."
  • Regressions (no new test files):
    • advanced-memory-recall-shortlist: the existing chat becomes an individual group with a newcomer whose knowledge starts at the conversation start. Kaito's turn still makes its 2 Jev passes. Cyno's turn makes 0 state.memories requests, returns no-recall-candidates, saves no decisionRecall, and keeps exactly his 3 live messages. This pins the access invariant through the real prepare.
    • advanced-memory-post-generation: an individual chat with Dottore (whose reply carries a real Jev recall report) and newcomer Cyno (whose later receipt has none). dryRun inspect for Cyno returns no recall, inspect for Dottore returns his own, and neither calls a provider. This fails on origin/staging with Cyno is not shown Dottore's recalled scenes.
  • CHANGELOG.md entry at the top of [Unreleased].
  • Recall selection, access filters, and "decide each message once" are not touched.

Decision prompt and inspector, before and after

The Jev calls are the same before and after; only what the inspector attributes to whom changes.

Jev memory requests, from a throwaway reproduction with a fake /v1/systemone provider (individual chat, 4 summarized scenes before Cyno joined). The shortlist regression now pins the same counts with Kaito and Cyno:

Turn Before After
Tighnari 2 requests. Pass 1 state: {"respondingCharacters":["Tighnari"],"memories":4,…} with "Scene 0: Maukie and Tighnari searched for the lost lantern…"; pass 2: 9 messages from the chosen scenes unchanged
Cyno (knowledge from joining) 0 requests, reasons ["no-recall-candidates"] 0 requests, reasons ["no-recall-candidates"] (now pinned)

POST /api/generate/dryRun with decisionDebug: "inspect" while inspecting Cyno's reply:

Before (decisionDebug.advancedMemory.recall, from the regression on origin/staging, which is Dottore's report):

{
  "fallback": false,
  "threshold": 0.5,
  "results": [
    { "kind": "scene", "text": "ARCHIVED_RECAP: The silver compass promise guided the travelers.", "score": 0.99, "selected": true },
    { "kind": "scene", "text": "ARCHIVED_RECAP: The silver compass promise guided the travelers.", "score": 0.99, "selected": true }
  ]
}

After: recall is absent for Cyno. The panel shows only the chat's scene-end check, plus "No saved recall yet. The Decision model is asked only when there are earlier scenes to recall." Inspecting Dottore's reply still returns his own report unchanged.

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

Agent-run commands (results reported here; the boxes above are left for the human reviewer):

  • pnpm check: exit 0
  • pnpm localization:check: exit 0
  • All 15 advanced-memory-* regressions, memory-recall-exclusivity, memory-recall-revectorize, roleplay-user-private-memory: passed
  • pnpm regression:prompt (prompt, prompt-attachments, context-fit): passed
  • advanced-memory-post-generation fails on origin/staging before the fix and passes after it
  • Local CodeRabbit (coderabbit review --agent --committed --base-commit 6c9c372bf): completed and reviewed all 10 changed files. It reported 0 findings, with status completed_with_warnings ("Review completed with unverified findings") and no finding entries. Two earlier attempts hit the shared rate limit, and this run finished after the PR had already merged.

Manual verification notes

  • Manually verify in an individual Roleplay group chat with Advanced Memory and Use Decision model on: let two characters play a few summarized scenes, add a third character whose knowledge starts when they join, and let each reply once.
  • Manually verify that Peek Prompt on the newcomer's reply, then Decision diagnostics, shows no "Latest recalled scenes and messages" section and shows the "No saved recall yet" line under the scene-end check.
  • Manually verify that Peek Prompt on an older character's reply shows that character's own recalled scenes and messages, and that the scene summaries listed are ones they took part in.
  • Manually verify that Preview inputs and Test decisions opened from a reply preview that reply's character, for example a character-specific {{decide}} statement or lorebook decision.
  • Manually verify with the server debug log on (DEBUG_AGENTS=true or Debug mode) that no [decision] … request with "respondingCharacters":["<newcomer>"] carries memories for the newcomer's turn.
  • Manually verify that a merged group chat and a single-character chat still show the latest recall in Decision diagnostics as before.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs/ guide changed. CHANGELOG.md has a new [Unreleased] entry.

UI evidence (if applicable)

Not captured. The Decision diagnostics panel change is copy and data scoping only.


🔄 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/7267 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/decision-recall-accessible-only` --- ### 📝 Commits (1) - [`37959d3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/37959d35fcaa56bd78b2407b3abe5ccc301520fd) fix(memory): show each character's own decision recall in the inspector ### 📊 Changes **10 files changed** (+110 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+8 -2) 📝 `packages/client/src/components/chat/DecisionDebugPanel.tsx` (+6 -1) 📝 `packages/client/src/components/chat/PeekPromptModal.tsx` (+3 -1) 📝 `packages/client/src/components/chat/chat-area.types.ts` (+2 -0) 📝 `packages/client/src/hooks/use-decision-debug.ts` (+4 -2) 📝 `packages/client/src/localization/locales/en.json` (+2 -1) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+3 -0) 📝 `scripts/regressions/advanced-memory-post-generation.regression.ts` (+59 -0) 📝 `scripts/regressions/advanced-memory-recall-shortlist.regression.ts` (+22 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7264 ## Why this change - Mari tested an individual Roleplay group chat (characters reply one by one) with Advanced Memory and **Use Decision model** set to Jev. She added Cyno, whose knowledge starts where he joined. His prompt correctly had no older scenes, but Peek Prompt's **Decision diagnostics** still showed Jev scoring scene summaries. That looked like wasted Decision calls and a recall that offers characters memories they cannot access. - Recall itself was already correct. A fake Jev provider recorded **0** memory requests for Cyno's turn, and his receipt said `no-recall-candidates`. Access filtering (knowledge starts, per-reader visibility, scene audience, live overlap) already runs before both Decision passes from #7187, so no inaccessible summary can reach a call made for him. - The inspector misattributed the report in two ways: 1. `dry-run-route.ts` showed the newest saved `decisionRecall` in the **whole chat**. Cyno's receipt has none because he had nothing to recall, so the inspector skipped it and showed Tighnari's or Maukie's report, with their scene summaries. 2. The Decision diagnostics panel never sent the inspected reply's character. In an individual Advanced Memory chat the preview fell back to the first character in the chat, so inspecting Cyno's reply previewed Maukie's turn. ## What changed - **Server** (`packages/server/src/routes/generate/dry-run-route.ts`): in individual group chats, the saved recall report comes only from the previewed character's own replies. Merged and single-character chats keep today's behaviour, so the existing post-generation pin (report equals `status().latestReceipt.decisionRecall`) still holds. - **Client**: Peek Prompt on a reply in an individual group chat remembers that reply's character (`ChatArea.tsx`, `chat-area.types.ts`). `PeekPromptModal` passes it to `DecisionDebugPanel`, and `useDecisionDebug` sends it as `forCharacterId`. **Preview inputs** and **Test decisions** now preview the inspected character instead of the first character in the chat. The header live preview, with no message selected, is unchanged. - **Copy** (`en.json` only): the memory scope note says that, when characters reply one by one, recall shows only this character's own. A new line explains a missing recall when only a scene check is saved: "No saved recall yet. The Decision model is asked only when there are earlier scenes to recall." - **Regressions** (no new test files): - `advanced-memory-recall-shortlist`: the existing chat becomes an individual group with a newcomer whose knowledge starts at the conversation start. Kaito's turn still makes its 2 Jev passes. Cyno's turn makes **0** `state.memories` requests, returns `no-recall-candidates`, saves no `decisionRecall`, and keeps exactly his 3 live messages. This pins the access invariant through the real `prepare`. - `advanced-memory-post-generation`: an individual chat with Dottore (whose reply carries a real Jev recall report) and newcomer Cyno (whose later receipt has none). `dryRun` inspect for Cyno returns no recall, inspect for Dottore returns his own, and neither calls a provider. **This fails on `origin/staging`** with `Cyno is not shown Dottore's recalled scenes`. - `CHANGELOG.md` entry at the top of `[Unreleased]`. - Recall selection, access filters, and "decide each message once" are not touched. ### Decision prompt and inspector, before and after The Jev calls are the same before and after; only what the inspector attributes to whom changes. Jev memory requests, from a throwaway reproduction with a fake `/v1/systemone` provider (individual chat, 4 summarized scenes before Cyno joined). The shortlist regression now pins the same counts with Kaito and Cyno: | Turn | Before | After | | --- | --- | --- | | Tighnari | 2 requests. Pass 1 `state`: `{"respondingCharacters":["Tighnari"],"memories":4,…}` with `"Scene 0: Maukie and Tighnari searched for the lost lantern…"`; pass 2: 9 messages from the chosen scenes | unchanged | | Cyno (knowledge from joining) | **0** requests, reasons `["no-recall-candidates"]` | **0** requests, reasons `["no-recall-candidates"]` (now pinned) | `POST /api/generate/dryRun` with `decisionDebug: "inspect"` while inspecting Cyno's reply: Before (`decisionDebug.advancedMemory.recall`, from the regression on `origin/staging`, which is Dottore's report): ```json { "fallback": false, "threshold": 0.5, "results": [ { "kind": "scene", "text": "ARCHIVED_RECAP: The silver compass promise guided the travelers.", "score": 0.99, "selected": true }, { "kind": "scene", "text": "ARCHIVED_RECAP: The silver compass promise guided the travelers.", "score": 0.99, "selected": true } ] } ``` After: `recall` is absent for Cyno. The panel shows only the chat's scene-end check, plus "No saved recall yet. The Decision model is asked only when there are earlier scenes to recall." Inspecting Dottore's reply still returns his own report unchanged. ## 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` Agent-run commands (results reported here; the boxes above are left for the human reviewer): - `pnpm check`: exit 0 - `pnpm localization:check`: exit 0 - All 15 `advanced-memory-*` regressions, `memory-recall-exclusivity`, `memory-recall-revectorize`, `roleplay-user-private-memory`: passed - `pnpm regression:prompt` (prompt, prompt-attachments, context-fit): passed - `advanced-memory-post-generation` fails on `origin/staging` before the fix and passes after it - Local CodeRabbit (`coderabbit review --agent --committed --base-commit 6c9c372bf`): completed and reviewed all 10 changed files. It reported 0 findings, with status `completed_with_warnings` ("Review completed with unverified findings") and no finding entries. Two earlier attempts hit the shared rate limit, and this run finished after the PR had already merged. ### Manual verification notes - Manually verify in an individual Roleplay group chat with Advanced Memory and Use Decision model on: let two characters play a few summarized scenes, add a third character whose knowledge starts when they join, and let each reply once. - Manually verify that **Peek Prompt** on the newcomer's reply, then **Decision diagnostics**, shows no "Latest recalled scenes and messages" section and shows the "No saved recall yet" line under the scene-end check. - Manually verify that **Peek Prompt** on an older character's reply shows that character's own recalled scenes and messages, and that the scene summaries listed are ones they took part in. - Manually verify that **Preview inputs** and **Test decisions** opened from a reply preview that reply's character, for example a character-specific `{{decide}}` statement or lorebook decision. - Manually verify with the server debug log on (`DEBUG_AGENTS=true` or Debug mode) that no `[decision] … request` with `"respondingCharacters":["<newcomer>"]` carries `memories` for the newcomer's turn. - Manually verify that a merged group chat and a single-character chat still show the latest recall in Decision diagnostics as before. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No `docs/` guide changed. `CHANGELOG.md` has a new `[Unreleased]` entry. ## UI evidence (if applicable) Not captured. The Decision diagnostics panel change is copy and data scoping only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:12 +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#7653
No description provided.