Expand description
Backfill db_agent_identity_links, plus a db_accounts fallback mirror
(reagentx P0 review, added after this migration’s first version — see
identity::resolver::inject::resolve_account’s own doc comment for why
the mirror is needed even though db_accounts itself stays on id_store
as the authoritative store), from every reachable store into the new,
permanently-global identity store — see
docs/specs/SPEC_IDENTITY_STORE_SPLIT_2026_08_17.md.
Before this migration, an agent’s account link lived wherever id_store
(registry::resolve_shared_store_path) happened to resolve at write time:
the true global shared/store.db on the "stable" channel, or a
throwaway <instance_dir>/identity-store.db on every local/dev/portable
channel (isolated by default since PR #2431,
docs/specs/SPEC_ISOLATED_AUTH_DEFAULT_BY_CHANNEL_2026_08_06.md) — the
exact fragmentation
docs/specs/REPORT_HISTORY_CONTINUITY_ACROSS_VERSION_UPGRADE_2026_08_17.md
traces. Without this migration, every link written since 2026-08-06 would
be invisible to the new always-global lookup — shipping the store split
alone would REGRESS every existing non-stable-channel install (a working
agent would suddenly fail its credential gate) instead of fixing it.
Sources scanned, read-only (never mutates a source):
- The current channel’s
objects.db(links can live there ifid_storeever fell back tomstore, e.g. before0011_shared_store_backfillapplied). - The true global
shared/store.db, resolved viaregistry::resolve_global_shared_root()— NOTMigrationContext’s ownshared_store_pathfield, which isresolve_shared_store_path()’s result and therefore DOES redirect to a per-channel path under isolation (reagentx P1 review on this PR — the first version of this migration usedctx.shared_store_pathhere, silently skipping the real global store on every non-"stable"channel, exactly the isolation-unaware bug this migration exists to route around). A"stable"-channel run (or any run withAGENTMUX_ISOLATED_AUTH=0) may have written real links there. - Every sibling per-(channel,version) and per-dev-branch
objects.db(registry::enumerate_objects_dbs, the same enumerator0011_shared_store_backfilluses). - For each sibling
objects.db, its sibling isolated identity store (<instance_dir>/identity-store.db— sameinstance_dirtheobjects.dblives under, derived by strippingdata/db/objects.db) — this is the one that actually holds the fragmented, post-2026-08-06 links the whole redesign exists to reunify.
Deliberately UNCONDITIONAL on isolated_auth_enabled() (unlike
0011_shared_store_backfill’s sibling-scan, which skips other channels
when isolated so a disposable test account store starts empty): this
migration’s destination has no isolation concept at all — see the design
doc §2.3 — so there is no “keep this run’s view empty” case to preserve.