mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5730] [MERGED] feat(mari): Permissions Mode — Auto / Manual / Accept edits / Plan / Bypass #6907
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6907
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5730
Author: @kolacheee
Created: 9/1/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @kolacheee
Base:
staging← Head:feat/5725-mari-permissions-mode📝 Commits (10+)
1e175b3feat(mari): Permissions Mode - Auto / Manual / Accept edits / Plan / Bypass (#5725)89c5e62fix(mari): close the Permissions Mode review findings3a9646ffeat(mari): per-chat Permissions Mode with a global default (#5725)a34cf3dfix(mari): make the per-chat mode display switch-safea9c4157chore(mari): drop now-unused deps from changePermissionsModedeef52afix(mari): close the CodeRabbit round on Permissions Modec3ed994fix(mari): close CodeRabbit round 2 - restore the deletion boundary, guard superseded-run writes3037734fix(mari): address the out-of-diff-range review findingsffd44fcfix(mari): chain mode writes, scope the pending hold, satisfy repo validators03f10a7fix(mari): one shared write chain for BOTH Permissions Mode surfaces📊 Changes
16 files changed (+1066 additions, -18 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
e2e/core-flows.e2e.ts(+6 -0)📝
packages/client/src/components/chat/HomeProfessorMariChat.tsx(+207 -2)📝
packages/client/src/components/panels/SettingsPanel.tsx(+10 -0)📝
packages/client/src/components/panels/settings/SettingControls.tsx(+96 -0)➕
packages/client/src/lib/mari-permissions-write-chain.ts(+29 -0)📝
packages/client/src/localization/locales/en.json(+16 -0)📝
packages/server/src/routes/professor-mari-workspace.routes.ts(+43 -2)📝
packages/server/src/services/mari-db/mari-db.service.ts(+74 -1)📝
packages/server/src/services/professor-mari/workspace-agent.service.ts(+191 -12)➕
packages/shared/src/constants/mari-permissions-mode.ts(+42 -0)📝
packages/shared/src/index.ts(+1 -0)📝
packages/shared/src/types/chat.ts(+2 -0)📝
packages/shared/src/types/professor-mari-workspace.ts(+7 -0)➕
scripts/regressions/mari-permissions-mode.regression.ts(+337 -0)📝
scripts/regressions/open-issues.regression.ts(+3 -1)📄 Description
Linked issue
Closes #5725.
Why this change
Mari's permission posture has been a pendulum: some users found her too edit-happy (#4813 → #4838), and the stricter gate added afterwards produced the redundant double-confirmation flow removed in #5727. No single default satisfies both a user who says "present your proposal" and means describe it in chat, and a power user who wants edits applied the moment they ask. A user-selectable mode — like the Claude app's picker — replaces the one-size-fits-all posture with policy the user chooses, and takes the pressure off the default forever.
What changed
The five modes (server-enforced, not just prompt-suggested):
say) execute.apply:falsedry-runs stay allowed; Mari lays out exact edits in chat.Floors that hold in every mode: sensitive-file staging, Personal Extension approval, dependency-install approval (all structural), and the Keep/Restore card on deletions (
delete/forget/remove/uninstallactions) — under card-suppressing modes it is a destructive action's last undo surface.Architecture (follows the docs-language settings pattern): shared enum constants; the setting lives in
app_settingsunder a key deliberately absent from the genericALLOWED_KEYSpassthrough, owned by dedicated validatedGET/PUT /permissions-moderoutes (zod enum, privileged-gated); read fresh per run and perstatus()call (never latched — the workspace service singleton caches at first call); a mode switch neverreset()s the agent, so an in-flight turn finishes under the mode it started with. Accept-edits/Bypass ride areviewPolicyfield on theapp_dataenvelope, honored at mari-db's singleexecuteMutationchoke point. The mode-specific prompt block is spliced after the saved-memories block — the mode is the user's explicit current selection, so it outranks a stale memory (which may further restrict, never loosen) — and it overrides the static prompt's Keep/Restore promises where a mode suppresses the card.Client: the mode rides
MariWorkspaceStatus; a shield button in Mari's panel header opens the five-mode picker (optimistic update + rollback), and Settings → Application gains a searchable select with the same write path.Design calls (maintainer-reviewed)
Candidate follow-up (from CodeRabbit round 2, not implemented here): a structural one-shot accept for Manual mode — the Accept chip could set a server-side token consumed by the next run — instead of the current last-message-flag arming. Declined intent-parsing of accept words for the same reason #5721 removed the authorization regexes; Manual mode never suppresses Keep/Restore cards, which bounds the residual.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
pnpm lint, all three package builds, and the e2e type lane are green locally;format:checkfails repo-wide on this Windows checkout (pre-existing autocrlf CRLF; touched files were run through Prettier directly).mari-permissions-modepasses: functional checks on the pure pieces (stored-mode normalizer tolerates junk/absence/storage failure; per-mode prompt renderer incl. the memory-precedence rule) plus source pins on every enforcement seam, the after-memories splice order, the no-reset rule, and theALLOWED_KEYSexclusion. Sibling lanes (mari-edit-flow-revert,prompt.regression,issue-sweep-5380-5434) stay green.mariCLI path (a stale auto-keep could strip the Keep/Restore card from CLI deletions, even after switching back to Auto — now reset at both entry points and on exit), and Mari could rewrite her own mode row via rawmari db patchonapp_settings(a prompt-injection escalation path to Bypass — now blocked by a change-levelplanMutationfloor covering every raw-db mutation kind). Also fixed: manual mode gained a real server floor for silent (empty-say) mutating frames — they execute only in the run right after an approved deferral; plan mode's guidance points atapp_data apply:falsefor previews; the mode picker refetches status after its PUT so an in-flight poll can't clobber the optimistic patch; the Settings select refetches on focus so it tracks header changes; and all ten mode labels/descriptions are now en.json values rendered through the localization bridge (they were hardcoded English on a safety-relevant control). The 6 refuted findings included three manual/bypass semantics attacks that turned out to be the modes' documented, user-selected contracts. A second focused review of the per-chat layer confirmed 2 further findings, fixed in the final commits: a chat switch never refetched the now chat-scoped status, so the shield could show the previous chat's mode in exactly the pre-send window (a switch now refetches immediately, stale responses dropped), and the picker's same-value short-circuits keyed on that stale state could silently drop a "Use default" de-escalation (removed — every click sends the idempotent write and converges via the post-PUT refetch).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)CHANGELOG updated under [Unreleased] → Added. The Professor Mari guides under
docs/are deliberately untouched (docs-i18n mirror debt is batched per the maintainer's standing call); a docs section should ride the next catch-up round.UI evidence (if applicable)
The shield-button picker in Mari's panel header and the Settings → Application select are the visible additions.
Summary by CodeRabbit
New Features
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.