Skip to content

feat(memory-wiki): let bridge-ownership visibility be configured, not only inferred from sandbox mode - #129191

Closed
igs-rogenlo wants to merge 5 commits into
openclaw:mainfrom
igs-rogenlo:feat/wiki-bridge-ownership-visibility
Closed

igs-rogenlo wants to merge 5 commits into
openclaw:mainfrom
igs-rogenlo:feat/wiki-bridge-ownership-visibility

Conversation

@igs-rogenlo

@igs-rogenlo igs-rogenlo commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144630

What Problem This Solves

memory-wiki already records who owns a bridge page: bridge.ts writes bridgeAgentIds
into every imported source page's frontmatter, and createWikiPageVisibilityFilter
already 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 one
shared 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.ownership option so operators can decide who the existing filter applies
to, 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 through resolveSubagentAllowedTargetIds — the same
canonical policy sessions_spawn enforces — rather than reading the roster itself, so read
visibility cannot drift away from the delegation graph operators already maintain and no new
configuration vocabulary is introduced. That covers keyed agents.entries, inherited
agents.defaults.subagents.allowAgents, "*" expansion, and intersection with the configured
registry. 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 — bridgeAgentIds is already on the
page 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:

  1. Identity. getMemoryWikiPage and searchMemoryWiki substitute a default agent id
    for 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.
  2. Unowned pages. A bridge page recording no owner is treated as shared rather than
    orphaned-and-hidden.
  3. Unresolvable delegation graph. There is no separate answer to invent here any more.
    A config with no roster, or a viewer that is not configured, resolves exactly as
    sessions_spawn resolves it — to the viewer alone. An earlier revision filtered nothing
    in 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 to
constrain; 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 default
and preserves current behaviour, including for sandboxed callers.

Limitations operators should know before enabling it:

  • Only bridge pages are scoped. Native pages, compiled indexes, and generated reports
    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.
  • Providers that omit agentIds get no filtering at all. That field is coerced to []
    when absent, so every imported page carries empty bridgeAgentIds and — by fail-open
    property 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.
  • Aggregate pages can still expose titles. An unowned aggregate report (a stale-page
    listing, for example) may list other agents' page titles even when those pages are
    filtered. Titles, not contents.
  • Search returns fewer results rather than back-filling. Filtering happens after the
    corpus search, so a narrowly-scoped caller can receive fewer than maxResults even when
    more readable pages exist further down the ranking.
  • The symptom of over-narrowing is quiet — fewer results, no error. Enable
    incrementally and compare search results before and after.
  • Non-transitivity may surprise deployments that model deep delegation chains, and
    there is no override short of widening allowAgents.

Evidence

Current follow-up validation

The follow-up at 7afad54b6836b5afc41959382186e11c995ed5c8 removes one obsolete generated mock-factory baseline entry for the existing agent-scope-runtime mock in query.test.ts. That mock already spreads importOriginal; 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):

  • The native mock-export ratchet reproduced exactly the stale tuple and exited 1.
  • Its native --prune generator reduced the ledger from 10,711 to 10,710 entries.
  • The regular ratchet then exited 0; git diff --check also passed.
  • The resulting patch is one deletion in 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() and getMemoryWikiPage(),
the two functions the wiki_search and wiki_get tools call — against a scratch shared
vault holding four pages: three bridge pages owned by agent-alpha, agent-beta and
agent-gamma, and one ordinary page with no owner. The roster is keyed
agents.entries, and agent-alpha may spawn agent-beta only. Every identifier is
synthetic, so nothing here is redacted. Viewer is agent-alpha, non-sandboxed, throughout.

=== BEFORE — default, current main behaviour (bridge.ownership=sandboxed-only) ===
wiki_search("quarterly forecast") as agent-alpha -> 4 pages
  - sources/alpha-forecast.md
  - sources/beta-forecast.md
  - sources/gamma-forecast.md
  - sources/handbook-forecast.md
wiki_get("sources/beta-forecast.md") as agent-alpha -> page returned
wiki_get("sources/gamma-forecast.md") as agent-alpha -> page returned

