Repository navigation
feat(memory-wiki): let bridge-ownership visibility be configured, not only inferred from sandbox mode - #129191
igs-rogenlo wants to merge 5 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR adds optional ownership and delegation filters for bridge-page reads in a shared Memory Wiki vault. Example: agent-alpha may spawn agent-beta but not agent-gamma.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: the same author’s paired issue remains unresolved, and current main lacks the requested selective sharing. Product acceptance is still pending; the reviewed head also has a concrete baseline-check failure and a confirmed conflict. Priority: P3 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherMemory Wiki imports memory artifacts into Markdown pages; its query owner combines caller identity, configuration, and page ownership metadata to produce wiki search results and page content. flowchart TD
A[Memory artifacts] --> B[Bridge importer]
B --> C[Shared wiki vault]
D[CLI and agent tools] --> E[Wiki query owner]
F[Agent configuration] --> E
C --> E
E --> G[Filtered results]
Technical reviewBest possible solution: If sponsored, retain the existing query owner and default, extract the visibility implementation and its tests coherently, and validate the accepted modes through the shipped interface. Do we have a high-confidence way to reproduce the issue? Current source confirms the reported sharing behavior, but it is intentional rather than a bug; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Extending the existing visibility filter and reusing the canonical delegation resolver is coherent, subject to acceptance of the new policy and public API. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against adb12365084a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +147, Tests +313, Docs +68, Generated 0, Other +3. Total +531 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (13 earlier review cycles; latest 8 shown)
Reviewed October 18, 2026, 2:25 AM ET / 06:25 UTC (Revision 14). |
cbb694f to
74a9ef4
Compare
74a9ef4 to
656885b
Compare
|
Rebased onto current P1 — delegation resolved through the canonical spawn policy. The finding was exact: P2 — documented. Commit 3 adds Real behaviour proof. The PR body now carries a before/after transcript taken through the shipped The same harness replayed against this branch's first commit reproduces the P1 finding directly: Merge risk — rebase. Conflicts were the shared-vault import list, the two SDK surface budget counters, and the docs toggle table; all three resolved in favour of current On the decision you asked for — whether visibility should mirror effective @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
1d54d92 to
7f1df95
Compare
|
Rebased onto Config surface (this is what turned CI red)
Regenerated with
The SDK surface budgets in Data-model compatibility proofThis was the last open "Before merge" item. Short version: there is no data-model change to migrate.
For the upgrade case I did not want to assert it, so I measured it. A probe builds a vault with pre-change code, then reads that same on-disk vault with post-change code:
So an upgrade over an existing vault changes nothing, and neither does an operator writing the default value explicitly. The opt-in modes then work on those same pre-existing pages with no re-import:
The part I cannot fix from hereThis PR cannot be held in a mergeable state by an outside contributor, and that is why it sat red rather than through neglect.
I can keep racing it, but each attempt costs a full local verification cycle and the odds do not improve. Three options, and I am happy with whichever you prefer:
Everything else in the review is addressed; this is the only thing standing between the branch and a CI result. |
… only inferred from sandbox mode
`createWikiPageVisibilityFilter` already scopes bridge pages to their owning
agent using the `bridgeAgentIds` frontmatter the bridge writes at import time,
but it only engages for sandboxed callers. Everyone else reads every agent's
bridge pages. Where several non-sandboxed agents publish into one shared vault,
an agent scoped to one domain routinely retrieves — and cites — pages published
by agents in unrelated domains.
Add `bridge.ownership` so operators can decide who the existing filter applies to:
- "sandboxed-only" (default) — unchanged behaviour
- "owner" — every caller sees only bridge pages it owns
- "delegation" — additionally, agents the caller may spawn
Delegation reads `subagents.allowAgents`, so read access cannot drift away from
the delegation graph operators already maintain. It is deliberately not
transitive: an A -> B -> C chain cannot be spawned either.
Three fail-open properties, all deliberate. A read path that silently returns
nothing is indistinguishable from an empty knowledge base and so raises no error
for anyone to notice:
- Configured modes take identity only from what the caller supplied. Both
entry points substitute a default agent id for callers that supplied none,
and scoping such a caller to the default agent's view of the vault is
exactly the silent narrowing this must never do. With no supplied identity,
nothing is filtered. The legacy path keeps consuming the substituted
identity so that enabling nothing changes nothing.
- A bridge page recording no owner is treated as shared rather than hidden.
- If "delegation" is set but the agent graph cannot be read, nothing is
filtered. Narrowing a delegation viewer to owner-only scope because the
graph is missing would hide pages the operator expected and emit nothing.
Sandboxed callers keep the stricter contract, and always get "owner" semantics
regardless of the configured mode: a sandbox exists to constrain, and widening
reads for ordinary agents is not a request to loosen it.
Known limitation, documented in the code: providers that omit `agentIds` have it
coerced to `[]`, so every imported page carries empty `bridgeAgentIds` and the
configured modes are a no-op for those deployments rather than a partial filter.
Tests: eight cases added to the existing bridge-scoping suite, including one
pinning the default mode's equivalence and one covering the unreadable graph.
Both were mutation-checked — reverting either fix fails the matching test.
memory-wiki suite 472/472; oxlint and oxfmt clean;
`tsc -p tsconfig.extensions.json` and `pnpm tsgo:extensions:test` (cold cache)
both report no errors in this extension. Two pre-existing errors remain in
src/gateway and src/system-agent, which this branch does not touch.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…t target policy `bridge.ownership: "delegation"` derived its read scope by walking the roster itself: it read `appConfig.agents.list` directly, took `entry.subagents .allowAgents` verbatim, and compared ids as plain lowercase strings. That is a second copy of a policy the host already owns, and it disagreed with the original in four ways an operator can hit: - inherited `agents.defaults.subagents.allowAgents` was ignored, so delegation granted through defaults silently produced owner-only reads; - `"*"` was matched as a literal agent id, so the broadest allowlist an operator can write produced the narrowest read scope; - the allowlist was never intersected with the configured registry, so a stale entry kept granting reads for a delegation that can no longer be performed; - `allowAgents` values, roster keys, and the owner ids providers record on pages were measured with three different normalizers. Resolve the scope with `resolveSubagentAllowedTargetIds` instead, reached through the existing `agent-scope-runtime` seam alongside `resolveAgentConfig` and `listAgentIds` that this file already uses. `src/agents/tools/ agents-list-tool.ts` is the in-core precedent for consuming that policy outside sessions_spawn. Reusing it also removes the separate "delegation graph is unreadable" answer: a config with no roster, or a viewer that is not configured, now resolves exactly as sessions_spawn resolves it, to the viewer alone, so a configured mode can no longer fall back to no filtering at all. `agents.list` is an internal non-enumerable projection that config validation materializes from `agents.entries`, so reading it also tied a visibility switch to a property that any spread, clone, or serialization boundary drops. The canonical helpers read the roster through `agents.entries` and are unaffected. `sandboxed-only` is untouched: it keeps the host's substituted identity and the lowercase comparison, so enabling nothing still changes nothing. Tests build fixtures that carry both `agents.entries` and the materialized `agents.list` projection, so each new case fails against the previous implementation because of the policy and not because the fixture changed shape. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W1ryiCdWDmREYLDMHrE7ZE
The setting shipped in the manifest schema with no operator-facing documentation. Add it to the config example and the key-toggles table, describe the three modes and where the delegation scope comes from, and state the limit plainly in the docs, the plugin README, and the manifest help text: this is read-time visibility filtering for wiki tools, not filesystem access control. Every mode reads one vault directory, so any plugin, unsandboxed tool, or operator with host filesystem access still reads those pages. Also record the operator-CLI consequence, which is easy to hit and reports as nothing: `openclaw wiki search` and `openclaw wiki get` run as the default agent unless `--agent` is passed, so under `owner` and `delegation` an operator CLI read is scoped to that agent. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01W1ryiCdWDmREYLDMHrE7ZE
`pnpm config:docs:check` fails on this branch, which turns both `check-docs`
and `checks-fast-baseline-ratchets` red:
plugin: current 4138 > budget 4137; config surface grew
Hash mismatch: docs/.generated/config-baseline.sha256
The ratchet is shrink-only and asks for a conscious bump in the same PR, so
this regenerates the snapshot with `pnpm config:docs:gen` rather than editing
the counts by hand.
The delta is exactly one leaf, the setting this PR adds:
plugins.entries.memory-wiki.config.bridge.ownership
string, optional, enum [sandboxed-only, owner, delegation], tags [access]
`core` (2421) and `channel` (3728) are unchanged, and the core and channel
SHA-256 lines are byte-identical; only the combined and plugin hashes move.
The new leaf is optional and defaults to `sandboxed-only`, which is what main
does today, so the added surface is opt-in and inert until an operator sets it.
`pnpm plugins:inventory:check` also passes; CI never reached it because
`config:docs:check` failed first in the same job.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014Ryn82f1mEDwGz7pzhZrqw
7f1df95 to
05f7157
Compare
|
Rebased onto current
Validation on the pushed head (
What is left is not in the code:
If this is not something you want in core, closing is a fine answer too; it lets me plan around it. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
Updated the PR to The remaining maintainer decisions are still those in the October 5 update: whether to accept the opt-in ownership/delegation modes and resolver SDK export, and whether to use a coordinated green-queue window or regenerate the config baselines at merge time. The branch currently conflicts with main. Please indicate the preferred design and merge approach so the next update can follow that decision. |
|
Thanks @igs-rogenlo for identifying the shared-vault use case and developing this proposal. We landed the minimal owner-scoped option in #189336: #189336, preserving today's default and sandbox restrictions. Both human commit-author identities are credited in the merged commit. Closing this proposal as superseded by that merged replacement. |
Related: #144630
What Problem This Solves
memory-wikialready records who owns a bridge page:bridge.tswritesbridgeAgentIdsinto every imported source page's frontmatter, and
createWikiPageVisibilityFilteralready uses that field to keep a caller from reading another agent's bridge pages.
That filter only ever engages for sandboxed callers. For everyone else it returns
() => true. So in a deployment where several non-sandboxed agents publish into oneshared vault, a search issued by an agent scoped to one domain returns pages published by
agents in unrelated domains, and the agent may then reason over and cite them. Nothing
fails — that is the documented behaviour — but the retrieved context is wider than the
agent's remit, and operators have no way to narrow it short of giving every agent its own
vault.
For a single-agent or small personal setup the shared view is the point, and this changes
nothing for those users.
Why This Change Was Made
Add a
bridge.ownershipoption so operators can decide who the existing filter appliesto, rather than having it inferred solely from sandbox mode:
"sandboxed-only"— default; unchanged behaviour"owner"— every caller sees only bridge pages it owns"delegation"— additionally, the agents the caller is already allowed to spawn"delegation"resolves its scope throughresolveSubagentAllowedTargetIds— the samecanonical policy
sessions_spawnenforces — rather than reading the roster itself, so readvisibility cannot drift away from the delegation graph operators already maintain and no new
configuration vocabulary is introduced. That covers keyed
agents.entries, inheritedagents.defaults.subagents.allowAgents,"*"expansion, and intersection with the configuredregistry. It is deliberately not transitive: an A → B → C chain cannot be spawned either,
so granting reads across it would describe a delegation that cannot happen.
Ownership comes from data that already exists. No filename parsing, no new write
path, no migration, and no extra I/O at read time —
bridgeAgentIdsis already on thepage summary the filter receives.
Three fail-open properties, all deliberate. A read path that throws or silently
returns nothing is indistinguishable from an empty knowledge base: it produces no error
for anyone to see, so it tends to be noticed late and diagnosed slowly. Accordingly:
getMemoryWikiPageandsearchMemoryWikisubstitute a default agent idfor callers that supplied none. Scoping such a caller would silently hand it whichever
agent happens to be the default — a foreign view of the vault, returned without error.
Configured modes therefore take identity only from what the caller supplied, and
filter nothing when none was supplied. The legacy path keeps consuming the substituted
identity, so enabling nothing changes nothing.
orphaned-and-hidden.
A config with no roster, or a viewer that is not configured, resolves exactly as
sessions_spawnresolves it — to the viewer alone. An earlier revision filtered nothingin that case, which meant a configured mode could silently degrade to no filtering at
all; reusing the canonical policy removes that path.
Sandbox semantics are held constant. Sandboxed callers keep the stricter contract and
always get
"owner"semantics regardless of the configured mode. A sandbox exists toconstrain; an operator widening reads for ordinary agents is not thereby asking to loosen
the sandbox boundary.
Non-goal: this is not an access-control boundary, and should not be described as one.
It filters tool results; it does not protect files. Any caller with direct filesystem
access to the vault bypasses it entirely. Genuinely sensitive material must be kept out of
a shared vault at publication time. A reviewer who wants this to be access control should
reject that framing rather than this patch.
User Impact
Operators running several agents against one shared vault can scope bridge-page reads to
ownership, or to ownership plus delegation, using the graph they already maintain. Agents
stop citing material from domains they do not own.
Nothing changes for anyone who does not set the option:
"sandboxed-only"is the defaultand preserves current behaviour, including for sandboxed callers.
Limitations operators should know before enabling it:
have no single owner and stay global. In a mature vault these are often a large share of
pages, so expect partial coverage rather than a clean partition.
agentIdsget no filtering at all. That field is coerced to[]when absent, so every imported page carries empty
bridgeAgentIdsand — by fail-openproperty 2 — stays globally visible. For those deployments the configured modes are a
no-op rather than a partial filter. This is called out in a code comment at the check.
listing, for example) may list other agents' page titles even when those pages are
filtered. Titles, not contents.
corpus search, so a narrowly-scoped caller can receive fewer than
maxResultseven whenmore readable pages exist further down the ranking.
incrementally and compare search results before and after.
there is no override short of widening
allowAgents.Evidence
Current follow-up validation
The follow-up at
7afad54b6836b5afc41959382186e11c995ed5c8removes one obsolete generated mock-factory baseline entry for the existingagent-scope-runtimemock inquery.test.ts. That mock already spreadsimportOriginal; no runtime, test, scanner, configuration, or dependency source changes in this follow-up.Using this checkout's own frozen dependencies (pnpm 12.5.1 and the locked TypeScript compiler):
--prunegenerator reduced the ledger from 10,711 to 10,710 entries.git diff --checkalso passed.config/test-mock-exports-baseline.txt.These checks cover the generated-file maintenance only. Earlier feature validation is retained below as historical evidence; the full feature suite and hosted CI have not been rerun for this follow-up. The maintainer decision on the opt-in visibility modes and the SDK resolver export remains open.
Real behaviour, before and after
Driven through the shipped entry points —
searchMemoryWiki()andgetMemoryWikiPage(),the two functions the
wiki_searchandwiki_gettools call — against a scratch sharedvault holding four pages: three bridge pages owned by
agent-alpha,agent-betaandagent-gamma, and one ordinary page with no owner. The roster is keyedagents.entries, andagent-alphamay spawnagent-betaonly. Every identifier issynthetic, so nothing here is redacted. Viewer is
agent-alpha, non-sandboxed, throughout.Both scoped modes hide what they should and keep the unowned page readable;
delegationreaches
agent-betaand stops atagent-gamma; the default leaves reads untouched.The delegation finding, reproduced and fixed
The P1 review finding — that
delegationcould leave a shared vault unfiltered on normalkeyed configuration — reproduces on exactly the run above. Replaying the same harness against
the first commit of this branch, which read
agents.listdirectly, with the sameagents.entriesroster:agents.listis an internal non-enumerable projection materialized fromagents.entries, sothe lookup returned nothing and the later null path fell through to
() => true— theoperator selected
delegationand got no filtering at all. Resolving throughresolveSubagentAllowedTargetIds(commit 2) produces the 3-page result above instead.Historical feature checks (earlier revisions)
main(d331583bbf0); conflicts were the shared-vaultimport list, the SDK surface budget counters, and the docs toggle table
memory-wikiextension suite: 524 passed (43 files)oxlintandoxfmt --check: clean on every changed source filepnpm tsgo:extensions:test: clean, no errorspnpm config:docs:checkandpnpm plugins:inventory:check: pass after a conscious baseline bumpConfig surface.
docs/.generated/config-baseline.counts.jsonmovespluginfrom 4137 to4138. The delta is exactly one leaf — the setting this PR adds:
core(2421) andchannel(3728) are unchanged and their SHA-256 lines are byte-identical;only the combined and plugin hashes move. The leaf is optional and defaults to
sandboxed-only, which is whatmaindoes today, so the added surface is opt-in and inertuntil an operator sets it. Regenerated with
pnpm config:docs:genrather than hand-edited.plugins:inventory:checkis listed here because CI never reached it —config:docs:checkfailed first in the same job.
Test coverage for the behaviour above lives in the existing
wiki corpus bridge page agent scopingsuite, alongside the sandboxed cases that already covered this filter:"owner"scopes reads to the caller; non-bridge and unowned pages stay readable"delegation"reaches delegates but not delegates-of-delegates"delegation"resolves through keyedagents.entries, inherited defaults,"*"expansion, and the configured registry, matching
sessions_spawnFixtures carry both
agents.entriesand the materializedagents.listprojection, so eachdelegation case fails against the previous implementation because of the policy rather than
because the fixture changed shape. The cases pinning fail-open behaviour were
mutation-checked: reverting either fix makes the matching test fail.
config.test.ts's documented-shape case includesownership, because that case validatesagainst
openclaw.plugin.json— the manifest layer that gates operator config. Adding thekey to the zod schema alone would have left every non-default mode rejected by host
validation while the unit tests still passed.
Open questions
bridge.ownership: delegationshould mirror effectivesessions_spawntargets or have anindependent graph. Commit 2 takes the first option and consumes the canonical resolver
through the existing
agent-scope-runtimeseam, followingsrc/agents/tools/agents-list-tool.tsas the in-core precedent for reading that policy outside
sessions_spawn. Say the word ifyou would rather visibility had its own graph and I will unpick it.
"sandboxed-only"remain the default indefinitely, or would you want"owner"tobecome the default in a future major version?
That is deliberate, but if you would rather have one rule for both, I would rather change
it now than document the difference.