[PR #5745] [MERGED] feat(mari): show the phrase Professor Mari understood as the request or permission to act #6914

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

📋 Pull Request Information

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

Base: staging ← Head: feat/5740-mari-understood-request


📝 Commits (5)

  • 7f50a17 feat(mari): show the phrase Mari understood as permission to act (#5740)
  • 24c4c37 fix(mari): ground the understood-request record in observed outcomes (#5740)
  • 3ef7278 fix(client): give the held-for-approval marker its own line (#5740)
  • aa3bb84 fix(mari): address CodeRabbit round 1 on the understood-request record (#5740)
  • 0269629 fix(mari): take the understood-request phrase only from mutating frames (#5740)

📊 Changes

9 files changed (+534 additions, -12 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/core-flows.e2e.ts (+2 -0)
📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+77 -10)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+18 -1)
📝 packages/client/src/lib/support-diagnostics.ts (+46 -0)
📝 packages/client/src/localization/locales/en.json (+10 -1)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+109 -0)
📝 packages/shared/src/types/professor-mari-workspace.ts (+32 -0)
➕ scripts/regressions/mari-understood-request.regression.ts (+238 -0)

📄 Description

Linked issue

Closes #5740.

Why this change

Mari's permission behavior has been a long arc of conflicting reports (#4813 → #4838 → #5721 → #5725), and investigating them showed that many reporters didn't realize their own wording implied a change request. Nothing recorded what Mari took as the authorizing instruction, so every report started as transcript archaeology. With beta testers about to exercise Permissions Mode, the maintainer needs reports to carry this signal so user error and real Mari issues can be told apart at a glance.

What changed

Mari's protocol gains an optional, purely diagnostic understoodRequest field: when a response carries mutating commands, she copies the exact words she is treating as the request or permission — from the user's message, or from the memory/instruction that directed the change. Hard constraint carried from #5721: the server stores and displays the value and never validates, matches, or gates on it — a missing or wrong quote never blocks anything, and the regression sweeps both Mari server files to assert no conditional branches on the field.

The three design questions were answered on the issue by the maintainer and are implemented accordingly:

  • User-visible by default: an "Acting on: “…”" line renders under the reply the round produced (both layouts), truncated to one row and expandable on click — expansion also reveals the commands it covered and a "held for your approval" marker for deferrals.
  • Source-agnostic quoting: the prompt instructs her to quote whatever actually triggered her — user words or the memory/instruction. No verbatim-vs-paraphrase machinery.
  • Latest-round retention only: ONE in-memory record on the workspace service, overwritten by each round that carries mutating commands (deferred rounds included), bound to the persisted message id once known, lost on restart. No message-extra growth, no history, anywhere.

Two things the record carries beyond the phrase, both added on maintainer direction during review:

  • An observed outcome, never an asserted one: the record starts as held/interrupted and is upgraded to applied/failed only from the command batch's own results. Without this, a Plan-mode round (whose mutating commands the #5725 floor refuses by design) would have pasted into diagnostics as executed — manufacturing a Plan-escape P0 that never happened, in the one line built to prevent exactly that misread.
  • Read-back to Mari herself (maintainer call, this round): the chat's record is included in her context as <mari_understood_request_record>, framed explicitly as a record and not an instruction. Asking her "why did you treat that as permission?" now gets an answer grounded in the actual record instead of a from-memory reconstruction. Inclusion-only — the regression's enumerated-conditional sweep pins that no branch on the field can ever gate a command.

Surfaces: MariWorkspaceStatus.latestUnderstoodRequest (how the client learns it), the transcript line, and Support Diagnostics — the copy handler best-effort-fetches workspace status and the report gains a Mari last acted on: line distinguishing unreachable / none recorded this session / the quoted phrase with mode, held-or-executed, command list, and timestamp. That line is the load-bearing part: reporters paste diagnostics into Discord, so triage reads the trigger phrase directly from the report.

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

Manual verification notes

  • pnpm lint, all three builds, the locale checker, and the e2e type lane are green locally; format:check fails repo-wide on this Windows checkout (pre-existing autocrlf CRLF; touched files were run through Prettier directly).
  • New regression mari-understood-request passes: functional parse tests (extraction, trim, 2000-char cap, absence, non-string), the never-enforce sweep, one-record retention pins, client truncate/expand pins, en.json keys, and the diagnostics line — differentially verified to FAIL with the extraction stubbed out. Sibling Mari lanes, prompt.regression, and open-issues stay green.
  • A two-lens adversarial review (server + client, with per-finding refutation verifiers) ran over the initial commit — 12 findings, all confirmed and all fixed here: the messageId stamp is now scoped to the run's own record (a dangling record from an aborted run could previously claim the next run's unrelated reply); the outcome is observed post-batch instead of guessed pre-execution (Plan/Manual-floor refusals no longer paste as "executed"); the diagnostics copy's status fetch carries a 5s deadline (it previously hung the copy button forever on the exact frozen-host case the button exists for); the phrase and command labels are flattened/capped for the line-oriented report (a multi-line quote could forge report lines); the never-enforce sweep is now case-blind with enumerated allowed conditionals and covers two more server files (it previously could not see the stored latestUnderstoodRequest form at all); and the transcript line gained break-words plus aria-expanded/state-aware tooltip.
  • Please verify manually: ask Mari for an edit in a fresh chat — the reply should carry a one-row "Acting on" line quoting your request, expanding on click; then Settings → Advanced → Copy Support Diagnostics should include a Mari last acted on: line with the same phrase. A chat with no mutating round yet should copy "none recorded this session". Then ask Mari why she made the change — she should quote the recorded phrase back rather than improvising.

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)

CHANGELOG updated under [Unreleased] → Added. No user-facing docs under docs/ touched (docs-i18n debt stays batched per the standing call).

UI evidence (if applicable)

The "Acting on" line under Mari's replies and the new Mari last acted on: diagnostics line are the visible additions.

Summary by CodeRabbit

  • New Features

    • Professor Mari now shows an expandable “Acting on” summary for replies that stage or apply changes.
    • Summaries include the recognized request, commands, approval status, and outcome.
    • Mari can use the recorded request to provide grounded explanations.
    • Support Diagnostics now includes Mari’s latest recorded action, including timing, when available.
    • Added localized labels and messaging for the new experience.
  • Bug Fixes

    • Diagnostics continue to copy successfully when workspace status cannot be retrieved.
  • Tests

    • Added regression coverage for tracking, display, accessibility, diagnostics, and error handling.

🔄 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/5745 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/2/2026 **Status:** ✅ Merged **Merged:** 9/2/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/5740-mari-understood-request` --- ### 📝 Commits (5) - [`7f50a17`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7f50a17b940676f234d1a0c0120c274732fa27e6) feat(mari): show the phrase Mari understood as permission to act (#5740) - [`24c4c37`](https://github.com/Pasta-Devs/Marinara-Engine/commit/24c4c37914e6a214d6de75ea28f5b3ecd3c9c1e7) fix(mari): ground the understood-request record in observed outcomes (#5740) - [`3ef7278`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3ef7278c63d6fe272ab885df179f7cc889881506) fix(client): give the held-for-approval marker its own line (#5740) - [`aa3bb84`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aa3bb84bb65fb6b559a875cc03ce4a1383b263f6) fix(mari): address CodeRabbit round 1 on the understood-request record (#5740) - [`0269629`](https://github.com/Pasta-Devs/Marinara-Engine/commit/026962915472ddb8d094676ca11ef57968007104) fix(mari): take the understood-request phrase only from mutating frames (#5740) ### 📊 Changes **9 files changed** (+534 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/core-flows.e2e.ts` (+2 -0) 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+77 -10) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+18 -1) 📝 `packages/client/src/lib/support-diagnostics.ts` (+46 -0) 📝 `packages/client/src/localization/locales/en.json` (+10 -1) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+109 -0) 📝 `packages/shared/src/types/professor-mari-workspace.ts` (+32 -0) ➕ `scripts/regressions/mari-understood-request.regression.ts` (+238 -0) </details> ### 📄 Description ## Linked issue Closes #5740. ## Why this change Mari's permission behavior has been a long arc of conflicting reports (#4813 → #4838 → #5721 → #5725), and investigating them showed that many reporters didn't realize their own wording implied a change request. Nothing recorded *what Mari took as the authorizing instruction*, so every report started as transcript archaeology. With beta testers about to exercise Permissions Mode, the maintainer needs reports to carry this signal so user error and real Mari issues can be told apart at a glance. ## What changed Mari's protocol gains an **optional, purely diagnostic** `understoodRequest` field: when a response carries mutating commands, she copies the exact words she is treating as the request or permission — from the user's message, or from the memory/instruction that directed the change. **Hard constraint carried from #5721: the server stores and displays the value and never validates, matches, or gates on it** — a missing or wrong quote never blocks anything, and the regression sweeps both Mari server files to assert no conditional branches on the field. The three design questions were answered on the issue by the maintainer and are implemented accordingly: - **User-visible by default**: an "Acting on: “…”" line renders under the reply the round produced (both layouts), truncated to one row and expandable on click — expansion also reveals the commands it covered and a "held for your approval" marker for deferrals. - **Source-agnostic quoting**: the prompt instructs her to quote whatever actually triggered her — user words or the memory/instruction. No verbatim-vs-paraphrase machinery. - **Latest-round retention only**: ONE in-memory record on the workspace service, overwritten by each round that carries mutating commands (deferred rounds included), bound to the persisted message id once known, lost on restart. No message-extra growth, no history, anywhere. Two things the record carries beyond the phrase, both added on maintainer direction during review: - **An observed outcome, never an asserted one**: the record starts as `held`/`interrupted` and is upgraded to `applied`/`failed` only from the command batch's own results. Without this, a Plan-mode round (whose mutating commands the #5725 floor refuses by design) would have pasted into diagnostics as `executed` — manufacturing a Plan-escape P0 that never happened, in the one line built to prevent exactly that misread. - **Read-back to Mari herself** (maintainer call, this round): the chat's record is included in her context as `<mari_understood_request_record>`, framed explicitly as a record and not an instruction. Asking her "why did you treat that as permission?" now gets an answer grounded in the actual record instead of a from-memory reconstruction. Inclusion-only — the regression's enumerated-conditional sweep pins that no branch on the field can ever gate a command. Surfaces: `MariWorkspaceStatus.latestUnderstoodRequest` (how the client learns it), the transcript line, and **Support Diagnostics** — the copy handler best-effort-fetches workspace status and the report gains a `Mari last acted on:` line distinguishing *unreachable* / *none recorded this session* / the quoted phrase with mode, held-or-executed, command list, and timestamp. That line is the load-bearing part: reporters paste diagnostics into Discord, so triage reads the trigger phrase directly from the report. ## 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` ### Manual verification notes - `pnpm lint`, all three builds, the locale checker, and the e2e type lane are green locally; `format:check` fails repo-wide on this Windows checkout (pre-existing autocrlf CRLF; touched files were run through Prettier directly). - New regression `mari-understood-request` passes: functional parse tests (extraction, trim, 2000-char cap, absence, non-string), the never-enforce sweep, one-record retention pins, client truncate/expand pins, en.json keys, and the diagnostics line — differentially verified to FAIL with the extraction stubbed out. Sibling Mari lanes, `prompt.regression`, and `open-issues` stay green. - A two-lens adversarial review (server + client, with per-finding refutation verifiers) ran over the initial commit — 12 findings, all confirmed and all fixed here: the messageId stamp is now scoped to the run's own record (a dangling record from an aborted run could previously claim the next run's unrelated reply); the outcome is observed post-batch instead of guessed pre-execution (Plan/Manual-floor refusals no longer paste as "executed"); the diagnostics copy's status fetch carries a 5s deadline (it previously hung the copy button forever on the exact frozen-host case the button exists for); the phrase and command labels are flattened/capped for the line-oriented report (a multi-line quote could forge report lines); the never-enforce sweep is now case-blind with enumerated allowed conditionals and covers two more server files (it previously could not see the stored `latestUnderstoodRequest` form at all); and the transcript line gained `break-words` plus `aria-expanded`/state-aware tooltip. - **Please verify manually:** ask Mari for an edit in a fresh chat — the reply should carry a one-row "Acting on" line quoting your request, expanding on click; then Settings → Advanced → Copy Support Diagnostics should include a `Mari last acted on:` line with the same phrase. A chat with no mutating round yet should copy "none recorded this session". Then ask Mari *why* she made the change — she should quote the recorded phrase back rather than improvising. ## 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) CHANGELOG updated under **[Unreleased] → Added**. No user-facing docs under `docs/` touched (docs-i18n debt stays batched per the standing call). ## UI evidence (if applicable) The "Acting on" line under Mari's replies and the new `Mari last acted on:` diagnostics line are the visible additions. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Professor Mari now shows an expandable “Acting on” summary for replies that stage or apply changes. * Summaries include the recognized request, commands, approval status, and outcome. * Mari can use the recorded request to provide grounded explanations. * Support Diagnostics now includes Mari’s latest recorded action, including timing, when available. * Added localized labels and messaging for the new experience. * **Bug Fixes** * Diagnostics continue to copy successfully when workspace status cannot be retrieved. * **Tests** * Added regression coverage for tracking, display, accessibility, diagnostics, and error handling. <!-- 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:14:50 +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#6914
No description provided.