fix(kvb-org-queue): read an empty read-only settings file as no rules
The agent sandbox mounts an absent settings.local.json as an empty read-only file; permission() crashed on json.loads of it and the block hook refused every hold. An empty file now counts as no rules, while deny rules from settings.json still refuse. 🎯 Fix: 95 % 💥 Break: 2 % 💸 Tokens: 100 % ⏱️ Velocity: 100 % 🛡️ Security: 100 % 🏆 Score: 93 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
62da518721
commit
87fbae9226
2 files changed
+19
-1
No files matched your search
@@ -1781,7 +1781,8 @@ def permission(commands: list[str], project: Path) -> str | None:
|
||||
settings = []
|
||||
for path in settings_files(project):
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
settings.append(json.loads(path.read_text(encoding="utf-8")).get("permissions") or {})
|
||||
text = path.read_text(encoding="utf-8")
|
||||
settings.append((json.loads(text).get("permissions") or {}) if text.strip() else {})
|
||||
for decision in ("deny", "ask"):
|
||||
rules = [bash_rule(rule) for permissions in settings for rule in permissions.get(decision) or []]
|
||||
if any(rule and rule.fullmatch(command) for rule in rules for command in commands):
|
||||
|
||||
Reference in new issue
Block a user