[PR #6262] [MERGED] fix: address private agent context, character estimates, and diagnostics #7110

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6262
Author: @SpicyMarinara
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/16/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/6254-6261-issue-sweep


📝 Commits (10+)

  • 3073602 fix(character-library): restore full-card token estimates
  • 45adf70 fix(character-library): use catalog token estimates in panel
  • 0cde2f9 chore: format character token count import
  • 2da1a13 Merge remote-tracking branch 'origin/staging' into review/6256-token-estimates
  • 364ad49 docs: record full-card token estimate fix
  • c70702a chore: track remaining issue sweep
  • 3ba2ca6 fix: separate private agent context and shorten support reports
  • e7c732d Merge branch 'review/6256-token-estimates' into fix/6254-6261-issue-sweep
  • 9490b3c Merge remote-tracking branch 'origin/staging' into fix/6254-6261-issue-sweep
  • 466bf24 Merge remote-tracking branch 'origin/staging' into review/6256-token-estimates

📊 Changes

15 files changed (+496 additions, -138 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
➕ e2e/agent-private-context.e2e.ts (+131 -0)
📝 packages/client/src/components/characters/CharacterLibraryView.tsx (+5 -2)
📝 packages/client/src/components/chat/RoleplayHUDActionsMenu.tsx (+86 -24)
📝 packages/client/src/components/panels/CharactersPanel.tsx (+3 -3)
📝 packages/client/src/lib/character-token-count.ts (+2 -88)
📝 packages/client/src/lib/support-diagnostics.ts (+1 -1)
📝 packages/client/src/localization/locales/en.json (+5 -0)
📝 packages/server/src/services/storage/agents.storage.ts (+19 -1)
📝 packages/server/src/services/storage/character-catalog.ts (+2 -18)
📝 packages/shared/src/index.ts (+1 -0)
➕ packages/shared/src/utils/character-token-estimator.ts (+83 -0)
📝 scripts/regressions/agent-previous-output.regression.ts (+43 -0)
➕ scripts/regressions/character-library-token-estimate.regression.ts (+97 -0)
📝 scripts/regressions/client-runtime-diagnostics.regression.ts (+14 -1)

📄 Description

Linked issues

Closes #6254
Closes #6255
Closes #6261
Refs #6260 (investigation only; remains open)

Why this change

An empty public agent output currently exposes the full JSON in its preview, while the editor only changes text. Private continuation context needs its own editor, and omitting it from a later response should preserve the previous value. Copied support reports also contain too many routine client events. Character Library and Characters panel estimates undercount cards because they recalculate from compact catalog data that omits card fields.

Changes

  • Reuse the existing editor for public output and private context, both inside the same spoiler. Preserve structured context, alias fields, and the other field during edits.
  • Retain omitted context from the previous successful visible turn. Explicit null/empty values still clear it; historical retries cannot read future or inactive-swipe runs.
  • Copy the latest five relevant diagnostic events, omitting routine page visibility events while retaining the full local event history.
  • Include contributor PR #6256: reuse the full-card estimator in the shared package, calculate catalog estimates from stored cards, and display those estimates in both character views.

This branch contains the exact head of contributor PR #6256 (c73f75f188991ef1a47671e81a80c001c3a5c639). Both PRs must complete their checks and review before this combined commit lands; #6256 has the required owner approval. Merge with a merge commit to retain the contributor commits and allow GitHub to mark #6256 merged through this PR. Contributor PR #6259 has already landed on staging.

Validation

  • pnpm install, baseline pnpm check, and pnpm check with both contributor changes integrated passed. All five Advanced Memory suites and both extension API/sandbox regressions also passed on the combined code.
  • Agent-context regression reproduced the missing-context failure on the baseline and passed after the fix, including alias, structured context, clearing, historical retry, swipe, edit, chat isolation, and main-prompt exclusion controls.
  • pnpm regression:prompt passed; client-runtime regression passed. The full local Node suite passed 283/284 files with the default macOS temporary path. The unchanged sibling-path guard test compares /var and /private/var; its isolated rerun passed with a canonical TMPDIR (no source change).
  • Browser checks passed for the new editor and existing grouped output controls in desktop Chromium, mobile Chromium, and mobile WebKit. Diagnostics passed all nine browser cases after filtering routine events.
  • Full hosted platform, container, Node, and browser checks passed on this combined head. The desktop navigation batch needed one retry after its unchanged history-navigation test reached the final expected state just after the overall 60-second deadline; the isolated test and full batch rerun passed.
  • Manually verify public and private editing, clearing, spoiler protection, and save errors with a real custom agent.
  • Manually compare a full character card estimate with the Character Library and both regular/folder Characters panel rows.
  • Manually copy Support Diagnostics after a reported error and confirm the shorter report contains useful recent events.

UI evidence

Before/after desktop and mobile screenshots, plus memory investigation evidence.

Claim boundaries

The editor browser fixture uses mocked run API responses; storage and prompt isolation use the real storage/executor regression. No physical-device or live-provider verification is claimed.

For #6260, a 51-message fixture reproduces the exact paired ranges only in Individual mode: shared and character-scoped records. Unified mode generates each summary once. Concurrent/repeated initialization adds no extra copies in either mode. The report omits its mode and audience labels; those are needed before changing the scopes used for impersonation and character knowledge. No change to memory storage or audience behavior is included here.


🔄 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/6262 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/16/2026 **Status:** ✅ Merged **Merged:** 9/16/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/6254-6261-issue-sweep` --- ### 📝 Commits (10+) - [`3073602`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3073602558f815a001d859b86db47078844b28cc) fix(character-library): restore full-card token estimates - [`45adf70`](https://github.com/Pasta-Devs/Marinara-Engine/commit/45adf7033b02791542a238ebb5c7fe4e60d27d4f) fix(character-library): use catalog token estimates in panel - [`0cde2f9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0cde2f98af991d53e720d2a33ab0223d8cc3f749) chore: format character token count import - [`2da1a13`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2da1a139b041f268bc67ffec304f62ba7c1fb5a8) Merge remote-tracking branch 'origin/staging' into review/6256-token-estimates - [`364ad49`](https://github.com/Pasta-Devs/Marinara-Engine/commit/364ad4994748c812e4b90572c6c42b89749cf944) docs: record full-card token estimate fix - [`c70702a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c70702a76a2b102088c01909d0d839423f6eb428) chore: track remaining issue sweep - [`3ba2ca6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ba2ca67fd78c415f63bfd6d40d204aa63d28a7f) fix: separate private agent context and shorten support reports - [`e7c732d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e7c732d1ead7bc4f3b0ea856da334b8c9a365abb) Merge branch 'review/6256-token-estimates' into fix/6254-6261-issue-sweep - [`9490b3c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9490b3c4a2c9a5024c1bb6de4ff1a72fd36248b1) Merge remote-tracking branch 'origin/staging' into fix/6254-6261-issue-sweep - [`466bf24`](https://github.com/Pasta-Devs/Marinara-Engine/commit/466bf249037f925550cefc9c0b18d0a01dc55735) Merge remote-tracking branch 'origin/staging' into review/6256-token-estimates ### 📊 Changes **15 files changed** (+496 additions, -138 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) ➕ `e2e/agent-private-context.e2e.ts` (+131 -0) 📝 `packages/client/src/components/characters/CharacterLibraryView.tsx` (+5 -2) 📝 `packages/client/src/components/chat/RoleplayHUDActionsMenu.tsx` (+86 -24) 📝 `packages/client/src/components/panels/CharactersPanel.tsx` (+3 -3) 📝 `packages/client/src/lib/character-token-count.ts` (+2 -88) 📝 `packages/client/src/lib/support-diagnostics.ts` (+1 -1) 📝 `packages/client/src/localization/locales/en.json` (+5 -0) 📝 `packages/server/src/services/storage/agents.storage.ts` (+19 -1) 📝 `packages/server/src/services/storage/character-catalog.ts` (+2 -18) 📝 `packages/shared/src/index.ts` (+1 -0) ➕ `packages/shared/src/utils/character-token-estimator.ts` (+83 -0) 📝 `scripts/regressions/agent-previous-output.regression.ts` (+43 -0) ➕ `scripts/regressions/character-library-token-estimate.regression.ts` (+97 -0) 📝 `scripts/regressions/client-runtime-diagnostics.regression.ts` (+14 -1) </details> ### 📄 Description ## Linked issues Closes #6254 Closes #6255 Closes #6261 Refs #6260 (investigation only; remains open) ## Why this change An empty public agent output currently exposes the full JSON in its preview, while the editor only changes `text`. Private continuation context needs its own editor, and omitting it from a later response should preserve the previous value. Copied support reports also contain too many routine client events. Character Library and Characters panel estimates undercount cards because they recalculate from compact catalog data that omits card fields. ## Changes - Reuse the existing editor for public output and private context, both inside the same spoiler. Preserve structured context, alias fields, and the other field during edits. - Retain omitted context from the previous successful visible turn. Explicit null/empty values still clear it; historical retries cannot read future or inactive-swipe runs. - Copy the latest five relevant diagnostic events, omitting routine page visibility events while retaining the full local event history. - Include contributor PR #6256: reuse the full-card estimator in the shared package, calculate catalog estimates from stored cards, and display those estimates in both character views. This branch contains the exact head of contributor PR #6256 (`c73f75f188991ef1a47671e81a80c001c3a5c639`). Both PRs must complete their checks and review before this combined commit lands; #6256 has the required owner approval. Merge with a merge commit to retain the contributor commits and allow GitHub to mark #6256 merged through this PR. Contributor PR #6259 has already landed on staging. ## Validation - `pnpm install`, baseline `pnpm check`, and `pnpm check` with both contributor changes integrated passed. All five Advanced Memory suites and both extension API/sandbox regressions also passed on the combined code. - Agent-context regression reproduced the missing-context failure on the baseline and passed after the fix, including alias, structured context, clearing, historical retry, swipe, edit, chat isolation, and main-prompt exclusion controls. - `pnpm regression:prompt` passed; client-runtime regression passed. The full local Node suite passed 283/284 files with the default macOS temporary path. The unchanged sibling-path guard test compares `/var` and `/private/var`; its isolated rerun passed with a canonical `TMPDIR` (no source change). - Browser checks passed for the new editor and existing grouped output controls in desktop Chromium, mobile Chromium, and mobile WebKit. Diagnostics passed all nine browser cases after filtering routine events. - Full hosted platform, container, Node, and browser checks passed on this combined head. The desktop navigation batch needed one retry after its unchanged history-navigation test reached the final expected state just after the overall 60-second deadline; the isolated test and full batch rerun passed. - [ ] Manually verify public and private editing, clearing, spoiler protection, and save errors with a real custom agent. - [ ] Manually compare a full character card estimate with the Character Library and both regular/folder Characters panel rows. - [ ] Manually copy Support Diagnostics after a reported error and confirm the shorter report contains useful recent events. ## UI evidence [Before/after desktop and mobile screenshots, plus memory investigation evidence](https://gist.github.com/SpicyMarinara/7b2a9d3887fc79b71ba7c13f98333f2e). ## Claim boundaries The editor browser fixture uses mocked run API responses; storage and prompt isolation use the real storage/executor regression. No physical-device or live-provider verification is claimed. For #6260, a 51-message fixture reproduces the exact paired ranges only in Individual mode: shared and character-scoped records. Unified mode generates each summary once. Concurrent/repeated initialization adds no extra copies in either mode. The report omits its mode and audience labels; those are needed before changing the scopes used for impersonation and character knowledge. No change to memory storage or audience behavior is included here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:16:37 +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#7110
No description provided.