[PR #4816] [MERGED] fix(server): give Professor Mari a read-only-default guardrail (#4813 Thread A) #6507

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

📋 Pull Request Information

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

Base: staging ← Head: fix/4813-mari-readonly-guardrail


📝 Commits (1)

  • d72c67d fix(server): give Professor Mari a read-only-default guardrail

📊 Changes

1 file changed (+5 additions, -1 deletions)

View changed files

📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+5 -1)

📄 Description

Linked issue

Refs #4813 (addresses the prompt/behavioral half — "Thread A").

Why this change

Professor Mari (the Home workspace assistant) treats a request to inspect an element or an informational/how-to question ("show me my lorebook", "how do I achieve X?") as authorization to modify it — she makes the change and reports it afterward, even when the user did not ask or explicitly said not to edit.

An investigation traced this to the system prompt: it supplies rich mechanics for how to write (many apply:true directives, "create immediately", a create→create follow-up nudge, and a worked-example set that is 6 writes to 3 reads) but has no rule for the prior question of whether this is a write at all. Every write directive gates on the word "requested", yet nothing ever defines that an inspect/how-to request is not a modification request.

What changed

Prompt-only change to packages/server/src/services/professor-mari/workspace-agent.service.ts:

  • Read-only-default guardrail inserted right after the load-bearing apply rule (so it retroactively constrains every downstream "requested" rule): a request to view/inspect/read/explain/advise ("show me", "look at", "how do I", "what would happen if", "can you explain") is informational — answer it with reads and words, not writes — and does not authorize any create/update/addEntry/updateEntry/setActive/moveToFolder/delete. Mutate only on an explicit instruction to make that specific change; when unsure, answer and ask; and if the user says not to change something, don't.
  • A worked example of an informational request answered with a docs_read + a plain-language explanation and no mutation (counters the write-heavy example skew and models "offer to do it, don't just do it").
  • Softened the post-action follow-up nudge: suggestions now lean toward refining/connecting existing material rather than making new items — unless the user's task is itself about creating.

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 check (tsc + eslint + client build) passes.
  • Behavioral change — needs a live pass (no automated test captures model behavior): in the Home Professor Mari chat, send inspect/how-to messages ("show me my lorebook", "how do I make an entry always active?", "look at this theme") and confirm she reads and explains without modifying, and offers to make the change rather than making it. Confirm an explicit change request ("make this entry constant") still works, and that "make no changes" is honored.

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)

Prompt-only; no docs/ changes, no version bump.


Note: this PR is only Thread A of #4813 (the over-eager-modification behavior). The separate, more serious half — Thread B, where the approval confirmation is a post-hoc undo rather than a gate and every *.create is unguarded (data loss) — has been scoped separately and involves code changes plus a few maintainer product decisions.

Summary by CodeRabbit

  • Behavior Improvements
    • Informational requests now default to read-only responses.
    • Unclear requests prompt for clarification instead of making assumptions.
    • The assistant no longer performs unrequested changes.
    • Follow-up suggestions now focus on refining or connecting existing items after successful updates.

🔄 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/4816 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 8/9/2026 **Status:** ✅ Merged **Merged:** 8/9/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `fix/4813-mari-readonly-guardrail` --- ### 📝 Commits (1) - [`d72c67d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d72c67de76473b0650bd3350e500feab387cb131) fix(server): give Professor Mari a read-only-default guardrail ### 📊 Changes **1 file changed** (+5 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+5 -1) </details> ### 📄 Description ## Linked issue Refs #4813 (addresses the prompt/behavioral half — "Thread A"). ## Why this change Professor Mari (the Home workspace assistant) treats a request to **inspect** an element or an **informational/how-to** question ("show me my lorebook", "how do I achieve X?") as authorization to **modify** it — she makes the change and reports it afterward, even when the user did not ask or explicitly said not to edit. An investigation traced this to the system prompt: it supplies rich mechanics for *how* to write (many `apply:true` directives, "create immediately", a create→create follow-up nudge, and a worked-example set that is 6 writes to 3 reads) but has **no** rule for the prior question of *whether this is a write at all*. Every write directive gates on the word "requested", yet nothing ever defines that an inspect/how-to request is **not** a modification request. ## What changed Prompt-only change to `packages/server/src/services/professor-mari/workspace-agent.service.ts`: - **Read-only-default guardrail** inserted right after the load-bearing apply rule (so it retroactively constrains every downstream "requested" rule): a request to view/inspect/read/explain/advise ("show me", "look at", "how do I", "what would happen if", "can you explain") is informational — answer it with reads and words, not writes — and does **not** authorize any `create`/`update`/`addEntry`/`updateEntry`/`setActive`/`moveToFolder`/`delete`. Mutate only on an explicit instruction to make that specific change; when unsure, answer and ask; and if the user says not to change something, don't. - **A worked example** of an informational request answered with a `docs_read` + a plain-language explanation and **no** mutation (counters the write-heavy example skew and models "offer to do it, don't just do it"). - **Softened the post-action follow-up nudge**: suggestions now lean toward refining/connecting existing material rather than making new items — unless the user's task is itself about creating. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - `pnpm check` (tsc + eslint + client build) passes. - **Behavioral change — needs a live pass** (no automated test captures model behavior): in the Home Professor Mari chat, send inspect/how-to messages ("show me my lorebook", "how do I make an entry always active?", "look at this theme") and confirm she **reads and explains without modifying**, and offers to make the change rather than making it. Confirm an explicit change request ("make this entry constant") still works, and that "make no changes" is honored. ## Docs and release impact - [x] 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) Prompt-only; no `docs/` changes, no version bump. --- **Note:** this PR is only Thread A of #4813 (the over-eager-modification behavior). The separate, more serious half — **Thread B**, where the approval confirmation is a post-hoc undo rather than a gate and every `*.create` is unguarded (data loss) — has been scoped separately and involves code changes plus a few maintainer product decisions. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Behavior Improvements** * Informational requests now default to read-only responses. * Unclear requests prompt for clarification instead of making assumptions. * The assistant no longer performs unrequested changes. * Follow-up suggestions now focus on refining or connecting existing items after successful updates. <!-- 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:11:04 +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#6507
No description provided.