Skip to content

Ask before linking a person's duplicate pages: people who share an id are confirmed one at a time (GST-3102) - #9762

Merged
capy-ai[bot] merged 1011 commits into
masterfrom
capy/dedupe-companies-auto-link
Nov 19, 2026
Merged

capy-ai[bot] merged 1011 commits into
masterfrom
capy/dedupe-companies-auto-link

Conversation

@garrytan

@garrytan garrytan commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

A person's duplicate pages are never linked without you: gbrain dedupe confirm now offers a person pair that shares a LinkedIn profile, GitHub login or declared id on its own, with a hint line naming the shared id, and confirm --clean covers company groups only.
Why: a shared id is strong evidence but not proof that two person pages are the same human, so the owner reads each pair (the plan's gate_rev 7 rule).
Automatic company linking was taken out of this PR on 2026-11-19 after review found two ways it could link the wrong pages; it follows separately as its own PR (GST-3127). Nothing to do for readers.

What changed
  • Person pairs that share an id stay on the confirm list, marked confirm_alone in gbrain dedupe confirm --json, with a hint line naming the id. Confirming one together with other groups is refused with reason person_id_batch (dedupe_group_not_confirmable).
  • confirm --clean covers clean company groups only. Companies that share an id are otherwise unchanged: they wait on the confirm list and are linked only when you confirm.
  • Doctor entity_duplicates names the identity in its reject suggestion when a decision has no group id (before, it named a decision id reject refused), and says the last valid version stays applied for a decision file that does not validate.
  • gbrain dedupe no longer lists --body among its flags; it came in through an import and was never a dedupe flag (the canonical-page helper moved to core/entities/identity-decisions.ts).
  • Changelog fragment changelog.d/capy-dedupe-companies-auto-link.md. No upgrade notice row, setting, migration or engine method.
Removed from this PR (automatic company links, GST-3127)

The sweep (core/entities/company-links.ts), its sync-hook call, the engine methods readAutoLinkState and replaceAutoLinks with every registry, golden, parity and coverage row, auto_links in the CLI JSON, gbrain dedupe --kind auto, doctor's auto_linked, the dedupe:auto fold in count-once and confirmedCoMembers, the automatic-row wording of the hand-link refusal, and the upgrade row dedupe_companies_link_automatically. What the reviews found, which the rebuild must close, is listed on GST-3127: a reject keyed by source and slug does not survive a rename or a source move, and the write was guarded only by the decisions revision.

Tests

test/entity-dedupe-person-confirm.test.ts (new, PGLite and Postgres): after a sync neither a company pair nor a person pair that share an id is linked and both wait on the confirm list; a person pair is confirmed on its own with a hint line and never in confirm --clean; a sync writes no identity row for a person however many person pairs share ids; doctor's reject suggestion for a decision with no group id names its identity and reject accepts it. Three of the four fail on master 939062a; the third guards that nothing is linked by a sync.

test/entity-dedupe-decisions.test.ts: three tests updated for the confirm-list order and flags, the person_id_batch refusal, and a bulk confirm that covers only a company pair.

Known limits (final review, not fixed here)
  • gbrain dedupe confirm --json marks a person pair confirm_alone but its hints list still leaves out account and registry ids, so a JSON reader sees no hint for exactly those pairs; the text output names the id.
  • Doctor's reject suggestion for a decision with no group id names its identity, and rejecting that identity also undoes any other group joined into it with --join.
  • Person pairs matched on name alone (no shared id) can still be confirmed several at a time.
Agent notes (internal)

Plan: approved: autoplan-20261117192252

Plan autoplan-20261117192252, gate_rev 7. Head f9b26a9: read-only final review (gstack route read-only, R51) by the batched specialist, the adversarial reader, a coverage audit and one reader asked whether any path still creates, reads or deletes a dedupe:auto link (answer: no; git grep dedupe:auto is empty at head and base); no blockers. bun run verify 104/104, both census shards 0 failures, regen:all clean, the dedupe tests 95/0 on PGLite and 76/0 on Postgres. Head 39d3281 merges the line 97f766e (#9718 with #9799, #9733, #9760, #9816) once onto the docs commit cc4a5ff (the docs audit's one edit to docs/architecture/key-files/graph-and-facts.md); own-line patch-id unchanged (1ee3c267b1c9). On that head: verify 104/104, both census shards 0 failures, regen:all clean, dedupe tests 101/0 on PGLite and 76/0 on Postgres. /ship receipt to follow on the final head.

Open in Capy

Agent notes
{"head":"98e929a42a7dacdd33d6e569ddc016030db1af00","run":"ship9762","mark":"stop","tree":"606196862490bbd175183d4be342d6dc2cf92501"}
{"head":"98e929a42a7dacdd33d6e569ddc016030db1af00","run":"ship9762b","mark":"grant","grant":"a-375e43a9496e"}
{"head":"98e929a42a7dacdd33d6e569ddc016030db1af00","run":"ship9762","status":"started","review_loop":{"passes":2,"blocking_found":3,"deferred":0,"noted":14,"fixed":8,"scope":"frozen","fix_checks":1,"rounds":3,"dispatches":{"specialist":6,"red-team":2}}}

garrytan and others added 30 commits November 18, 2026 10:28
…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>
…eview, read only the first 8 KB of each call, and correct the changelog wording (review notes on #9679)

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>
…the people on them, and how to label calls imported before

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ays --propose does not cover agent-written meeting pages

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>
…, and honour embedding_disabled on every embedding route (#9653, #9715)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
The serve deferred-embed drain now treats a brain whose database row disables embedding as keyless instead of retrying a refused embed forever.

Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… to, and never make a key

A backup reads every entry and occurrence in one statement, so a row sealed mid-backup is in
neither list. The backup status records the backend's identity (kind, bucket, host or path,
never credentials); a different backend, or a drifted entry or occurrence count, makes the
backup due, and doctor no longer reports a backend it never wrote to as backed up. Backups seal
only under an existing key: a keyless host refuses with secret_store_key_missing, maintenance
skips, and doctor says why.

Review-Fix: p5/outside-voice#1
Review-Fix: p5/outside-voice#2
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 18 commits November 19, 2026 11:12
… 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>
… 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>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…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>
@capy-ai
capy-ai Bot marked this pull request as ready for review November 19, 2026 13:38
@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 9fef4e6 into master Nov 19, 2026
233 checks passed
garrytan added a commit that referenced this pull request Nov 19, 2026
garrytan added a commit that referenced this pull request Nov 19, 2026
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@garrytan garrytan mentioned this pull request Nov 19, 2026
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.
capy-ai Bot added a commit that referenced this pull request Nov 20, 2026
…ir apart after renames and moves (GST-3127) (#9839)

Companies that are plainly one company across sources now link on their own after each sync, and `gbrain dedupe reject` keeps a wrong pair apart even after a rename or a move. People are never linked automatically.
Why: Garry approved automatic company linking (A1) and its stored data (E1 to E3); this is GST-3127 PR 2, the rebuild that closes the findings that pulled the first version out of #9762.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: garrytan <garrytan@gmail.com>
@capy-ai
capy-ai Bot deleted the capy/dedupe-companies-auto-link branch November 21, 2026 17:13
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