=== AFTER — ownership: owner ===
wiki_search("quarterly forecast") as agent-alpha -> 2 pages
  - sources/alpha-forecast.md
  - sources/handbook-forecast.md
wiki_get("sources/beta-forecast.md") as agent-alpha -> null (not visible)
wiki_get("sources/gamma-forecast.md") as agent-alpha -> null (not visible)

=== AFTER — ownership: delegation (alpha may spawn beta) ===
wiki_search("quarterly forecast") as agent-alpha -> 3 pages
  - sources/alpha-forecast.md
  - sources/beta-forecast.md
  - sources/handbook-forecast.md
wiki_get("sources/beta-forecast.md") as agent-alpha -> page returned
wiki_get("sources/gamma-forecast.md") as agent-alpha -> null (not visible)

Both scoped modes hide what they should and keep the unowned page readable; delegation
reaches agent-beta and stops at agent-gamma; the default leaves reads untouched.

The delegation finding, reproduced and fixed

The P1 review finding — that delegation could leave a shared vault unfiltered on normal
keyed configuration — reproduces on exactly the run above. Replaying the same harness against
the first commit of this branch, which read agents.list directly, with the same
agents.entries roster:

=== ownership: delegation — first commit (reads agents.list) ===
wiki_search("quarterly forecast") as agent-alpha -> 4 pages
  - sources/alpha-forecast.md
  - sources/beta-forecast.md
  - sources/gamma-forecast.md      <-- alpha cannot spawn gamma; page should be hidden
  - sources/handbook-forecast.md
wiki_get("sources/gamma-forecast.md") as agent-alpha -> page returned

agents.list is an internal non-enumerable projection materialized from agents.entries, so
the lookup returned nothing and the later null path fell through to () => true — the
operator selected delegation and got no filtering at all. Resolving through
resolveSubagentAllowedTargetIds (commit 2) produces the 3-page result above instead.

Historical feature checks (earlier revisions)

  • an earlier revision was rebased onto main (d331583bbf0); conflicts were the shared-vault
    import list, the SDK surface budget counters, and the docs toggle table
  • memory-wiki extension suite: 524 passed (43 files)
  • SDK surface report: exports 4452, callable exports 2631 — both budgets raised by one for the newly public resolver
  • oxlint and oxfmt --check: clean on every changed source file
  • pnpm tsgo:extensions:test: clean, no errors
  • pnpm config:docs:check and pnpm plugins:inventory:check: pass after a conscious baseline bump

Config surface. docs/.generated/config-baseline.counts.json moves plugin from 4137 to
4138. 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 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 what main does today, so the added surface is opt-in and inert
until an operator sets it. Regenerated with pnpm config:docs:gen rather than hand-edited.
plugins:inventory:check is listed here because CI never reached it — config:docs:check
failed first in the same job.

Test coverage for the behaviour above lives in the existing wiki corpus bridge page agent scoping suite, alongside the sandboxed cases that already covered this filter:

  • default mode leaves non-sandboxed reads untouched
  • default mode preserves the legacy sandboxed contract when the caller supplies no identity
  • "owner" scopes reads to the caller; non-bridge and unowned pages stay readable
  • "delegation" reaches delegates but not delegates-of-delegates
  • "delegation" resolves through keyed agents.entries, inherited defaults, "*"
    expansion, and the configured registry, matching sessions_spawn
  • configured filtering fails open when the caller supplied no identity
  • sandboxed isolation stays strict regardless of the configured mode
  • the same scoping applies to search results, not only page reads

Fixtures carry both agents.entries and the materialized agents.list projection, so each
delegation 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 includes ownership, because that case validates
against openclaw.plugin.json — the manifest layer that gates operator config. Adding the
key to the zod schema alone would have left every non-default mode rejected by host
validation while the unit tests still passed.

