[PR #6666] [MERGED] feat: inspect and test Decision model results in Peek Prompt #7279

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6666
Author: @kolacheee
Created: 9/25/2026
Status: ✅ Merged
Merged: 9/25/2026
Merged by: @kolacheee

Base: staging ← Head: codex/6650-decision-debug


📝 Commits (6)

  • 23b2255 docs: scope decision diagnostics for #6650
  • 5e352a0 feat: inspect and test Decision model outcomes in Peek Prompt
  • c9cb31c Merge staging and preserve both changelog entries
  • e3f0e2b fix(decision): test deferred models and verify prompt switching
  • f4b2bb8 test: handle restored lorebook editor in filter checks
  • 86da7db Merge branch 'staging' into codex/6650-decision-debug

📊 Changes

21 files changed (+1101 additions, -181 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/chats/peek-prompt.md (+16 -0)
📝 docs/connections/decision-models.md (+2 -1)
📝 docs/prompts/conditional-prompts.md (+2 -2)
📝 e2e/core-flows.e2e.ts (+5 -1)
📝 e2e/decision-peek-report.e2e.ts (+194 -85)
📝 packages/client/src/components/chat/ChatArea.tsx (+1 -1)
➕ packages/client/src/components/chat/DecisionDebugPanel.tsx (+157 -0)
📝 packages/client/src/components/chat/PeekPromptModal.tsx (+42 -3)
📝 packages/client/src/components/chat/chat-area.types.ts (+1 -0)
➕ packages/client/src/hooks/use-decision-debug.ts (+31 -0)
📝 packages/client/src/localization/locales/en.json (+39 -0)
📝 packages/server/src/routes/generate/dry-run-route.ts (+90 -16)
📝 packages/server/src/services/decision/decision-default.ts (+47 -8)
📝 packages/server/src/services/decision/decision-slots.ts (+18 -14)
📝 packages/server/src/services/decision/prompt-decisions.ts (+97 -23)
📝 packages/server/src/services/decision/sidecar-decision.backend.ts (+65 -23)
📝 packages/server/src/services/decision/system-one.client.ts (+25 -1)
📝 packages/shared/src/index.ts (+1 -0)
➕ packages/shared/src/types/decision-debug.ts (+44 -0)

...and 1 more files

📄 Description

Linked issue

Closes #6650

Why this change

Decision trees currently expose the branch that ran but not the score that selected it. This makes Jev decisions in Game Mode and other prompt conditionals difficult to troubleshoot. Peek Prompt also needs an explicit way to test current questions without generating a reply or changing the live chat's answers.

What changed

  • Debug Mode now logs Decision request bodies, returned scores or choices, thresholds, and outcomes. Local models that return only a yes/no word are identified as binary answers, without presenting a synthetic probability.
  • Peek Prompt has a Decision diagnostics panel. Opening it prepares the actual request bodies without contacting or starting a model. Test decisions makes real Decision requests, shows results and failures, and assembles a test prompt from those answers. The UI explains hosted request costs and offers the original/tested prompt switch.
  • Tests use the current chat and settings, a separate answer cache, and read-only timer snapshots. They do not generate chat replies, run agents, save timers, teach the local Auto-thinking cache, or replace the historical prompt. Initial scope is prompt/lorebook decisions; agent activation and post-reply decisions are excluded.
  • Added localized English copy, user documentation, a changelog entry, server regression coverage, and browser coverage for passive inspection, explicit runs, prompt provenance, missing models, empty results, errors, and mobile layout.

Validation

The checkboxes below remain unchecked for the human contributor, as required by the repository.

  • 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

Recorded automated results:

  • pnpm check passed, including localization, formatting, type checks, lint, and the production build.
  • node scripts/run-regressions.mjs --filter decision: 9 suites passed. Real HTTP fixtures verify prepared/sent request equality, high/low outcomes, fresh reruns, unchanged live caches/messages/metadata, absent main-model calls, invalid request rejection, and binary local results.
  • pnpm regression:prompt passed.
  • pnpm smoke:ui e2e/decision-*.e2e.ts e2e/agent-activation-questions.e2e.ts --workers=1: 39 passed across desktop Chromium, mobile Chromium, and mobile WebKit (container supplied the WebKit system libraries).
  • Podman production image built and started with temporary empty storage; /api/health returned status: ok.
  • Local CodeRabbit review of commit 5e352a0d0 against origin/staging completed: 0 findings across all 20 changed files. The subsequent staging merge only needed a changelog conflict resolution; both entries were retained and feature code was unchanged.

The full local UI sweep was stopped after parallel test-fixture failures; it is not claimed as passing. The agent-activation and Game setup failures passed when rerun in isolation on both this branch and unchanged staging. The affected Decision browser lane runs serially, and the full GitHub regression matrix remains a merge gate.

Review and Chromium 5/10 follow-up

Addressed both findings in review 5320264195. Explicit tests now run normally deferred local reasoning models without changing live settings; unavailable models remain disabled. Browser assertions expand and verify the tested prompt content, verify it disappears with the original prompt, and verify it returns when switching back.

The desktop Chromium 5/10 failure reproduced locally in the existing Lorebook filter-chip test. Reload restores the editor, so its heading and hidden library row both matched the old locator. The test now waits for the visible editor or library view and only selects the library row when needed.

Follow-up validation: pnpm check, all 9 Decision regression suites, and pnpm regression:prompt passed. All 6 updated Decision browser cases passed across desktop Chromium, mobile Chromium and mobile WebKit. The final Lorebook test passed twice consecutively. Local CodeRabbit found one test-cleanup issue; it was fixed, and the rerun reported 0 findings across the 7 follow-up files.

Manual verification notes

Automated browser interactions were visually inspected in desktop dark/light and mobile layouts. Screenshot data is synthetic; server transport behavior is verified separately with local HTTP fixtures.

  • Manually verify a real Jev connection in Game Mode: inspect the prepared request, run decisions, compare scores and branches, and confirm chat/game state is unchanged.
  • Manually verify a supported local Decision model on real hardware, including cancellation during cold startup.
  • Manually verify opening an exact saved prompt, running a current-state test, and switching back preserves the saved request.

Paid hosted Jev and GPU-backed local inference were not exercised locally.

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
  • Version/release files updated (only if this PR includes a version bump)

Updated Peek Prompt, Decision Models, and Conditional Prompts documentation plus CHANGELOG.md. Translation follow-up: #6667. No version bump.

UI evidence (if applicable)

Before/after evidence is stored outside the source tree in the PR evidence gist.

Before (staging) After (desktop, dark)
Original Peek Prompt Decision diagnostics with actual result fields

Desktop light · Mobile dark · Mobile light. Mobile captures are scrolled to the result list and original-prompt switch.

Summary by CodeRabbit

  • New Features

    • Peek Prompt now offers decision diagnostics: inspect prepared requests or test eligible decisions with the selected model, then switch between the tested and original prompt.
    • Decision debug output includes scores, thresholds, outcomes, and request details.
    • Inspection does not call the model; explicit tests do not generate replies or change live chat decisions. Hosted-model tests may incur charges.
  • Documentation

    • Updated guides explain how to inspect and test decisions, interpret results, and understand testing limitations.

🔄 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/6666 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/25/2026 **Status:** ✅ Merged **Merged:** 9/25/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `codex/6650-decision-debug` --- ### 📝 Commits (6) - [`23b2255`](https://github.com/Pasta-Devs/Marinara-Engine/commit/23b22558ee285603893a453f018f8ad964ef6769) docs: scope decision diagnostics for #6650 - [`5e352a0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5e352a0d0187820e00c34aa096641abb4424941e) feat: inspect and test Decision model outcomes in Peek Prompt - [`c9cb31c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c9cb31cd4c523ef2d1dcc32a7ba99b1d083976f3) Merge staging and preserve both changelog entries - [`e3f0e2b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e3f0e2b6d7abb75e43016b331e5b6eca06162044) fix(decision): test deferred models and verify prompt switching - [`f4b2bb8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f4b2bb85188357fe0ed2f9ca1f1111df3b298b66) test: handle restored lorebook editor in filter checks - [`86da7db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/86da7db509871f03ba0cd4c0c9865c11a101f391) Merge branch 'staging' into codex/6650-decision-debug ### 📊 Changes **21 files changed** (+1101 additions, -181 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/chats/peek-prompt.md` (+16 -0) 📝 `docs/connections/decision-models.md` (+2 -1) 📝 `docs/prompts/conditional-prompts.md` (+2 -2) 📝 `e2e/core-flows.e2e.ts` (+5 -1) 📝 `e2e/decision-peek-report.e2e.ts` (+194 -85) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+1 -1) ➕ `packages/client/src/components/chat/DecisionDebugPanel.tsx` (+157 -0) 📝 `packages/client/src/components/chat/PeekPromptModal.tsx` (+42 -3) 📝 `packages/client/src/components/chat/chat-area.types.ts` (+1 -0) ➕ `packages/client/src/hooks/use-decision-debug.ts` (+31 -0) 📝 `packages/client/src/localization/locales/en.json` (+39 -0) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+90 -16) 📝 `packages/server/src/services/decision/decision-default.ts` (+47 -8) 📝 `packages/server/src/services/decision/decision-slots.ts` (+18 -14) 📝 `packages/server/src/services/decision/prompt-decisions.ts` (+97 -23) 📝 `packages/server/src/services/decision/sidecar-decision.backend.ts` (+65 -23) 📝 `packages/server/src/services/decision/system-one.client.ts` (+25 -1) 📝 `packages/shared/src/index.ts` (+1 -0) ➕ `packages/shared/src/types/decision-debug.ts` (+44 -0) _...and 1 more files_ </details> ### 📄 Description ## Linked issue Closes #6650 ## Why this change Decision trees currently expose the branch that ran but not the score that selected it. This makes Jev decisions in Game Mode and other prompt conditionals difficult to troubleshoot. Peek Prompt also needs an explicit way to test current questions without generating a reply or changing the live chat's answers. ## What changed - Debug Mode now logs Decision request bodies, returned scores or choices, thresholds, and outcomes. Local models that return only a yes/no word are identified as binary answers, without presenting a synthetic probability. - Peek Prompt has a **Decision diagnostics** panel. Opening it prepares the actual request bodies without contacting or starting a model. **Test decisions** makes real Decision requests, shows results and failures, and assembles a test prompt from those answers. The UI explains hosted request costs and offers the original/tested prompt switch. - Tests use the current chat and settings, a separate answer cache, and read-only timer snapshots. They do not generate chat replies, run agents, save timers, teach the local Auto-thinking cache, or replace the historical prompt. Initial scope is prompt/lorebook decisions; agent activation and post-reply decisions are excluded. - Added localized English copy, user documentation, a changelog entry, server regression coverage, and browser coverage for passive inspection, explicit runs, prompt provenance, missing models, empty results, errors, and mobile layout. ## Validation The checkboxes below remain unchecked for the human contributor, as required by the repository. - [ ] `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` Recorded automated results: - `pnpm check` passed, including localization, formatting, type checks, lint, and the production build. - `node scripts/run-regressions.mjs --filter decision`: 9 suites passed. Real HTTP fixtures verify prepared/sent request equality, high/low outcomes, fresh reruns, unchanged live caches/messages/metadata, absent main-model calls, invalid request rejection, and binary local results. - `pnpm regression:prompt` passed. - `pnpm smoke:ui e2e/decision-*.e2e.ts e2e/agent-activation-questions.e2e.ts --workers=1`: **39 passed** across desktop Chromium, mobile Chromium, and mobile WebKit (container supplied the WebKit system libraries). - Podman production image built and started with temporary empty storage; `/api/health` returned `status: ok`. - Local CodeRabbit review of commit `5e352a0d0` against `origin/staging` completed: **0 findings across all 20 changed files**. The subsequent staging merge only needed a changelog conflict resolution; both entries were retained and feature code was unchanged. The full local UI sweep was stopped after parallel test-fixture failures; it is **not claimed as passing**. The agent-activation and Game setup failures passed when rerun in isolation on both this branch and unchanged staging. The affected Decision browser lane runs serially, and the full GitHub regression matrix remains a merge gate. ### Review and Chromium 5/10 follow-up Addressed both findings in [review 5320264195](https://github.com/Pasta-Devs/Marinara-Engine/pull/6666#pullrequestreview-5320264195). Explicit tests now run normally deferred local reasoning models without changing live settings; unavailable models remain disabled. Browser assertions expand and verify the tested prompt content, verify it disappears with the original prompt, and verify it returns when switching back. The [desktop Chromium 5/10 failure](https://github.com/Pasta-Devs/Marinara-Engine/actions/runs/36161639751/job/108159422615) reproduced locally in the existing Lorebook filter-chip test. Reload restores the editor, so its heading and hidden library row both matched the old locator. The test now waits for the visible editor or library view and only selects the library row when needed. Follow-up validation: `pnpm check`, all 9 Decision regression suites, and `pnpm regression:prompt` passed. All 6 updated Decision browser cases passed across desktop Chromium, mobile Chromium and mobile WebKit. The final Lorebook test passed twice consecutively. Local CodeRabbit found one test-cleanup issue; it was fixed, and the rerun reported **0 findings across the 7 follow-up files**. ### Manual verification notes Automated browser interactions were visually inspected in desktop dark/light and mobile layouts. Screenshot data is synthetic; server transport behavior is verified separately with local HTTP fixtures. - [ ] Manually verify a real Jev connection in Game Mode: inspect the prepared request, run decisions, compare scores and branches, and confirm chat/game state is unchanged. - [ ] Manually verify a supported local Decision model on real hardware, including cancellation during cold startup. - [ ] Manually verify opening an exact saved prompt, running a current-state test, and switching back preserves the saved request. Paid hosted Jev and GPU-backed local inference were not exercised locally. ## 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 - [ ] Version/release files updated (only if this PR includes a version bump) Updated Peek Prompt, Decision Models, and Conditional Prompts documentation plus `CHANGELOG.md`. Translation follow-up: #6667. No version bump. ## UI evidence (if applicable) Before/after evidence is stored outside the source tree in the [PR evidence gist](https://gist.github.com/kolacheee/0ae742d83337666e5a488dac727a8427). | Before (staging) | After (desktop, dark) | | --- | --- | | ![Original Peek Prompt](https://gist.githubusercontent.com/kolacheee/0ae742d83337666e5a488dac727a8427/raw/f9b5c06a39a002b12fc77f110f10b16f66bb0e18/before-desktop.png) | ![Decision diagnostics with actual result fields](https://gist.githubusercontent.com/kolacheee/0ae742d83337666e5a488dac727a8427/raw/f2af966f0769f57fe36d9266cfc48907e1f22a75/after-desktop-dark.png) | [Desktop light](https://gist.githubusercontent.com/kolacheee/0ae742d83337666e5a488dac727a8427/raw/35e30ec8ffe72c8159c820e3d5aeb9a72609adbe/after-desktop-light.png) · [Mobile dark](https://gist.githubusercontent.com/kolacheee/0ae742d83337666e5a488dac727a8427/raw/92f1d4203a13e4e36407408982dc625f207f0d7c/after-mobile-dark.png) · [Mobile light](https://gist.githubusercontent.com/kolacheee/0ae742d83337666e5a488dac727a8427/raw/92b6021b38c3f19576cadbbf935975c09ded7f62/after-mobile-light.png). Mobile captures are scrolled to the result list and original-prompt switch. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Peek Prompt now offers decision diagnostics: inspect prepared requests or test eligible decisions with the selected model, then switch between the tested and original prompt. * Decision debug output includes scores, thresholds, outcomes, and request details. * Inspection does not call the model; explicit tests do not generate replies or change live chat decisions. Hosted-model tests may incur charges. * **Documentation** * Updated guides explain how to inspect and test decisions, interpret results, and understand testing limitations. <!-- 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-23 04:18: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#7279
No description provided.