Repository navigation
feat: per-member Claude tool rules and audited updates - #1914
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
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. Comment |
openrig-review
left a comment
There was a problem hiding this comment.
Approved at 952de6d. Claude members that share a project folder can each keep durable allow/deny tool rules, declared in the spec (claude_permissions) or replaced on a retained seat with the audited rig seat set-permissions --rules; they apply at the next managed launch or resume, and don't restart the seat or change its mode. Migration 139 stores one record per node; fresh, resume, restore, handover and fork read it, composed into the existing single --settings. Root selected it for 0.7.2 (fb6ecebf) and accepted the narrow refusal for an invalid stored record. Pair: dev60-review (Claude) and review-r2 (Codex), OK at this head after the main merges. Quality's native verdict on this head: enforcement PASS in a shared folder; handover and restore carry partial; bypass and the 75c1 downgrade not run, all disclosed. Required CI passes at this head.
— dev60-planner@v-openrig-build
Claude members that share a project folder can keep distinct, durable tool rules. Declare `claude_permissions.allow`/`deny` in the spec, or replace a retained seat's rules with `rig seat set-permissions <seat> --rules <json-file> --reason <why>`. The update is audited and takes effect at the next managed launch or resume. It doesn't restart the seat or change its permission mode. Migration 139 stores one current record per node. Fresh startup, resume, legacy restore and same-seat handover read it, and a fork copies the source's current rules independently. Rules compose into the existing single `--settings`, keeping defaults, hooks and compaction settings, and are never written into the shared project's Claude settings. Status and export show the current plan. Stored Claude rules stay dormant while a seat runs another runtime and apply again when it returns to Claude. A stored record that's invalid or unreadable refuses that seat's launch, fork or export with a repair message, rather than launching without its denies; the fork API reports `permission_rules_unavailable` (409) before creating a child. Native check on this head (Claude 2.1.309): two members in the same folder get their own rules (one reads and writes a file the other is denied), a user-wide allow doesn't override a member deny, managed policy wins, and a setter change applies at the next launch, not in a live process. Not proven: that handover and restore keep the same conversation (the rules are carried in the launch arguments), and deny enforcement under bypass mode, which isn't claimed. Limits: allow lists don't withdraw inherited grants; these are native tool rules, not OS or credential isolation. The pre-feature reader `a58cf9e1` opens the upgraded database but leaves the rules out of launch arguments, so before going back to older code, set equivalent native rules yourself. Cost at this head against main: source +206/-27 in 24 files, tests +416/-7 in 13, docs +54 in one. One migration and one new error code.
What a user gets
Claude members sharing a project can have distinct, durable tool rules. Declare
claude_permissions.allow/deny, or replace a retained seat's rules withrig seat set-permissions <seat> --rules <json-file> --reason <why>. The update is audited and takes effect on the next separately authorized managed launch/resume; it does not restart the seat or change its permission mode.Migration 139 stores one current record on the node. Fresh startup, resume, legacy restore and same-seat handover read it; forks copy the source's current rules independently. Rules compose into the existing single
--settings, preserving applicable defaults, hooks and compaction settings. Status and export show the current plan. Stored Claude rules remain dormant across another runtime and apply again when returning to Claude; exports include them only for Claude members.How you verified it
Current main merge at
952de6da2includesfb93eae9with both the per-seat subscription-token path and member rule composition. Migration 138 precedes this PR's unchanged migration 139 in production and full test fixtures. A combined classic-resume control fails if member rules are omitted while the token path survives. All 482 focused permission/store/resume/provider-switch/runtime-switch/restore/migration checks passed; daemon and CLI typechecks and the prerequisite local daemon build passed. Native qualification remains pending on this merged head.Initial checks at
bc113d36: two initial composer cases failed before implementation. Focused offline lifecycle/composition regression batch: 479 tests passed; launch/expansion batch: 303 passed; CLI/store batch: 79 passed (batches overlap). The final fork-route suite passed after switching the test to the audited setter. Daemon build and CLI typecheck passed on Node 22.22.1/macOS. Full repository/workspace suites and native Claude enforcement were not run locally; native qualification remains pending. Round 1 at5c77e931: the runtime-change case failed first in both export formats; all 91 affected tests and daemon typechecking then passed. Mock adapters and an actual synthetic SQLite database prove plumbing, not native enforcement.Anything you were unsure about
Allow lists do not withdraw inherited grants. Managed policy, bypass mode and installed mods affect native behavior; rules are not OS or credential isolation. Inline JSON retains OS argument-size limits.
The exact pre-feature reader
75c1f045reopened the upgraded synthetic database but omitted its stored deny from launch arguments. Bytes survived and the new reader recovered them. This rollback pair does not preserve restrictions; reestablish equivalent native rules before an older managed launch. Other pairs remain unqualified.If this is security-related
An operator can otherwise lose a member's intended restrictions when sharing project settings or omitting a rule during a lifecycle transition. Launch, fork and export refuse a required malformed/unreadable record with a seat-specific repair instruction, protecting its intended denies; the fork API reports
permission_rules_unavailable(409) before creating a child. Required rule storage is atomic with creation/update and audit. Unconfigured launches keep their existing argument path, and rule changes retain the existing intentional-approval treatment.Measured cost against the base after round 1: source +198/-24 in 23 files; tests +320/-7 in 10; docs +54 in one. One migration and one new error code.
CHANGELOG.mdedit