Skip to content

feat: configurable auto-safe policy with global + per-project settings#229

Open
iabdousd wants to merge 16 commits into
mainfrom
shipped-codesplitting-497
Open

feat: configurable auto-safe policy with global + per-project settings#229
iabdousd wants to merge 16 commits into
mainfrom
shipped-codesplitting-497

Conversation

@iabdousd

@iabdousd iabdousd commented May 4, 2026

Copy link
Copy Markdown
Member

Summary

  • New global Auto-safe Settings tab + per-project override section let you allow/deny tool categories (read, write, web search, web fetch domains, MCP servers) and edit Bash deny patterns. Project overrides win over globals at evaluation time; worktree-protection hard blocks remain non-disable-able.
  • Backend stores a single global policy JSON in a new `global_settings` table and per-project sparse overrides in a new `projects.auto_safe_override` column. Live sessions hold the policy in an `ArcSwap` so edits propagate without restart.
  • Renamed the per-task `TrustLevel::Normal` → `AutoSafe` (string `"normal"` → `"auto_safe"`) with a DB migration that converts existing rows. Numeric encoding unchanged so live atomics survive the rename.
  • `.verun.json` import/export now round-trips an optional `autoSafeOverride` key alongside hooks.

Spec: `docs/superpowers/specs/2026-05-02-auto-safe-policy-settings-design.md`
Plan: `docs/superpowers/plans/2026-05-02-auto-safe-policy-settings.md`

Test plan

  • `make check` (rust check + tests + clippy + tsc + vitest) — green
  • 594 Rust tests pass; 545 frontend tests pass
  • Manual end-to-end in `pnpm tauri dev`:
    • Auto-safe tab loads with seeded defaults
    • Switching Web search to `Auto-allow` lets a fresh task run `WebSearch` without prompting
    • Web fetch `Allowed domains only` with `github.com` allows `api.github.com`, prompts for `example.com`
    • Adding `npm publish` as a Bash deny pattern triggers approval; removing `rsync` lets it auto-allow
    • Per-project override of Read scope to `Anywhere on disk` is project-scoped
    • Unchecking `sudo` in a project's Bash list allows it there but still prompts elsewhere
    • Settings persist across app restart
    • Exporting + re-importing `.verun.json` round-trips `autoSafeOverride`

iabdousd added 16 commits May 2, 2026 00:59
Design for a new global Auto-safe settings tab plus per-project override
section. Replaces hardcoded policy.rs decisions with structured controls
per category (Read scope, Write scope, WebSearch, WebFetch domains, MCP
servers) and an editable Bash deny-pattern list. Per-project overrides
take precedence per-category and per-pattern; worktree-protection hard
blocks remain non-disable-able.
Backend rename + DB migration to convert existing 'normal' rows to
'auto_safe'. Numeric encoding unchanged (AutoSafe = 0).
…cher

evaluate() now consumes auto_safe::EffectivePolicy, with read scope,
write scope, web search/fetch modes, MCP server allowlist, and a
user-configurable Bash deny pattern matcher. Hard blocks unchanged.
Removed the old hardcoded check_git/check_gh/check_rm helpers and the
internal-only tests that exercised them; user-pattern tests + integration
tests via evaluate() cover the same surface.
Also fix pre-existing doctests in claude_jsonl::classify_envelope
that broke compilation because the doc examples contained raw
HTML-style envelope tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant