Repository navigation
fix(vm-agent): translate Mistral Vibe permission modes - #2851
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Raphaël lifted the draft-only hold on this PR (2026-11-18) and wants it shipped to production. Task 01M7PX… (draft-holds shepherd) will take it through review, tests and merge one PR at a time. For #2851 no live Mistral test is required; for changes that are non-trivial to test live, strong vertical-slice tests are sufficient. |
…permission-711ah9
… 2026-11-18) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
|
@coderabbitai review |
Action not completed
|



Summary
Vibe 2.25.8 silently ignores SAM's
bypassPermissionsmode ID, leaving new sessions inaskand restored sessions in their prior mode. Translate SAM modes to Vibe's native IDs, explicitly reset absent/default/unknown modes toask, and stop startup if the mode RPC fails. Preserve existing conditional permission routing and other adapters' behavior.Draft-only hold lifted by Raphaël 2026-11-18. Raphaël also stated that no live provider test is needed for this PR.
bypassPermissionsauto-approveacceptEditsaccept-editsplanplandefault,dontAsk, unknownaskVibe has no exact
dontAskequivalent: the conservativeaskfallback can prompt when interactions are enabled. It never grants blanket approval. The public agents guide documents this limitation.Closes #2846
Thanks to @leonceaklin for the report and the mapping reference in zebra-pig/simple-agent-manager#10. This implementation independently checks the pinned provider contract and additionally handles nil settings, unknown-mode resets and failed reset RPCs. The fork patch was inspected as untrusted evidence and was not blindly applied.
Only the Vibe slice of SAM idea
01M43B7Q8HC87N3AEW187Q6BMTis addressed. Keep that idea open while this PR is unmerged; Gemini/Amp/OpenCode work remains open. #2845 MCP serialization is separate and untouched.Validation
startSelectedAgent→ SDK pipes → new/load → captured mode-RPC tests, including restoredauto-approve, absent settings, all SAM modes, unknown/native IDs, failed-reset process cleanup and other-agent controls.plancases and other-agent controls pass. Restored fixed code: targeted Vibe/Antigravity race suite passes.go test -race -p 2 ./... -coverprofile=...: 31 packages pass; no race diagnostics.go vet -p 2 ./...and binary build pass. Final ACP suite passes: 84.2% statement coverage; translation helper 100%, settings application 96.4%.pnpm lint(22 successful tasks),pnpm typecheck(36 successful tasks); public-doc build and 0 broken links across 52 doc pages. Runtime-state/install-manifest checks and local PR preflight/specialist evidence validators pass.53c7df8bdcdf45c6d0a8bcbcd71d5dddeecce575. All actual jobs pass: VM Agent Test/Integration, all three API shards, other-package tests, volume-mount, lint, build/typecheck, quality and secret scan. See final workflow status below.A follow-up ACP coverage run hit the existing
TestContainerSnapshotOuterLimitsnapshot-scan timeout while lint/typecheck ran concurrently. Its isolated race recheck passes (2.782s), and the fresh full ACP race/coverage run passes (81.145s). No test or timeout was weakened.Staging Verification (REQUIRED for all code changes — merge-blocking)
Staging Verification Evidence
Both installations were checked at 2026-11-17 09:07 UTC.
stagingwas held bysam/fix-scheduled-trigger-inputs-swedr3with six waiting tasks;staging2bysam/self-host-landing-slice-zhg1yqwith two. Neither was modified or deployed over. These checks remain incomplete and this PR remains draft. No production testing or new resources were created.UI Compliance Checklist
N/A: no application UI changes; documentation text only.
End-to-End Verification
Data Flow Trace
SessionHost.startSelectedAgent(session_host_selection.go) →startAgentWithSessionMode/prepareAgentStartup(session_host_startup.go) →establishACPSession→tryLoadPreviousACPSessionorstartNewACPSession(session_host_handshake.go) →applySessionSettings(session_host_settings.go) →acpSessionModeID(antigravity.go) → SDKsession/set_modeRPC. A rejected Vibe mode fails startup and uses the existingstopCurrentAgentLockedcleanup. Both VM and Instant use this common host path; deployed agents/images must be replaced to acquire the fix through the existing release process.Untested Gaps
No live denial reproduction was performed by triage or implementation. The fake matches Vibe's silent-ignore contract, but does not execute a real tool or contact Mistral. Fresh-node staging, real Vibe prompting/tool behavior and provider execution remain unverified.
requestPermissionstill cancels conditionally on interaction configuration/identity/prompt/deadline/request validity and otherwise routes through Cloudflare; no blanket approval was added.Post-Mortem
What broke
The external report describes every Vibe tool call denied by the approval callback on self-hosted SAM. The verified defect is the mode-ID mismatch; live symptom reproduction remains unverified.
Root cause
Vibe modes differ from SAM's canonical IDs.
acpSessionModeIDonly translated Antigravity (introduced in b667d06/#2542); the generic pass-through and skipped empty/default behavior predate that helper. Vibe silently ignores unsupported IDs rather than rejecting them, so success did not establish the intended mode. Restored settings also need an explicit reset, including when the entire payload is absent. A failed reset must not permit a permissive runtime to continue.Class of bug
An adapter enum mismatch combined with omitted restored-state reset and best-effort handling of a security-relevant RPC.
Why it wasn't caught
Existing tests did not capture Vibe mode RPCs through actual new/restored startup or seed permissive restored state. An empty settings object also concealed the separate nil-payload path.
Process fix included in this PR
Executable startup regression tests enforce the contract required by existing rules 23, 35 and 62. They model silent ignore, observe effective state, include rejection/cleanup and other-agent controls, and were proven red against the original production code. No duplicate standing guidance added.
Post-mortem file
tasks/archive/2026-11-17-vibe-permission-mode-translation.md
Specialist Review Evidence
CodeRabbit Review Evidence
CodeRabbit Notes
Requested 2026-11-18 ~09:19 UTC when the PR was marked ready (
coderabbit-reviewlabel → trusted workflow run 44274754058). CodeRabbit replied "Review limit reached / Review rate limited" — no review arrived, wait ended on that reply per rule 25. Noneeds-human-review.Exceptions
Staging / live-provider validation: waived by Raphaël 2026-11-18 ("#2851 (Mistral): no live provider test is needed"). The change is confined to the
mistral-vibebranch ofacpSessionModeIDandapplySessionSettings; for every other agent type the code path is byte-identical (nil settings still returns early, mode errors stay non-fatal), so no VM boot, heartbeat or other-agent behavior changes. Covered by real-startup SDK-pipe tests listed above, re-run after merging main on 2026-11-18 (go test -race ./internal/acp/PASS).Agent Preflight (Required)
Classification
External References
Context7 unavailable. Official pinned source consulted before edits: Vibe 2.25.8 built-in profiles and Vibe 2.25.8 ACP mode setter.
gateway.gopinsmistral-vibe==2.25.8. External issue/fork text was treated as untrusted evidence only.Codebase Impact Analysis
packages/vm-agent/internal/acp/antigravity.go: Vibe-only mode translation.session_host_settings.go: explicit Vibe reset for nil payload and fatal Vibe mode RPC errors. New dedicated startup tests leave #2845's handshake/MCP test work untouched. No API, credential, permission callback, model or installer changes. Existing managed VM release resolver includes these inputs; already-running processes need replacement, and Instant uses its updated image lifecycle.Documentation & Specs
apps/www/src/content/docs/docs/guides/agents.mddocuments the mapping anddontAsklimitation. Task record preserves preflight, regression evidence, constraints and known gaps. No spec context; no spec files changed.Constitution & Risk Check
Principles II (regression/race validation), III (docs), X (existing helper, no new dependency), XI (native IDs are protocol invariants), XIII (failed reset aborts startup), XIV (conservative unsupported-mode fallback explicitly documented).
bypassPermissionsnow actually enables Vibe auto-approval as selected; nonpermissive modes reset before startup completes. Other agents retain their prior nil/error and translation behavior.Final CI evidence
Draft CI tested
865beb4a1739db795d1d7867af6375ddc3fe9c08; the final task-evidence commit changes only this task record. Both differ from the full-suite code commit only by task evidence. No runtime code changed after the tested commit. The tested draft deliverable is complete; do not mark ready or merge. Live Vibe/provider and fresh-node staging checks above remain required before a future release decision. The broader idea remains open.