Open questions

  • Delegation semantics — resolved as you recommended. The review asked whether
    bridge.ownership: delegation should mirror effective sessions_spawn targets or have an
    independent graph. Commit 2 takes the first option and consumes the canonical resolver
    through the existing agent-scope-runtime seam, following src/agents/tools/agents-list-tool.ts
    as the in-core precedent for reading that policy outside sessions_spawn. Say the word if
    you would rather visibility had its own graph and I will unpick it.
  • Should "sandboxed-only" remain the default indefinitely, or would you want "owner" to
    become the default in a future major version?
  • The unowned-page rule differs between sandboxed (hidden) and configured (shared) modes.
    That is deliberate, but if you would rather have one rule for both, I would rather change
    it now than document the difference.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This 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.

  • Before: A non-sandboxed agent-alpha can retrieve all three agents’ bridge pages.
  • After: With bridge.ownership set to delegation, agent-alpha sees alpha and beta bridge pages, while gamma’s pages are filtered.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The implementation is coherent and preserves existing stored data, but its exact-head baseline gate fails, shipped-entry-point proof is incomplete, and product acceptance remains unresolved.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Agents sharing a global vault can retrieve and cite bridge material outside their intended domain.
Reason: The request has a concrete selective-sharing use case, but adds a retrieval policy and public SDK contract without recorded owner acceptance.

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
Reviewed head: 05f71575135e7bb8d0fa0239ae237bacb0cbfb6b
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should Memory Wiki support these opt-in shared-vault visibility modes and expose the spawn-target resolver as a supported Plugin SDK contract?
  • Recommendation: Sponsor the bounded opt-in design: Accept the unchanged default, partial bridge-only filtering, and canonical delegation resolver as the supported direction.
  • Why: Ordinary shared reads are intentional, and implementation evidence does not establish acceptance of the new retrieval policy or public API.

Before merge

  • Add real behavior proof - The contributor’s transcript exercises searchMemoryWiki and getMemoryWikiPage against a real scratch vault, demonstrating ownership and delegation filtering in process. It does not exercise the shipped CLI or Gateway entry point required for this external PR. Supply terminal output or logs covering those modes and a latest-stable upgrade, redacting credentials, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Extract bridge visibility code and tests to clear the line-cap gate (P2) - The additions fail the exact-head baseline check: query.ts grows from 1011 to 1073 counted lines and query.test.ts from 1690 to 1929, exceeding their inherited allowances. The aggregate CI gate consequently fails. Move the visibility implementation and bridge-scoping suite into coherent sibling modules while retaining their behavior and coverage; the ratchet explicitly rejects raising allowances or disabling max-lines. This is a late finding: the same code and failed annotations were already available at the previously reviewed head.
  • Complete next step - Resolve GitHub’s confirmed merge conflict against main while preserving the reviewed feature scope.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

  • [P2] Extract bridge visibility code and tests to clear the line-cap gate — extensions/memory-wiki/src/query.ts:774-778

Tests

  • Missing end-to-end proof: Supply a redacted shipped CLI or Gateway run showing default, owner, and delegation results, including a latest-stable upgrade with existing settings and vault data intact.
Agent review details

How this fits together

Memory 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]
Loading

Technical review

Best 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:

  • [P2] Extract bridge visibility code and tests to clear the line-cap gate — extensions/memory-wiki/src/query.ts:774-778
    The additions fail the exact-head baseline check: query.ts grows from 1011 to 1073 counted lines and query.test.ts from 1690 to 1929, exceeding their inherited allowances. The aggregate CI gate consequently fails. Move the visibility implementation and bridge-scoping suite into coherent sibling modules while retaining their behavior and coverage; the ratchet explicitly rejects raising allowances or disabling max-lines. This is a late finding: the same code and failed annotations were already available at the previously reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against adb12365084a.

