Skip to content

Show the brain owner the same private fact rows in as_of and known_as_of reads as in get_page (GST-3064) - #9733

Merged
capy-ai[bot] merged 992 commits into
masterfrom
capy/owner-private-fact-reads-3064
Nov 19, 2026
Merged

capy-ai[bot] merged 992 commits into
masterfrom
capy/owner-private-fact-reads-3064

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

The brain owner's own remote credential now sees an inline page's private fact rows in get_page as_of the same way get_page and fetch already show them.
Why: that history read returned the page's current revision while hiding rows the same caller sees elsewhere, so the owner got two different pages for one revision.
Nothing to do: no migration, setting, MCP field or error code; writes are unchanged.

What changed
  • One rule decides what the owner's credential reads in a page body: storedFactsShown and ownerFenceView in src/core/search/private-visibility.ts. get_page and fetch (stripPrivacyFencesForRemoteReader), the segmented markdown view (markdownAudienceFor) and get_page as_of on an inline page (editionView) all call it. For get_page, fetch and the markdown view the answer is the same as before; inline as_of is the read that changes.
  • The owner's client (no holders list) and token (with one) read the private rows there. A member, an unbound token, an agent job and a read with a room declared read as before.
  • Known limits: known_as_of (get_page and get_versions) still reads the stored markdown without the owner's private rows and without the withdrawal overlay, as on master, and a segmented as_of edition still pages through the read view.
  • The write path is exactly master's: every remote put_page still restores the stored private rows it leaves out. An owner's edit or delete of a private row through remote put_page is still kept beside the stored row; a follow-up handles the write side.
Tests

test/owner-private-fact-reads-gst3064.test.ts (PGLite and Postgres): the local CLI, the owner's client, the owner's token with a holders list, a member and an unbound token each read small, over-cap and segmented pages through get_page content, the markdown view, fetch and as_of, and write each view back unchanged with its revision: every private row is stored once and stays hidden from the member. Further tests: owner as_of reads show the same rows as get_page at the same revision, while member and unbound reads show none; an edit-and-delete by every writer keeps the stored rows for remote writers; a forced owner put and a write-only owner credential keep every private row. Reverting the as_of change turns the agreement test red.

Agent notes
  • Open note from the first review round, unchanged by this PR: owner status is read when the call starts and not rechecked when the write is published (master's existing pattern).
  • Pre-push checks at 6b4ab39: bun run verify 104/104; census shard 1: 625 pass, shard 2: 1365 pass; 342 of 343 get_page unit files pass, and test/setup-brain-first.test.ts fails the same three tests on master 455b6dc on this machine (5 s spawn timeouts); Postgres: this suite plus the GST-3058 and GST-2091 suites, 76 pass.
  • Review: one full read-only review at 0d9b87f (4 readers), whose two blocking findings were in known_as_of; this head takes known_as_of back to master, and one scoped re-check of that removal found nothing blocking (two Low notes: no test pins known_as_of as hidden for the owner; the withdrawal-overlay wording is loose for get_versions diffs).

vorflux Bot and others added 30 commits November 18, 2026 09:30
…s PGLite's trigger does

The trigger form of the rebuilt page search vector now takes coalesce(timeline, timeline_lead, '').
page_body keeps the lead privately, so a stand-in reads NULL until page_body exposes a reader
(follow-up title-vector-segmented-lead). The doc names what the segmented seal must record.

(cherry picked from commit 394f0d9)
(cherry picked from commit 3e54bf083fce64b89be242ee13c8e762a930e7ae)
…tor, as PGLite does

Core item 15 deletes the seal's search timeline on every write that sets the title or timeline.
A new parity case seals a page, re-puts the same input, and finds a timeline entry added after
the seal. Docs close title-vector-reput-after-seal, close the stale question as the shared
dialect rule, and rename the chunk page-filter follow-up to pglite-keyword-chunks-page-filters.

(cherry picked from commit 46b8123)
(cherry picked from commit ac5f43d610292f33b1ad239aae1bb963f1ec3b35)
…ake about 20 ms, not 370 ms

The Rust store rebuilds each chunk's and page's search vector from its text on
every query, which was about 95% of a keyword query's time. Rebuilt vectors now
go into a process-wide cache keyed by the exact input text (text search config,
vector kind and every text part), so a hit is always the vector a rebuild gives
and no write needs to clear it. The cache is bounded at 64 MiB with two
generations. On a 2,000-page, 4,000-chunk brain, searchKeywordChunks went from
365-390 ms per query to about 340 ms for the first query and 16-22 ms after.

(cherry picked from commit 5710334)
(cherry picked from commit 7ba9ad2e14715c040c00bb326e0426cec6db09e0)
The title vector's trigger form now reads the lead the page's last flip
published (page_body::timeline_lead from lane 3), as PGLite's trigger
does with coalesce(timeline, timeline_lead, ''), instead of a NULL
stand-in. Closes follow-up title-vector-segmented-lead.

(cherry picked from commit 97a99fe)
(cherry picked from commit f13e3644118d5152ad687542f9b47ae1ab63c483)
…L 18.6

The stemmer, parser and full-text goldens (english_stem.tsv, ts_parse.json, tsearch.json) came from a probe script that was never committed. This script re-asks PGLite 0.5.16 (PostgreSQL 18.6) for every output in them, reading the inputs from the committed files, and reports any difference. Run with --write to rewrite them. On the committed files it reports no difference.

(cherry picked from commit a1fa8385aa1cce125c93e7964b5749c632a2ce54)
Drop the #9692 consolidation restore from this wave: on a managed brain a consolidate closes fenced members in the entity page's facts fence, and a database-only restore would reopen them in the database while the page still holds them closed. Managed restores keep refusing, as before. The synopsis frontmatter check uses the indexable containment form, and a held move's planning reads share one deadline signal.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p1/red-team#3 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…k reads

Marks the keyword search, title search, title-similarity, chunk page and chunk
window members as served by the Rust engine, and updates the parity case counts.
Produced by test/engine-parity/coverage.ts --write.
…les through the bounded YAML loader

- entity_identity_reviews gets a carried user_data row in the graduation inventory: on a brain with no repository it is
  the only record of a confirm or reject, so graduation must copy it. Without the row graduation refused with an
  unclassified relation.
- An e2e test graduates a PGLite brain with a confirmed and a rejected group to Postgres and checks both decisions,
  the confirm's identity rows and rank_entities counting the confirmed person once survive.
- Decision files are read with loadBoundedYaml (data-frontmatter.ts), the one js-yaml load entry point master now
  enforces.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
With a room declared, the owner's own credential reads private Facts rows,
held rows and takes in get_page, but the room mark judged only the page row
and said the room could read it. get_page results now carry a check the room
marker runs only under a room: remoteReadStrips compares the body the caller
gets with what a world-only read of it keeps, and any difference marks the
page room_access {readable: false, reason: 'private_label'}. The mark is per
page. A member in the same room is marked as before.

Also adds the upgrade-notice row and the changelog fragment, and states the
known limit that an owner's private-row edit through put_page does not stick.

Review-Finding: p3/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The Postgres engine read the segmented chunker version from the chunker
module, so loading the engine pulled in the code chunker and its tree-sitter
wasm asset. Node (the OpenClaw host) cannot load that asset, so the reflex's
direct Postgres connection failed and every turn shipped with no entity
pointers. The constant now lives beside SAFE_FENCE_CHUNKER_VERSION in
search/safe-chunks.ts (segment-chunks.ts re-exports it), and the Node-load
guard now also checks src/core/postgres-engine.ts.
…efore

The owner's every-holder default and its graph-hop text exemption now apply
only when no room is declared. In a declared room the owner's credential reads
world takes and gated hop text, as before this change, until GST-3066 adds
room marks to those operations. Its get_page keeps the Facts rows and the room
mark; a segmented page's markdown view in a room reads as before. With no
room nothing changes. The room switch reads the same declaration the room
marker uses, through one internal caller-access flag.

Also corrects the upgrade notice, changelog fragment and runbook to say what
the room mark covers and what it does not (held rows in read-view windows and
in a holders-list owner's segmented markdown, as before), that the local CLI's
--room marks change, and which reads give the owner every take holder.

Review-Finding: p4/fix-check#1 reader=fix-check
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Shortens the owner-read entry and moves the two write-gate entries to the continuation page, which the room note pushed over the 60000-byte cap.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…or and upgrade-replay goldens count the new table

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ct call

The owner's wider reads (Facts rows as stored on get_page and fetch_page, a
segmented page's markdown view, every take holder for a credential with no
holders list, and graph-hop text) were on wherever a context resolved to the
owner, with each exception switched off by hand; delegated agent jobs were
one nobody had switched off. They are now off by default, and dispatch
switches them on for exactly one case: a direct remote call from an
owner-bound credential speaking for itself with no room declared. Agent jobs,
group chats, stdio, on-behalf-of audiences and attested actors read as before
this change. A census test fails if a second site sets the flag.

An agent job also reads its client's stored takes holders list, read fresh
with the grant, else world takes as before.

Review-Finding: p5/fix-check#1 reader=fix-check
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…o a brain without the pages refuse

A page rename now moves the places the secret redactor recorded on the page, so purging a page that later
takes the old name no longer deletes the renamed page's originals, and purging the renamed page removes them.
The purge also keeps any place whose page id names a live page outside the purge (rows renamed before this fix).

A backup restore now reports originals whose page is not in this brain as skipped_no_page ("skipped because
their page is not in this brain"), with the next step to sync the pages and run the same restore again. When
every entry is skipped that way it refuses with invalid_params and writes nothing.

Also: the next backup is due for entries sealed while a backup ran (database high-water mark, not the host
clock); a spooled duplicate records its commit places on the existing original so a purge keeps it; a restore
groups occurrences by entry once.

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/specialist-batched#1 reader=state-machines
Review-Finding: p1/specialist-batched#2 reader=data-migration
Review-Finding: p1/specialist-batched#4 reader=performance
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A host that restores the thin-client tree without its node_modules got a launcher that passed its runtime check and then failed in Bun's module resolver ("Cannot find package 'js-yaml'"). When the CLI runs from a tree with its own bun.lock and node_modules, the launcher now checks that directory and prints the lockfile restore command (bun install --frozen-lockfile --ignore-scripts in that tree).

Reported by @Kkkkkuro; first fixed by @Masashi-Ono0611 in #9666.

Co-Authored-By: Masashi-Ono0611 <98894508+Masashi-Ono0611@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A rebuilt brain numbers its pages in another order, so a restored occurrence could name an unrelated page; the purge cascade then kept the original when its real page was purged. Restore now looks the page up by source and slug.

Review-Finding: p2/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ript changes (#9648)

A oneshot child that decides correctly to write nothing but answers in prose instead of the skip JSON dead-letters under require_writes and releases its key, so every cycle paid for the same transcript again and doctor reported dream_paid_loop. A dead synthesize child that finished cleanly with no page write now counts as settled for that content key; a changed transcript has a new key and is synthesized again.

Reported by @andreineacsu; first fixed by @Masashi-Ono0611 in #9651.

Co-Authored-By: Masashi-Ono0611 <98894508+Masashi-Ono0611@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Known limits from #9707's final review: the room mark is judged with the caller's own fact grant (GST-3066), and owner tokens minted with gbrain auth create store ['world'].

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
A timestamp like 2026-02-30 or 25:61 used to be accepted by the Rust store and stored as written. The store now checks the calendar: the day must exist in its month, hours, minutes and seconds must be in range, and 24:00:00 and a :60 leap second roll over the same way Postgres does. Page dates (effective_date) use the same check.

Review-Finding: specialist-batched#1 reader=specialist-batched
…d) pages

Three writes could leave a segmented page's search text wrong on the Rust store:
- sealChunks accepted a segmented page and replaced the chunks built from its segments. It now refuses (invalid_state), and a page in an archived source is not found, as on Postgres.
- deleteChunks removed the chunks but kept the page's seal, so a later unsealed write was read as current. It now clears the seal.
- createVersion of a segmented page wrote a version with no body and no reference to one. It now refuses with a typed capability_missing instead of writing an empty version. This changes the store's contract on purpose: the old test that pinned a version of a shell page is rewritten to expect the refusal.

Also adds a test that an impossible effective date is refused and writes nothing.

Review-Finding: adversarial-native#2 reader=adversarial-native
Review-Finding: adversarial-native#3 reader=adversarial-native
Review-Finding: adversarial-native#1 reader=adversarial-native
… holds

Creating a segmented page, or moving or reviving one with a new body, skipped the check that two live pages never share one source file. Both paths now run the same check as an ordinary page write and refuse with origin_claimed, as Postgres refuses with its unique index.

Review-Finding: red-team#1 reader=red-team
…EXCLUDE names

The Rust store hid only its built-in prefixes (test/, attachments/, .raw/). Pages under prefixes the operator lists in GBRAIN_SEARCH_EXCLUDE showed up in results. The adapter now passes the same resolved list Postgres uses, and include_slug_prefixes still brings a prefix back.

Review-Finding: outside-voice#1 reader=outside-voice
…it locked

If close() ran while an open() waited in the worker queue, the open finished afterwards and held the brain's lock with no handle to release it. The open now sees the close and refuses with store_closed, so the brain can be opened again.

Review-Finding: outside-voice#3 reader=outside-voice
garrytan and others added 22 commits November 19, 2026 10:27
The restore now locks the pages it checks for the marker and writes each place with that checked page's id, only while the page still holds the slug, so a rename running at the same time cannot hand the original to a page that took the slug. The guide now says a copy of the marker in a timeline entry filed on the page counts as the page holding it.

Review-Finding: outside-voice#1 reader=outside-voice
Review-Round-Grant: GBRA-108 extra-round at 04df027
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ail the OpenClaw install at once when a release refuses the runner Node

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ssify the secret store for it

The rebuild's access comparison and the purge preview's member classification read the plain private-pages
fragment; neither serves a remote caller, so both are listed as maintenance sites. The secret store's two purge
tables are rows derived from the old page's text and are classified as such.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Return the rename's handling of a place with no page id to what master does: it moves with the renamed page, so no page that later takes the old slug can reveal the original. The changelog now says a full copy of the marker still counts as holding it.

Review-Finding: v2/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…concept-purge-rebuild

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/specialist-batched#2 reader=testing
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… original

The rebuild's purge would delete a sealed original recorded only on the hidden concept's page, which nothing removes
today because the automatic expiry skips a held tombstone. A page-level secret occurrence now keeps the concept
hidden. A concept that only copied a redaction from a live member stays hidden too, until entries can be compared
across pages.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t its slug with no page

The purge deletes a slug's page-level secret occurrences that name the purged page or no page at all, so the hold
now matches both, as the purge's own predicate does.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…remember-valid-from-starter

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nclaw-skill-resolver-real-gateway

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 19, 2026 12:53
@capy-ai capy-ai Bot added the full-ci Maintainer-only: run the full Test and E2E suite on this PR head label Nov 19, 2026
@github-actions github-actions Bot removed the full-ci Maintainer-only: run the full Test and E2E suite on this PR head label Nov 19, 2026
@capy-ai
capy-ai Bot merged commit 11dc411 into master Nov 19, 2026
215 checks passed
@garrytan garrytan mentioned this pull request Nov 19, 2026
garrytan pushed a commit that referenced this pull request Nov 19, 2026
What users get from master in this sync:
- gbrain access member handover hands a leaver's pages to the owner (#9684)
- Duplicate-person linking now asks first and confirms people who share an id one at a time (#9762)
- Company-brain tutorial explains how imported calls are kept to their attendees; --propose heading fixed for partly matched calls (#9718)
- One-script install of GBrain Helper on a Mac that keeps its macOS permissions (#9816)
- The brain owner is told when a remote put_page kept private fact rows (#9760)
- The brain owner sees the same private fact rows in as_of and known_as_of reads as in get_page (#9733)
- Turning iMessage sending off cancels a text still on its way, and --off only reports success it can show (#9791)
- Starter MCP clients can date a remembered fact with valid_from (#9802)
- A secret store restore ties an original only to a page that still holds its marker (#9806)
- Concepts hidden by a purged input come back rebuilt from their current members (#9794)
- Nightly test of the OpenClaw skill-resolver plugin inside a real gateway (#9799)
- Version stamps v0.60.746.0 and v0.60.747.0 (#9814, #9828)

Conflict resolution: valid-time-read.ts keeps the trunk's engine-sql imports and adds master's owner fence view. The generated files (migration registry, CLI flag registry, raw-SQL baseline, export and migration goldens) take master's copy for now and are regenerated in the next commit. Master took migration v327 (access handovers), which clashes with the trunk's v327; the renumber follows.
@capy-ai
capy-ai Bot deleted the capy/owner-private-fact-reads-3064 branch November 21, 2026 17:16
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