Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-05-11 11:44:53 +02:00 committed by GitHub
parent b23f49e5f4
commit 626f905186
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 702 additions and 183 deletions

View file

@ -50,7 +50,7 @@ class TestApproveAlwaysPermanentWithGranularPermissions:
agent.approve_always("bash", perms, save_permanently=True)
persisted = _read_persisted_config(config_dir)
assert persisted["tools"]["bash"]["allowlist"] == ["npm install *"]
assert persisted["tools"]["bash"]["allowlist"] == ["npm install"]
def test_also_adds_session_rules(self, config_dir: Path):
agent = build_test_agent_loop()
@ -75,9 +75,7 @@ class TestApproveAlwaysPermanentWithGranularPermissions:
assert "bash" not in persisted.get("tools", {})
def test_does_not_duplicate_existing_allowlist_entries(self, config_dir: Path):
config = build_test_vibe_config(
tools={"bash": {"allowlist": ["npm install *"]}}
)
config = build_test_vibe_config(tools={"bash": {"allowlist": ["npm install"]}})
agent = build_test_agent_loop(config=config)
perms = self._make_permissions()
@ -88,14 +86,14 @@ class TestApproveAlwaysPermanentWithGranularPermissions:
assert persisted.get("tools", {}).get("bash", {}).get("allowlist") is None
def test_appends_new_patterns_to_existing_allowlist(self, config_dir: Path):
config = build_test_vibe_config(tools={"bash": {"allowlist": ["git *"]}})
config = build_test_vibe_config(tools={"bash": {"allowlist": ["git"]}})
agent = build_test_agent_loop(config=config)
perms = self._make_permissions()
agent.approve_always("bash", perms, save_permanently=True)
persisted = _read_persisted_config(config_dir)
assert persisted["tools"]["bash"]["allowlist"] == ["git *", "npm install *"]
assert persisted["tools"]["bash"]["allowlist"] == ["git", "npm install"]
def test_multiple_permissions_persisted(self, config_dir: Path):
agent = build_test_agent_loop()
@ -117,4 +115,4 @@ class TestApproveAlwaysPermanentWithGranularPermissions:
agent.approve_always("bash", perms, save_permanently=True)
persisted = _read_persisted_config(config_dir)
assert persisted["tools"]["bash"]["allowlist"] == ["/tmp/*", "npm install *"]
assert persisted["tools"]["bash"]["allowlist"] == ["/tmp/*", "npm install"]