Repository navigation
Hand a leaver's pages to the owner with gbrain access member handover (GBRA-593) - #9684
Merged
Merged
Conversation
|
😎 This pull request was merged. |
7 tasks done
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
garrytan
added a commit
that referenced
this pull request
Nov 18, 2026
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # src/core/schema-migrations/latest.generated.ts # src/core/schema-migrations/registry.generated.ts # test/fixtures/goldens/migrations/records.json
…remember-valid-from-starter Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…send-stop-cancels
…ring-contract-matrix
…nclaw-skill-resolver-real-gateway
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… identity apple/helper/scripts/install.sh builds, signs, installs and registers the helper, reusing the signing identity it made on the first run so macOS grants carry over, and refuses to make a second one. gbrain-apple-helper register registers the background agent with SMAppService. The helper's macOS CI job runs install, reinstall, repair and the no-keychain refusal. 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>
…hed off, and slow to build A failed first run removes its half-made signing keychain. An interrupted swap restores the installed app on the next run. One install runs at a time. The keychain no longer locks itself during a long build. register leaves an agent that was switched off in Login Items alone and says how to turn it on. CI checks each refusal's exit code and message. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…member-handover Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # src/core/schema-migrations/registry.generated.ts # test/fixtures/goldens/exports/types.json # test/fixtures/goldens/migrations/records.json
…er-private-fact-reads-3064
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>
…er-private-fact-edits-3064
…helper-install-script
…calls-docs Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s an id is confirmed alone Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…upe-companies-auto-link
…member-handover Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> # Conflicts: # skills/skills.lock.json
garrytan
added a commit
that referenced
this pull request
Nov 19, 2026
Master's v326 (pages title hash index) took the number #9684's access handovers held, so in this local tree access handovers moves to v327 as Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> #9684 will, and this branch's owner-only reads migration moves to v328.
Merged
capy-ai Bot
added a commit
that referenced
this pull request
Nov 19, 2026
Releases v0.60.747.0 with seven changes since v0.60.746.0, including `gbrain access member handover` for when someone leaves a company brain (#9684, adds migration v327, an empty new table). - A person's pages are never linked without you: a person pair that shares an id is confirmed on its own, after you read why it was proposed (#9762) - A remote put_page now tells the brain owner when it kept private fact rows the content left out or reworded, and points at forget_fact (#9760) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Co-authored-by: garrytan <garrytan@gmail.com>
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.
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.
An admin can now run
gbrain access member handover <member>after switching a teammate off. It previews, then applies, giving the pages only that person read, and folder rules naming only them, to the owner or to a member they pick. Pages other people read stay as they are.Undo (
--undo <id>, once the member is enabled again) restores each page's and rule's recorded readers and the source bindings it moved. Pages edited since are skipped.Nothing changes on upgrade. The new
access_handoverstable is created empty, and every write needs a preview plus--yes --expect <plan_hash>.What changed
When a teammate leaves a company brain, the pages only they could read stay readable by nobody until someone relabels them by hand. The new handover command finds those pages, shows the plan, and moves them in one approved step that can be undone.
Handover command (
src/core/access/handover.ts,src/commands/access-handover.ts). The preview puts the leaver's pages in groups:keptandfolder: go to the owner by default.sharedandsource: kept as they are by default.memory: listed only, never changed.It also shows who gains and who loses access, the leaver's credentials and groups, and a
plan_hash.--set kept=<member>|everyone|keep,folder=…,shared=dropandsource=<member>change a group's target. Opening pages to everyone is never a default.Apply writes exactly the approved items through the existing writers: page readers through the label-only write, rules through the store's rule write. It rechecks each item first and records old and new readers per item on an
access_handoversrow. A run that skips an item exits 1 withhandover_partial, and the same command resumes it.--status <id>moves a Git-backed handover frompublishingtoappliedonce Git has committed the page files.Refusals, each with the command that fixes it:
handover_member_enabled,handover_owner_unset,handover_rules_held(a rule change on that source is already waiting for approval; now checked on a resumed run too),handover_partialandhandover_undo_member_disabled.access_member_invalidgets two new reasons,audience_targetandleaver.Handing over again after an undo works: a new preview after an undo gets a new
plan_hash, so the apply writes again instead of returning the undone record.Doctor: a new check,
access_pages_read_by_nobody, lists pages no enabled member reads. It names the handover command when those pages name a disabled member. It reads members through SQL, sodoctortakes no member flags.member disableandmember rmnow print the handover command.Label-write fix (its own commit, f663a16). The label-only write refused every
readable_bywritten as a list with one reader per line, which is howput_pagewrites it. So on a Git-backed brain, both the handover andgbrain repair visibility --readersskipped those pages.repair visibility --readersnow also edits those pages: it replaces the list with onereadable_by: [...]line and keeps every other byte of the file. A list holding a comment, a nested item, or a block scalar is still refused, and the file is left byte for byte. A new test covers each refused form on a managed git source.test/readers-label-setter.test.ts. Before:spliceLabelLinesonreadable_by:\n - alice-examplereturnednull. After: it returns the file withreadable_by: [owner-example], or without the key for a remove. The forms that are still refused moved into their own case, and comment and nested-item forms were added to it.test/label-repair-derived-stamps-gst2603.test.ts, the fixture for declined pages. Before:readable_by:\n - bob-example. After:readable_by:\n # kept by hand\n - bob-example, which is still refused, so the test still checks that a declined page counts as declined and the run still exits 0.The new
access_handoverstable is registered in the graduation and deletion inventories, and the schema and doctor goldens are refreshed.Docs:
docs/guides/member-handover.md, a "When someone leaves" section incompany-brain.mdandaccess-designations.md, a line in themcp-accessskill, and an entry indocs/architecture/key-files/access.md.Why
A company brain should stay readable by the people still on it. Today, switching a teammate off strands every page they kept to themselves; this gives an admin one previewed, reversible step to hand those pages to someone who still reads.
Blast radius
It touches page labels, folder rules and source bindings, but only through the existing label-only write, rule write and binding helpers, and only for items the operator approved by
plan_hash(src/core/access/handover.tsapplyHandover, read in full; walked bytest/access-member-handover.test.tson PGLite, repo-less and managed git). On a brain with no repository the labels and rules go to the database and theaccess_handoversrow is the record; on a Git-backed source the page files and.gbrain/access.ymlare committed and the row stores the commit ids. Migration v322 only creates an empty table.Test Coverage
Coverage audit (read-only, no tests generated): 14 of 22 traced paths have a test (64%), 13 of 22 at two stars or better (59%). Untested: an invalid
--setvalue, an unknown or self target, a removed leaver, the 10,000-page truncation warning,handover_partialfrom a page edited between preview and apply,--set source=<member>, and CLI usage refusals. Two new tests came from the review: a default handover after an undo applies again, and a resumed handover refuses while another rule change is held.The audit also flagged the stress gate's 256-shard guard as removed. That was its two-dot diff against a newer master, not this branch: the three-dot diff does not touch
scripts/stress/gate.ts.Pre-Landing Review
Two blockers were found and fixed in one fix round, each with a test that failed before the fix and passes after:
src/core/access/handover.ts:196: after an undo, a fresh default preview produced the sameplan_hashas the undone handover, so the apply returned the undone record, wrote nothing and exited 0, leaving the pages readable by nobody. The hash now includes the newest undone handover of that member. Test: "a default handover after an undo applies again".src/core/access/handover.ts:300: a resumed handover skipped the held-rule check, sowriteApprovedRulescould approve another operator's held widening rule change nobody previewed. The check (refuseHeldRules,handover.ts:361) now runs before every rule write, the resume included. Test: "a resumed handover refuses while another rule change is held".One finding is left open: after a crash between the rule write and its approval inside
writeApprovedRules, a resume now refuses withhandover_rules_heldon the handover's own held change (src/core/access/handover.ts:300). The second-model review rated it blocking; nothing is lost, andgbrain access apply --source <id>installs exactly that change, after which the same command resumes. It is not fixed here because the one fix round was used; it is the first follow-up.Not fixed (below the blocking bar):
src/core/access/handover.ts:280: forward and undo plans share themember-handoverapproval key, so--undo X --expect <forward hash>runs a forward handover; it needs a hash the operator previewed for something else.src/core/access/handover.ts:284: the--expecthash is not checked against the member named on the command line.src/commands/access-handover.ts:86:--undodoes not check that the named member is the handover's member.src/core/access/handover.ts:155: the 10,001-row scan also counts pages that never change, so a brain with more than 10,000 pages naming the leaver can relist the same window.src/core/access/handover.ts:116: the owner is not checked as enabled or as someone other than the leaver.src/core/access/handover.ts:404: undoing a source handover can unbind a target that was bound before.src/commands/doctor/checks/access-pages-read-by-nobody.ts:71: a timed-out scan reports ok.src/core/access/handover.ts:298: a multi-source resume that refuses on a later source leaves the rowapplyingwith no item reasons.src/commands/access-rules.ts:352andsrc/core/access/handover.ts:300: a widening queued in the milliseconds between the check and the write is still approved with the handover's change.src/core/access/handover.ts:196: theafter_undolookup has no fallback on a brain behind v322; migrations gate this.Second-model review (openai/gpt-6.1-sol): completed, one finding (the open one above).
Documentation
Status: updated. One factual entry was added to the per-file index for the access code; no blockers.
Scope: committed changes on gbra593-member-handover (base e9044af, head 27256e1): the leaver handover command
gbrain access member handover, migration v322access_handovers, theaccess_pages_read_by_nobodydoctor check, a stricter list of blocked label edits, the new handover guide and updates to the access guides, the error codes, the company-brain tutorial and the mcp-access skill copies.Documentation health:
docs/guides/member-handover.md: current (new guide; groups, defaults and refusal codes match the source)docs/guides/access-designations.md: currentdocs/guides/error-codes.md: currentdocs/tutorials/company-brain.md: currentskills/mcp-access/SKILL.mdand its plugin copies: current, consistent with each otherdocs/architecture/key-files/access.md: updated (adds an entry for handover.ts, access-handover.ts and the doctor check)Coverage debt: llms.txt and llms-full.txt are generated and were not changed by this audit; whether they need regenerating for the new guide is up to the generation step. No diagram drift was found.
Tests
bun test test/access-member-handover.test.ts test/doctor-access-pages-read-by-nobody.test.ts test/readers-label-setter.test.ts test/label-repair-derived-stamps-gst2603.test.ts test/graduation-inventory.test.ts test/cli-flag-equals.test.tsat 37b7ca5: 99 pass, 0 fail (PGLite).bun test test/access-member-handover.test.tsafter the review fixes: 5 pass, 0 fail (PGLite); the two new cases failed before the fix.bun run typecheck: clean.bun run test,bun run test:serial,bun run test:slow,bun run test:e2e) are carried from full-ci at the pushed head; not run on this 4-core machine.Agent notes
bun run migrations:renumber.test/access-member-handover.test.ts(repo-less and managed git),test/doctor-access-pages-read-by-nobody.test.ts,test/readers-label-setter.test.tsandtest/label-repair-derived-stamps-gst2603.test.ts.src/core/cli-flag-registry.generated.ts: the regenerated flag list gains--set,--statusand--undofor the new subcommand; no check was relaxed)src/core/access/handover.ts:300, resume refuses on its own interrupted rule change).Approvals
Plan: approved (record r-6ce4f204a4eb)
Plan check: approved (record r-6ce4f204a4eb)