Skip to content

fix(vm-agent): translate Mistral Vibe permission modes - #2851

Merged
simple-agent-manager[bot] merged 5 commits into
mainfrom
sam/fix-mistral-vibe-permission-711ah9
Nov 18, 2026
Merged

simple-agent-manager[bot] merged 5 commits into
mainfrom
sam/fix-mistral-vibe-permission-711ah9

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Vibe 2.25.8 silently ignores SAM's bypassPermissions mode ID, leaving new sessions in ask and restored sessions in their prior mode. Translate SAM modes to Vibe's native IDs, explicitly reset absent/default/unknown modes to ask, 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.

SAM mode Vibe mode
bypassPermissions auto-approve
acceptEdits accept-edits
plan plan
absent settings, unset, default, dontAsk, unknown ask

Vibe has no exact dontAsk equivalent: the conservative ask fallback 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 01M43B7Q8HC87N3AEW187Q6BMT is addressed. Keep that idea open while this PR is unmerged; Gemini/Amp/OpenCode work remains open. #2845 MCP serialization is separate and untouched.

Validation

  • Real startSelectedAgent → SDK pipes → new/load → captured mode-RPC tests, including restored auto-approve, absent settings, all SAM modes, unknown/native IDs, failed-reset process cleanup and other-agent controls.
  • Final regressions against original production files: 16/18 mode cases fail, plus 2/2 failed-reset cases fail. The two plan cases and other-agent controls pass. Restored fixed code: targeted Vibe/Antigravity race suite passes.
  • Full VM-agent 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%.
  • Repository 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.
  • Full CI manually dispatched while remaining draft: run 44054109832 on code commit 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 TestContainerSnapshotOuterLimit snapshot-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 / live Vibe validation waived by Raphaël 2026-11-18 (see Exceptions)

Staging Verification Evidence

Both installations were checked at 2026-11-17 09:07 UTC. staging was held by sam/fix-scheduled-trigger-inputs-swedr3 with six waiting tasks; staging2 by sam/self-host-landing-slice-zhg1yq with 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 traced with code path citations.
  • Automated boundary tests exercise actual startup and SDK RPC serialization.
  • Pinned provider contract verified independently from official source.
  • Gaps between automated tests and live provider verification documented.

Data Flow Trace

SessionHost.startSelectedAgent (session_host_selection.go) → startAgentWithSessionMode / prepareAgentStartup (session_host_startup.go) → establishACPSession → tryLoadPreviousACPSession or startNewACPSession (session_host_handshake.go) → applySessionSettings (session_host_settings.go) → acpSessionModeID (antigravity.go) → SDK session/set_mode RPC. A rejected Vibe mode fails startup and uses the existing stopCurrentAgentLocked cleanup. 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. requestPermission still 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. acpSessionModeID only 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

Reviewer Status Outcome
Go specialist + security auditor (local subagent) ADDRESSED Found absent-settings and nonfatal reset gaps; both fixed and re-reviewed PASS. Permission routing preserved.
Test engineer + constitution validator (local subagent) PASS Real startup/captured RPC, independent guard regression failures, focused race PASS; native IDs are protocol constants.
Task completion + doc sync (local subagent) ADDRESSED Both reset findings fixed; final implementation/docs A–F revalidation PASS.

CodeRabbit Review Evidence

CodeRabbit Notes

Requested 2026-11-18 ~09:19 UTC when the PR was marked ready (coderabbit-review label → trusted workflow run 44274754058). CodeRabbit replied "Review limit reached / Review rate limited" — no review arrived, wait ended on that reply per rule 25. No needs-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-vibe branch of acpSessionModeID and applySessionSettings; 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)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

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.go pins mistral-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.md documents the mapping and dontAsk limitation. 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). bypassPermissions now 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.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b475dc4 and 0db6d52.

Files selected for processing: 5

  • apps/www/src/content/docs/docs/guides/agents.md
  • packages/vm-agent/internal/acp/antigravity.go
  • packages/vm-agent/internal/acp/session_host_settings.go
  • packages/vm-agent/internal/acp/vibe_session_mode_test.go
  • tasks/archive/2026-11-17-vibe-permission-mode-translation.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@simple-agent-manager

Copy link
Copy Markdown
Contributor Author

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.

raphaeltm and others added 2 commits November 18, 2026 09:17
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 18, 2026 09:18
@simple-agent-manager simple-agent-manager Bot added the coderabbit-review Trigger CodeRabbit review for opt-in PRs label Nov 18, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T09:18:51.485269Z
We couldn’t complete this review. Comment @codex review to try again.
0db6d52 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@sonarqubecloud

Copy link
Copy Markdown

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@simple-agent-manager
simple-agent-manager Bot merged commit faa3885 into main Nov 18, 2026
30 of 52 checks passed
@simple-agent-manager
simple-agent-manager Bot deleted the sam/fix-mistral-vibe-permission-711ah9 branch November 18, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mistral Vibe denies every tool call: permission mode is sent as the session mode verbatim

1 participant