Repository navigation
feat(reef): operator-configurable sharing rules for the guard - #131167
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Adds channels.reef.guard.rules with capped outbound/inbound free-text policy. Rules ride the trusted instruction side of the guard call only, may tighten decisions or explicitly allow otherwise-review cases, and can never override the deny floor or deterministic checks. The rules text is hashed into the effective policy version so audit rows and pending review approvals bind to the exact policy in force.
5a224b8 to
ebf6c6b
Compare
Live guard proof (real provider, changed adapter path)Ran the changed What this demonstrates on the live model:
The credential in the floor test is a synthetic |
|
Codex review: found issues before merge. Reviewed August 27, 2026, 4:35 PM ET / 20:35 UTC. ClawSweeper reviewWhat this changesAdds optional directional free-text sharing rules to Reef’s guard, passes them to provider instructions, and incorporates them into guard policy versioning. Merge readinessKeep open: the feature is not on current main, but its introduced validation mismatch and truncated approval-policy identity make the patch incorrect before merge. Priority: P2 Review scores
Verification
How this fits togetherReef applies deterministic checks and a provider-backed guard to inbound and outbound messages before delivery or owner review. Guard policy versioning is carried into verdict validation, review approvals, and the audit chain. flowchart LR
A[Reef channel configuration] --> B[Guard rules]
B --> C[Effective policy version]
B --> D[Provider guard instructions]
E[Inbound or outbound message] --> F[Deterministic checks]
F --> D
D --> G[Guard verdict]
C --> G
G --> H[Delivery or owner review]
Decision needed
Why: This creates a persistent operator policy contract, and repository policy requires explicit approval before adding configuration options. Before merge
Findings
Agent review detailsSecurityNeeds attention: The newly introduced policy identifier is truncated before it is used to bind review approvals and audit context. PR surfaceSource +101, Tests +144, Docs +6, Generated 0. Total +251 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt one raw-string validation contract across manifest metadata and Zod, then bind reviews and audit records to a collision-resistant canonical rules digest. Do we have a high-confidence way to reproduce the issue? Yes from source: generated raw channel validation accepts whitespace-only rules while Reef’s runtime parser rejects them; this read-only review did not execute the path. Is this the best way to solve the issue? No: configuration validation differs by boundary and the intended exact policy binding uses only a 32-bit digest prefix. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d56e2c42c934. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…idation ClawSweeper review fixes: use the untruncated sha256 rules digest in the effective policy version so approvalDigest stays collision-resistant, and express identical non-blank (\S) rule validation in the zod schema, the manifest JSON Schemas, and the generated channel metadata instead of a trim-transform mismatch.
|
Both actionable findings are addressed in 59537e2:
On the decision-needed item: the new config surface was explicitly approved by the repository owner in chat before implementation (scope: outbound + inbound rules), per the root AGENTS.md config-approval gate. |
|
Merged via squash.
|
Post-land deployment proof (live gateway, real relay)Deployed release
All three verdict paths exercised live on the shipped code path with operator rules in force. |
* refactor(reef): drop hand-maintained manifest schema copies The reef manifest duplicated the full channel config schema into both configSchema and channelConfigs.reef.schema, and the channelConfigs copy silently overrode the zod-derived generated bundled channel metadata in config validation - three surfaces to keep in sync by hand (the trap that bit #131167). Match sibling bundled channel plugins: stub plugin-level configSchema, no channelConfigs copy; the generated metadata (from the zod schema, CI-checked) is the single channel-schema source. * fix(reef): doctor migration for stray plugins.entries.reef.config The retired full plugin-entry schema let a Control UI plugin form park reef settings under plugins.entries.reef.config where the runtime never read them. Doctor now reports the location and --fix moves the keys into channels.reef (channel values stay authoritative; the move only commits when the merged record parses, so a fix can never corrupt valid config).
…aw#131167) * feat(reef): operator-configurable sharing rules for the guard Adds channels.reef.guard.rules with capped outbound/inbound free-text policy. Rules ride the trusted instruction side of the guard call only, may tighten decisions or explicitly allow otherwise-review cases, and can never override the deny floor or deterministic checks. The rules text is hashed into the effective policy version so audit rows and pending review approvals bind to the exact policy in force. * fix(reef): full rules digest in policy identity; align blank-rule validation ClawSweeper review fixes: use the untruncated sha256 rules digest in the effective policy version so approvalDigest stays collision-resistant, and express identical non-blank (\S) rule validation in the zod schema, the manifest JSON Schemas, and the generated channel metadata instead of a trim-transform mismatch.
…#131292) * refactor(reef): drop hand-maintained manifest schema copies The reef manifest duplicated the full channel config schema into both configSchema and channelConfigs.reef.schema, and the channelConfigs copy silently overrode the zod-derived generated bundled channel metadata in config validation - three surfaces to keep in sync by hand (the trap that bit openclaw#131167). Match sibling bundled channel plugins: stub plugin-level configSchema, no channelConfigs copy; the generated metadata (from the zod schema, CI-checked) is the single channel-schema source. * fix(reef): doctor migration for stray plugins.entries.reef.config The retired full plugin-entry schema let a Control UI plugin form park reef settings under plugins.entries.reef.config where the runtime never read them. Doctor now reports the location and --fix moves the keys into channels.reef (channel values stay authoritative; the move only commits when the merged record parses, so a fix can never corrupt valid config).
What Problem This Solves
Reef ships a fail-closed model guard in both directions, but its policy was fixed prompt text baked into the plugin. Operators had no way to say what their claw considers okay to share with friends — "never mention project X", "client names are off-limits", "medical scheduling with @doc is fine" — and
guard.policyVersionis only an audit-echo token, not policy content. The only per-friend knob (autonomy tier) governs reply budgets, not content.Why This Change Was Made
Adds
channels.reef.guard.rules— operator-authored free text,outbound(DLP classifier) andinbound(injection screen), each capped at 2,000 characters. Design boundaries:GuardRequestas untrusted input, so rules are injected at adapter construction and a peer message can never spoof or read them (pinned by a test).reef-v1+<8-hex>), which flows into the existing verdict echo check, the hash-chained audit, andapprovalDigest— editing rules automatically invalidates review approvals still pending under the old policy (fail closed, never approve under a policy the owner changed).The plugin manifest's JSON Schema copies (
configSchemaandchannelConfigs.reef.schema) and the generated bundled channel config metadata are updated in the same change so discovery, config validation, and docs example validation agree with the zod schema.User Impact
Reef operators can now define what is okay to share in their own words, per direction and per friend, in
channels.reef.guard.rules. Existing configs are unaffected: the field is optional, and without it guard behavior and the effective policy version are byte-identical to before. Docs:docs/channels/reef.md(Configuration + Guards sections).Evidence
node scripts/run-vitest.mjs extensions/reef— 23 files, 304 tests green, including new coverage: direction-matched instruction framing, rules-never-in-untrusted-input invariant, construction-time caps, effective-policy-version binding, flow-level send under the rules-bound policy version, and config schema accept/reject cases.node scripts/check-changed.mjs— all lanes green (format, tsgo typecheck core/extensions/tests, lint, import cycles, bundled channel config metadata, plugin boundaries, knip).pnpm docs:check-config-examples— green; the reef docs config example validates against the updated manifest schema.