Provenance checked

  • Shared-vault and sandbox visibility keeps the original intent (cdab176: The merged isolation fix intentionally restricted sandboxed bridge reads while preserving ordinary global sharing.)
  • Opt-in non-sandboxed visibility changes intended behavior with a stated reason (cdab176: Ordinary callers historically shared the global vault; this PR explains why operators may want narrower retrieval without separate vaults.)
  • Strict session-agent SDK aliases keeps the original intent (8b1e44c: Bundled plugins use strict resolution while published legacy aliases retain their compatibility window.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Current main retains unrestricted ordinary reads: The current visibility predicate immediately allows all pages for non-sandboxed callers, and the bridge configuration has no ownership setting. (extensions/memory-wiki/src/query.ts:667, adb12365084a)
  • Introduced implementation: The pinned introduction diff adds one optional setting, extends the existing visibility owner, and consumes the canonical subagent-target policy through an additive SDK export. (extensions/memory-wiki/src/query.ts:774, 05f71575135e)
  • Original sharing contract: The merged sandbox isolation change deliberately retained ordinary global-vault sharing; steipete’s earlier discussion also described that sharing as intentional. (extensions/memory-wiki/src/query.ts:673, cdab1764841a)
  • Exact-head CI failure: The baseline job reports query.ts growing from 1011 to 1073 counted lines and query.test.ts from 1690 to 1929. These diff-caused violations also fail the aggregate CI gate; the annotations were available before the previous completed review. (extensions/memory-wiki/src/query.ts:1, 05f71575135e)
  • Proof and compatibility evidence: The complete body supplies before/after output from direct query-function calls. The September 17 contributor comment additionally compares reads of an existing vault before and after the change with the default unchanged; neither records a shipped CLI or Gateway run. (05f71575135e)
  • Live merge state and ownership decision: GitHub still reports the pinned head as dirty and unmergeable, with no assignees or requested reviewers; the discussion contains no maintainer approval of the new configuration and SDK direction. (05f71575135e)

PR surface

Source +147, Tests +313, Docs +68, Generated 0, Other +3. Total +531 across 12 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 157 10 +147
Tests 2 316 3 +313
Docs 3 85 17 +68
Config 0 0 0 0
Generated 2 3 3 0
Other 1 5 2 +3
Total 12 566 35 +531

Review metrics

Metric Value Why it matters
Configuration surface 1 optional enum setting with 3 values Adds an operator-facing retrieval policy while preserving the existing default.
Public SDK surface 1 additional callable export Promotes the canonical spawn-target resolver to a supported plugin contract.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P3: This is an optional retrieval-policy feature; current ordinary shared reads satisfy the established contract.
  • merge-risk: 🚨 compatibility: The additive public SDK export creates a supported contract that needs explicit acceptance alongside the new configuration surface.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-11T02:36:22.231Z sha 656885b3666dd52712c039685b0be12aa4d868c0 :: blocked before merge. :: none
  • reviewed 2026-09-11T03:42:44.221Z sha 656885b3666dd52712c039685b0be12aa4d868c0 :: blocked before merge. :: none
  • reviewed 2026-09-17T07:10:52.569Z sha 1d54d9207d3bfa696323b75b235fe42d04ba0651 :: blocked before merge. :: none
  • reviewed 2026-09-17T08:39:21.078Z sha 7f1df95d510ebbdafb7a2ba88f2546fad98ad78b :: blocked before merge. :: none
  • reviewed September 22, 2026, 7:54 AM ET / 11:54 UTC (Revision 10) sha unknown :: blocked before merge. :: none
  • reviewed September 22, 2026, 7:54 AM ET / 11:54 UTC (Revision 11) sha unknown :: blocked before merge. :: none
  • reviewed September 22, 2026, 8:20 AM ET / 12:20 UTC (Revision 12) sha unknown :: blocked before merge. :: none
  • reviewed 2026-10-05T09:50:59.862Z sha 05f7157 :: blocked before merge. :: none

Reviewed October 18, 2026, 2:25 AM ET / 06:25 UTC (Revision 14).

@igs-rogenlo
igs-rogenlo force-pushed the feat/wiki-bridge-ownership-visibility branch from cbb694f to 74a9ef4 Compare August 25, 2026 10:05
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 30, 2026
@igs-rogenlo
igs-rogenlo force-pushed the feat/wiki-bridge-ownership-visibility branch from 74a9ef4 to 656885b Compare September 11, 2026 02:30
@igs-rogenlo

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (d331583bbf0) and addressed the blocking list.

P1 — delegation resolved through the canonical spawn policy. The finding was exact: agents.list is an internal non-enumerable projection materialized from agents.entries, so on normal keyed configuration the lookup returned nothing and the later null path fell through to () => true — an operator who selected delegation got no filtering at all. Commit 2 resolves the scope with resolveSubagentAllowedTargetIds through the existing agent-scope-runtime seam, so keyed entries, inherited agents.defaults, "*" expansion, and registry intersection all follow sessions_spawn. That also removed the separate "graph unreadable" fail-open: an unconfigured viewer now resolves to itself, exactly as sessions_spawn resolves it.

P2 — documented. Commit 3 adds bridge.ownership to the Memory Wiki configuration guide and its Key toggles table, plus the extension README, stating the default, the modes, which page types are scoped, and that it is a visibility filter rather than filesystem access control.

Real behaviour proof. The PR body now carries a before/after transcript taken through the shipped searchMemoryWiki() / getMemoryWikiPage() entry points against a shared vault of four pages — three bridge-owned, one unowned — with a keyed agents.entries roster where agent-alpha may spawn agent-beta only. Default returns all 4 pages; owner returns 2; delegation returns 3 and wiki_get on the non-delegate returns null. Every identifier is synthetic, so nothing is redacted out of it.

The same harness replayed against this branch's first commit reproduces the P1 finding directly: delegation returned all 4 pages, including the agent the viewer cannot spawn. That transcript is in the body next to the fixed one.

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 main with our one line added. memory-wiki suite 524 passed (43 files), pnpm tsgo:extensions:test clean, oxlint and oxfmt --check clean, and the SDK surface report now reports exactly the budgeted 4452 / 2631.

On the decision you asked for — whether visibility should mirror effective sessions_spawn targets or have an independent graph — I took your recommendation and mirrored the policy rather than inventing a second graph. Happy to unpick that if you would rather it were independent.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: L and removed size: M labels Sep 17, 2026
@igs-rogenlo
igs-rogenlo force-pushed the feat/wiki-bridge-ownership-visibility branch from 1d54d92 to 7f1df95 Compare September 17, 2026 08:31
@igs-rogenlo

Copy link
Copy Markdown
Contributor Author

Rebased onto 943eeaa4f5 and addressed the two remaining items that were mine. There is also a process problem at the end of this that I cannot solve from outside the repo, and I would rather raise it than keep force-pushing.

Config surface (this is what turned CI red)

config:docs:check was failing, which took check-docs and checks-fast-baseline-ratchets with it — same root cause, one job just reached it first:

plugin: current 4138 > budget 4137; config surface grew
Hash mismatch: docs/.generated/config-baseline.sha256

Regenerated with pnpm config:docs:gen rather than hand-editing the ratchet. Post-rebase the numbers move to plugin 4215 → 4216, and 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 (2444) and channel (3738) are unchanged and their SHA-256 lines are byte-identical; only the combined and plugin hashes move. The leaf 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.

The SDK surface budgets in scripts/plugin-sdk-surface-report.mts conflicted with main's own raises; I kept main's list and appended this PR's +1 rationale, then confirmed the numbers by running the tool rather than by arithmetic: unique entrypoint-qualified exports: 4483, callable exports: 2647, exit 0.

Data-model compatibility proof

This was the last open "Before merge" item. Short version: there is no data-model change to migrate.

  • No write path is touched. The diff is 13 files; the only source changes are query.ts (read filter), config.ts + the manifest (one optional key), agent-scope-runtime.ts (one export) and the surface-report script. Grepping the diff for writeFile|writeSync|INSERT|UPDATE|upsert|embedding|vector|migrate returns nothing.
  • No new persisted field. The ownership signal is bridgeAgentIds, which main already writes at extensions/memory-wiki/src/bridge.ts:213 and already reads at extensions/memory-wiki/src/query.ts:841. This PR reads it in more cases; it does not change what is written. The vector/embedding metadata flag on openclaw.plugin.json and config.ts is the new enum key, which has nothing to do with embeddings or the search index.

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:

phase code result
write current main vault written, reads recorded
read this branch, no config set byte-identical to the baseline
modes this branch, ownership: "sandboxed-only" written explicitly also identical to the baseline

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:

owner       main -> main's own page, unowned page, non-bridge page
delegation  main -> the above plus secondary's page, but NOT third's
            (main may spawn secondary, not third; delegation is not transitive)
            secondary -> its own only; sandboxed rows stay strict in every mode

memory-wiki suite after the rebase: 40 files, 495 passed, 1 skipped.

The part I cannot fix from here

This PR cannot be held in a mergeable state by an outside contributor, and that is why it sat red rather than through neglect.

main is moving at roughly 0.6 commits per minute — 45 commits in the 73 minutes it took me to rebase, regenerate, run the suite and push. The only files that conflict are docs/.generated/config-baseline.counts.json and docs/.generated/config-baseline.sha256, which every config-surface PR must regenerate and which main regenerates constantly. So the branch re-conflicts faster than one rebase-verify-push cycle completes, GitHub then cannot build the merge commit, and pull_request CI never starts at all. That is the actual reason there is no CI run on the current head.

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:

  1. You merge from a green queue — tell me when you want it and I will rebase and push immediately beforehand so the window is seconds rather than an hour.
  2. I drop the two generated baseline files from this PR and you regenerate them at merge time. That removes the conflict magnet entirely, at the cost of config:docs:check being red until then — which would need an explicit "expected" from you.
  3. There is a convention for this I have not found in the contributing docs, in which case please point me at it and I will follow it.

Everything else in the review is addressed; this is the only thing standing between the branch and a CI result.

igs-rogenlo and others added 3 commits October 5, 2026 17:05
… 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
@igs-rogenlo
igs-rogenlo force-pushed the feat/wiki-bridge-ownership-visibility branch from 7f1df95 to 05f7157 Compare October 5, 2026 09:43
@igs-rogenlo

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (1b38c38c8c1, 5 Oct). The memory-wiki refactor that landed since the last revision (extensions/memory-wiki: 90 files; query.ts +198/-504) touched both read paths, so this was a port rather than a mechanical rebase. What the resolution changed:

  • getMemoryWikiPage: kept main's new structure as-is (the !reference guard, loadMemoryWikiCompiledCache, the inline claim lookup). The only line from this PR is the visibility filter, which now takes identity from input exactly as searchMemoryWiki does.
  • searchMemoryWiki: merged without conflict; it still builds the filter from input plus the resolved id.
  • createWikiPageVisibilityFilter on main is unchanged (sandboxed !== true → allow all), so the requested mode is still absent.
  • Imports: main slimmed the block; this PR adds back only what it uses.
  • status.test.ts: took main's resolveMissingVaultStatus() helper; bridge.ownership flows through it from the resolved config.
  • SDK surface budgets: kept main's consolidated list and appended this PR's two +1 rationales (3652 → 3653, 2113 → 2114).
  • Config baseline regenerated with pnpm config:docs:gen; the only delta is plugin 4490 → 4491 (the bridge.ownership leaf); core and channel hashes are unchanged.

Validation on the pushed head (05f71575135):

check result
config:docs:check, plugins:inventory:check, plugin-sdk:surface:check pass
tsgo:extensions, tsgo:core, tsgo:scripts, tsgo:extensions:test pass
pnpm test extensions/memory-wiki 45 files, 500 passed, 1 skipped

What is left is not in the code:

  1. The owner decision in the latest review: accept the bounded opt-in design (sandboxed-only stays the default; owner and delegation are opt-in) together with the resolveSubagentAllowedTargetIds SDK export?
  2. The merge window from my 17 Sep comment: the two generated baseline files re-conflict within the hour on this main. Either works for me: I rebase right before a green-queue merge, or I drop the generated files and you regenerate them at merge time.

If this is not something you want in core, closing is a fine answer too; it lets me plan around it.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 18, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 19, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Updated the PR to 7afad54b6836b5afc41959382186e11c995ed5c8 with the stale mock-export ledger repair. The checkout's native ratchet reproduced the single obsolete agent-scope-runtime tuple, native --prune removed it, and the regular ratchet passed (10,711 → 10,710 entries). This follow-up changes one generated-baseline line; it does not change feature source or dependencies. The PR body separates this validation from the earlier feature tests.

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.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-wiki merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants