Repository navigation
Purging a page removes the secret store originals only it held (GST-3074) - #9796
Merged
Merged
Conversation
…a-633-small-fix-wave
…lias, a redirect, a generated page, the page marker reads and every ranking stage, equal to PGLite
… search ranks as PGLite does
…on the Rust engine
…until the engine is wired
…capy/dedupe-confirm
…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
…d) page The export read the body of every page as one string, which a segmented page refuses, so it stopped with no manifest. It now skips each segmented page and counts it in the manifest (skipped_pages_segmented). Review-Finding: outside-voice#4 reader=outside-voice
…s, search excludes, close during open, corpus export)
…er-reads-protected-sections-3058 Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # src/mcp/http-transport.ts
The census shells out to git grep, which made the structural-suite classifier list the whole database suite as structural; on its own file only the census is. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d the pages.ts size verify on the master merge: the test's Postgres arm runs in the Postgres lane, bodyStripsFor (inline pages only) and protectedTakesFilter (body flags on a segmented page) are reviewed body readers, and pages.ts grows 8 lines for the owner option and the room body check. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… login-shaped word Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The export holds the full text of a private brain, so it refuses an output directory inside a git working tree unless --allow-in-repo is passed. The check read every git error as "outside a repository": an inherited invalid GIT_DIR, a missing git or unsafe ownership let the export write into a working tree. Now inherited GIT_* settings are dropped for the probe, only git's own "not a git repository" answer counts as outside, and any other failure refuses with the git error and the --allow-in-repo way out. Red before: with GIT_DIR pointing nowhere, the unfixed exporter passed the guard and created its output directory inside a git repository. Review-Finding: targeted#1
…re when only its occurrences change The page purge cascade (removing a purged page's sealed originals), the rename move of occurrence slugs, the restore rule that skipped originals whose page is missing, and doctor's count of unreferenced originals move to their own change (GST-3074). This change now never deletes a secret store row: a restore only adds rows, ties each restored place to the page that holds its slug now, and never overwrites an existing entry. The backup is now due when only occurrences changed, for example a new page that uses an existing secret. Review-Finding: p4/outside-voice#3 reader=outside-voice Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…edupe-confirm
Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/specialist-batched#1 reader=security Review-Finding: p1/red-team#2 reader=red-team Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…send-keyed-hash Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # scripts/postgres-arm-weights.json
…bench-baseline-postgres-import # Conflicts: # rust/bench/baseline/baseline.test.ts
…eps every recorded occurrence Review round 1 on the purge cascade: a sync rename that falls back to a new row now moves the stale row's occurrences to the new row, so expiring the stale row keeps the original its marker names. A restore compares every recorded field before skipping an occurrence, reports a value held under another id as held rather than as a missing page, and a rename makes the next backup due. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…bench-baseline-postgres-import
…lug, and how to check Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Contributor
|
Open notes from review round 1. Neither blocks this PR.
|
…hived-sources-stay-hidden
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… page renamed earlier restores A place recorded before occurrences moved with their page can carry a slug the page had before an older rename. The backup now writes the slug of the page its page_id names, so a restore into a rebuilt brain finds that page instead of skipping the original. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Contributor
|
Open notes from review round 2. None of them blocks this PR.
|
An occurrence another page holds under an older slug (left by a rename before occurrences moved with their page) now stays with that page when a different page that took the slug is renamed, so the new slug's readers do not pass the reveal check for it. 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>
Contributor
|
Notes after the final review, plus one advisory read. None of them blocks this PR.
|
…bench-baseline-postgres-import # Conflicts: # rust/bench/baseline/baseline.test.ts
…bench-baseline-postgres-import
… the shared-source tables Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…bench-baseline-postgres-import
garrytan
added a commit
that referenced
this pull request
Nov 19, 2026
…resh-link-backlog-after-lock
Merged
capy-ai Bot
added a commit
that referenced
this pull request
Nov 19, 2026
Releases v0.60.744.0 with eight changes since v0.60.743.0, including a security fix: archived sources are now hidden from every API token (#9795). - Archiving a source now hides its pages from every API token, not just from search (#9795) - `gbrain sources refresh` no longer stops and asks for the user when a local commit lands while it publishes the checkout's earlier local commits (#9744) - A managed `gbrain sources refresh` that brings in a few files now holds the checkout's refresh lock for about a second instead of minutes, and reports where its time went (#9746) - The Mac helper's send log no longer keeps a recipient hash that can be reversed by trying every phone number (#9756) - The experimental Rust engine's store now serves vector search, embeddings, link and graph reads, takes, salience, stats and the ingest log the way PGLite does, but nothing selects it yet; PGLite and Postgres brains are unchanged (#9759) - A publish that redacts secrets no longer reports a failure that did not happen, and the secret audit logs are private to their owner (#9790) - Purging a page now removes the secret store originals only that page held (#9796) - The bake-off baseline benchmark can run against Postgres on a clean install again (#9758) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Co-authored-by: garrytan <garrytan@gmail.com>
capy-ai Bot
added a commit
that referenced
this pull request
Nov 19, 2026
…ds its marker (GST-3178) (#9806) A secret store restore now ties an original only to the page at its backed-up slug, and only while that page still holds the entry's marker. A page that merely took an old slug never gets the original, so its readers never pass the `reveal_secret` read check for it. This closes the restore gap #9796 listed as a known limit. A restore can't bring back an original that a purge removed. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Co-authored-by: garrytan <garrytan@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purging a page now removes the sealed secret store originals only that page held, so
gbrain delete --purgeleaves no encrypted copy of a secret the page alone referenced.This finishes the secret store's delete side: until now, a purge left those originals in the store.
Nothing to do: the cascade runs inside every hard delete. Backups already uploaded to a storage bucket still hold their copy.
What changed
src/core/secret-store/store.tspurgeSecretsForSlugs, called fromscrubPurgedSlugStores). Every hard delete removes the page's own occurrences, which are the ones recorded on the page and not on a publish commit. It then removes each entry those occurrences pointed at, as long as no other page or commit still references it. Between the two deletes it takesSELECT … FOR UPDATEon those entries. Under Postgres READ COMMITTED, that makes a redaction of the same value on another page, committing at the same moment, show up before the entry is deleted.page_idto NULL, so an occurrence recorded under a slug the page had before a rename can only be found earlier.deletePages, the batch tombstone purge and the per-row expiry now read the page's occurrences by page id before the delete, and pass those of the pages actually deleted.delete --purgesweeps before the page row goes, so it passes the page id.moveSlugBindingsmoves the renamed page's own page-level occurrences to the new slug inside the rename transaction, never another page's still under that slug. A sync rename that falls back to a new row also moves the stale row's occurrences to that row by page id (movePageIdReferences), so expiring the stale row keeps the original.secrets backup --restorenow adds the missing occurrences of an entry the store already holds under the same id and value, without duplicating any. So purging one page can't remove an original another page holds when the local store had lost that page's occurrence.skipped_no_page).invalid_params. A value the store holds under another id counts as held, not as a missing page.secret_storecheck counts originals no page or commit references. Thesecret_store_key_missingsummary now also covers a backup on a host with no key.Tests
test/secret-store-purge.test.tsruns on PGLite and on Postgres. Each new case below failed before its fix:delete --purge,deletePagesand the tombstone expiry.Two more cases pass today and guard against regressions:
The SQL-text and connection-gauge goldens change only by the added pre-delete read. The doctor goldens add
unreferenced. After review, these cases were added, each failing first: the sync fallback rename, two records at one place, a value held under another id, a rename making a backup due, a page renamed before occurrences moved, and a rename leaving another page's occurrence alone. The purge suite now passes 18 on PGLite and 50 with Postgres. Local runs: