Skip to content

feat: Brain Map redesign — glass surface, connection-sized entities, rebuild from the whole account - #12878

Closed
nathanchengx wants to merge 30 commits into
BasedHardware:mainfrom
nathanchengx:feat/brain-map-redesign
Closed

nathanchengx wants to merge 30 commits into
BasedHardware:mainfrom
nathanchengx:feat/brain-map-redesign

Conversation

@nathanchengx

@nathanchengx nathanchengx commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
Screenshot 2026-09-06 at 7 32 56 PM

What this is

The macOS Brain Map redesigned, and rebuilt from everything the account knows instead of memories only.

Surface (macOS)

  • No black mat: the map sits on the panel's own glass like every other page; edge, territory and node weights retuned for the light ground.
  • No timeline footer and no replay/pop-in animation; the map is always complete. MemoryAtlasPlayback and the memory_atlas_set_time bridge action are removed.
  • No type colours: entities are monochrome glass circles (MemoryAtlasGlassMark); the inspector states the type in words. The legend goes with them.
  • Rebuild is a plain button, not a three-dots menu.
  • Memory "catalog" records are no longer drawn as unlabeled grey dots.
  • Territories (zones and their captions) are switched off behind drawsTerritories; instead every entity's ring and dot scale with the square root of its connections, capped, so hubs read as landmarks. The territory code is retained behind the switch (entering a region still frames it).
  • Territory captions are small bare type (7pt tracked caps), with no fill, no border and no hover state, and are placed inside their zone on bare ground: entity names are hard blockers, entity marks a strong preference, so a crowded zone still keeps its name rather than losing its outline. Zones are drawn at every zoom level and with any selection, with no cap on how many, and an island whose name still cannot be placed keeps its ground unnamed; the visibility test was rewritten to that rule (the previous rule hid zones at inspect zoom and on selection, which the redesign explicitly reverses).
  • A coastline ring holding none of its group's members (a spilled lobe, or a lake traced as its own ring) is dropped, so no zone appears with no entity in it.
  • The canvas no longer paints a dark disc under the account holder or the selection, nor a small dot under any entity that has a glass ring; the ring is the only mark and the lines meet it, so there is no small bubble inside the big one.
  • The toolbar (search, Rebuild, progress bar) floats over the map's top edge instead of stacking above it, so the map is no longer cut off along the top, and the top edge fades out under the chip row instead of clipping hard.
  • A round reset-view button (viewfinder icon) sits left of the zoom pill in the bottom-left corner and returns the camera to the whole map.
  • Entity names, rings and territory captions stay on screen while panning and zooming instead of vanishing for the length of the gesture. The territory layer is solved only when the camera rests and carried through the gesture by projection, and glass marks carry no shadow, so a drag no longer re-solves placement per frame.
  • Label budgets past overview are generous (48/110/180/240 by zoom level) so smaller circles are named as soon as there is room beside them; the performance harness ceilings were raised to match, since they bound the SwiftUI label overlay rather than a measured regression.
  • While a rebuild runs, the Rebuild button's corner shows one thin bar that fills from 0 to 100% as the rebuild advances (batches on the desktop path, elapsed time on the server path) with "Building Brain Map" under it; no number, no spinner, the map stays as it is (20-brain-map-building render).

Rebuild from the whole account

  • Backend: POST /v1/knowledge-graph/rebuild reads conversations (title, topic, summary, action items, events, transcript excerpt), memories, the people directory and active goals (utils/memory/brain_map_sources.py), is open to every account, replaces only the shared store, never touches canonical assertions, and records progress at users/{uid}/knowledge_graph_meta/rebuild. The call returns a rebuild_id; every status write carries it and a finished rebuild never overwrites a later rebuild's running. Graph reads merge the shared store under the canonical first page (kg_db.merge_shared_graph_records, canonical winning, canonical edge ids kept) and return rebuild status plus shared_truncated when the shared store was cut at its read bound. Status reads and writes are best effort: a meta-document failure neither fails a graph read nor the rebuild. Conversations are read with include_discarded=True and filtered in Python, so rows written before the discarded field existed are included, and get_conversations names every row by its document id. DELETE keeps its 409 gate.
  • Desktop: waits for the rebuild it started, matched by rebuild_id (or, on a server without ids, by a rebuild that both started and finished after the request), up to ten minutes. When the server refuses (409, 429, or no route, which is what the deployed dev backend answers today), BrainMapLocalRebuild reads the same sources through the API under the pinned authorization, packs them into at most 24 batches under the extract endpoint's hourly limit, extracts through /v1/knowledge-graph/extract (one retry per batch), attributes citations by label, and stores the result under brainmap: ids in the local knowledge-graph store, edge citations included, merged under every server read. The map is replaced only by a whole one: a source that cannot be read or a batch that fails twice leaves the previous map untouched and reports why. Rows the file indexer or a chat tool save under the reserved prefix are moved off it. A graph read is shown only if no later read has been shown, so a refresh overlapping a rebuild cannot put the old map back.
  • The inspector resolves conversation: citations to the conversation's title and summary and opens it; people and goals sources are shown as plain statements, not openable rows.
  • The Brain Map bridge actions moved to DesktopAutomationBridge+MemoryAtlas.swift and the generic NotificationWaiter to its own file (the base bridge file is under its main size); the rebuild outcome type lives in BrainMapLocalRebuild.swift.
  • The memory_graph_rebuild bridge action is acknowledged synchronously by the mounted surface (so no receiver is reported as such) and, with wait_seconds, waits for the outcome and reports the path taken (server/local) and the resulting counts; e2e S8b asserts on those.

Known limits

  • The backend rebuild path has unit coverage and passes the OpenAPI contract checks; it has not yet run against a deployed backend, because the deployed dev backend still carries the old code. The desktop fallback path is what was exercised end to end, and it is the path every current client takes until the backend ships.
  • Extract endpoint allows 30 calls/hour, so a desktop rebuild covers roughly the 400 most recent conversations; a second rebuild within the hour that runs out of calls fails whole and keeps the previous map (reported as "n of m batches failed").
  • The territory layer (zones, captions, coastlines) is switched off behind drawsTerritories at the user's direction and retained because entering a region still frames it; its placement cost and ring handling were fixed in review regardless.
  • Citation attribution inside a batch is label matching; connections can cite more conversations than produced them.
  • A small connected graph still collapses into a knot at 100% zoom (pre-existing).
  • Legacy SceneKit MemoryGraphPage untouched (still dark mat) for accounts not on the canonical atlas.

Line-count exceptions

Line-Count-Exception: backend/database/conversations.py | 2324 -> 2331 | get_conversations names each row by its Firestore document id (review P0 on the rebuild reader); seven lines in the one reader the Brain Map rebuild uses, matching the sibling readers that already do this
Line-Count-Exception: desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift | 3630 -> 3631 | one-line registration of LocalKGSchema.registerMigrations; the local_kg_edges citations migration itself lives with the knowledge-graph store

Failure class (fixes)

Failure-Class: none

The fix: commits here correct behaviour introduced earlier on this same branch (single mark per entity, zones vanishing with the camera, empty zones, the toolbar clipping the map, the missing Rebuild fallback on 429); none is a regression that shipped.

Product invariants affected

  • INV-MEM-4
  • INV-MEM-1
  • INV-AUTH-1

INV-AUTH-1: RewindDatabase.swift changes by one line, registering the local_kg_edges citations column migration through LocalKGSchema; no session, owner-transition or per-owner storage behaviour changes. The desktop rebuild reads under the pinned RuntimeOwnerAuthorizationSnapshot and writes through LocalMutationAuthorization, as before.

INV-MEM-4: canonical promotion stays the sole Long-term authority. The rebuild writes only the shared-graph projection (knowledge_nodes/knowledge_edges), a retryable derived view; assertions and memory_state are never read for gating nor written. INV-MEM-1: no tier vocabulary changes; memory sources are read through MemoryService.read.

Review round (cubic, 26 findings)

Every finding was addressed in code, with a test where behaviour changed: rebuild ids and fenced status writes; finished(since:) requiring the rebuild's own id or start time; no local commit after a failed read or batch (with one retry); shared_truncated on the canonical route; exporter count 13 with a registry test; caption placement scored once over prefiltered marks; bridge acknowledgement/outcome instead of posted=true; reserved brainmap: prefix relocation; non-openable people/goals sources; include_discarded=True plus document ids; the islands test now proves a lake exists before the rule removes it, and lakes another group lives in stay holes; canonical edge ids preserved on merge; memories read under the pinned authorization; edge citations persisted (memoryIdsJson, migration addLocalKGEdgeCitations); hashed node ids; catalog placements excluded from hit-testing and from policy counts (entityCount); a monotonic publish guard on graph reads; best-effort status reads/writes; S8b asserts the fallback's outcome; the unused test helper and the dead inline target removed. The territory layer being off is intentional (see Known limits).

Verification

Backend (each file run individually with pytest, py3.11 venv):
test_brain_map_rebuild_sources.py (6), test_knowledge_graph_canonical_mutation_routes.py (21), test_knowledge_graph_canonical_pagination.py (17), test_knowledge_graph_legacy_fallback.py (4), test_bounded_firestore_list_reads.py (17), test_knowledge_graph_rebuild_ordering.py (4), test_knowledge_graph_delete_route.py (2), test_app_client_schema_inventory.py (12) — all pass. scripts/export_openapi.py --surface app-client --check up to date; Dart/TS clients regenerated from the snapshot.

Desktop: full package suite (swift test --package-path Desktop) run before marking ready: every suite green except two JITProactivityRuntimeTests cases that fail only in the full run and pass in isolation (35/35); that code is untouched by this branch (recent main commits #12798/#12817) and the failures are order-dependent. After the review round the focused suites (BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph|ViewExporterRegistry, 233 + 90 tests) pass. Pinned swift-format lint clean; make preflight run locally before the push.

Real path: in the omi-brain-map-redesign named bundle against the dev backend, Rebuild fell back to the desktop path after the server's 429 and rebuilt 236 conversations, 3 memories, 6 people and 2 goals in 17 batches (0 failed) into 246 entities / 280 connections, shown merged under the server graph and surviving a relaunch. ViewExporter renders 16–19 checked on the light ground.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao

@nathanchengx
nathanchengx force-pushed the feat/brain-map-redesign branch from 45d2247 to e6966b5 Compare September 6, 2026 21:05
@nathanchengx nathanchengx changed the title feat: Brain Map redesign — glass surface, no timeline, rebuild from the whole account (draft, not mergeable yet) feat: Brain Map redesign — glass surface, connection-sized entities, rebuild from the whole account Sep 6, 2026
@nathanchengx
nathanchengx marked this pull request as ready for review September 6, 2026 21:06
@nathanchengx

Copy link
Copy Markdown
Contributor Author

Ready for review. Verification before flipping from draft:

  • Rebased onto current main (e6966b507e).
  • make preflight locally: every manifest check passes except web-app-checks, which fails on this Mac's bun 1.4.2 (jsdom without localStorage; CI pins 1.3.14) and passes in CI.
  • Full desktop suite swift test --package-path Desktop: all suites green except two JITProactivityRuntimeTests cases that fail only in the full run and pass in isolation (35/35); JIT code is untouched here.
  • Backend: every changed test file passes individually; OpenAPI app-client snapshot regenerated, --check clean, compatibility vs merge-base passed; Dart/TS/Swift generated clients regenerated.
  • Exercised in the omi-brain-map-redesign named bundle against the dev backend: Rebuild fell back to the desktop path after the server's 409/429 and rebuilt 236 conversations, 3 memories, 6 people and 2 goals into 246 entities / 280 connections; survives relaunch.
  • CI: the Windows/Linux desktop jobs fail on Onboarding.tsx importing a missing AutoCreatedTasksStep; both the import and the missing file are on main and not touched by this PR.

🤖 Generated with Claude Code

@nathanchengx

Copy link
Copy Markdown
Contributor Author

The Windows/Linux desktop job failures are upstream: Onboarding.tsx imports AutoCreatedTasksStep, which was deleted on main by 5701283697 after #12229 wired it. Tracked in #12891; those jobs only run when desktop/windows changes, which the regenerated API types here do.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 41 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/database/knowledge_graph.py Resolved
Comment thread backend/routers/knowledge_graph.py Resolved
Comment thread backend/routers/knowledge_graph.py Resolved
Comment thread backend/routers/knowledge_graph.py Resolved
Comment thread desktop/macos/e2e/flows/memories.yaml Resolved
kodjima33 added a commit that referenced this pull request Sep 6, 2026
…anup (#12891) (#12892)

* fix(desktop): restore AutoCreatedTasksStep deleted by dead-module cleanup (#12891)

desktop/windows/src/renderer/src/pages/Onboarding.tsx still imports and
renders AutoCreatedTasksStep (step 14, wired in #12229), but
5701283 ("remove retired agent-runtime residue and dead-module
clusters") deleted the component and its test, misclassifying it as
dead. Any build or typecheck of desktop/windows on main has been
broken since (`npm run build` runs `typecheck` first, so
`build`/`build:win`/`build:linux`/`build:unpack` all fail before
bundling), confirmed by PR #12878 hitting TS2307 when it touched that
tree.

Restore both files verbatim from 5701283^ (the last commit where
they existed and matched Onboarding.tsx's usage).

* docs(failure-class): register FC-reachability-cleanup-deletes-live-reference

Companion to the fix in this branch: 5701283 deleted
AutoCreatedTasksStep.tsx as "dead" while Onboarding.tsx still imported
and rendered it, breaking desktop/windows typecheck and every build
variant. No existing failure-class definition covers a cleanup's
reachability scan missing a live reference, so this registers a new
one per pr-preflight's failure-class-protocol.
Nathan and others added 21 commits September 6, 2026 19:38
`POST /v1/knowledge-graph/rebuild` used to read memories only and refuse
assertion-backed accounts with a 409. An account with two memories and
hundreds of conversations rebuilt into three dots.

- `utils/memory/brain_map_sources.py` turns conversations (title, topic,
  summary, action items, events, transcript excerpt), memories, the people
  directory and active goals into extraction payloads. Memories keep their
  own ids; every other source is prefixed (`conversation:<id>`,
  `people:directory`, `goals:active`) so clients know what they cite.
- Rebuild is open to every account: it replaces only the shared store and
  never touches canonical assertions. `DELETE` keeps its gate.
- Graph reads merge the shared rebuilt store under the canonical first
  page via `kg_db.merge_shared_graph_records`, canonical winning on
  overlapping labels and citations.
- Rebuild progress is recorded at `users/{uid}/knowledge_graph_meta/rebuild`
  and returned as `rebuild` on graph reads so a client can wait for the
  rebuild it asked for.

Verification: `tests/unit/test_brain_map_rebuild_sources.py` (new),
`test_knowledge_graph_canonical_mutation_routes.py`,
`test_knowledge_graph_canonical_pagination.py`,
`test_knowledge_graph_legacy_fallback.py`, `test_bounded_firestore_list_reads.py`,
`test_memory_graph_assertion_read.py`, `test_knowledge_graph_rebuild_ordering.py`,
`test_knowledge_graph_delete_route.py`, `test_app_client_schema_inventory.py`
each pass run individually with pytest; `scripts/export_openapi.py
--surface app-client --check` up to date; `check_app_client_openapi_compatibility.py
--base-ref origin/main` passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…ccount

The map now looks like the rest of the app and shows the whole account.

Surface:
- No black mat: the map sits on the panel's own glass, Ink resolving on the
  light ground like every other page. Edge, territory and node weights
  retuned for it.
- No timeline footer, no replay or pop-in animation; the map is always
  complete. `MemoryAtlasPlayback` and the `memory_atlas_set_time` bridge
  action are gone.
- No type colours: entities are monochrome glass circles
  (`MemoryAtlasGlassMark`); the inspector states the type in words. The
  legend is gone with them.
- Rebuild is a plain button, not a three-dots menu, and narrates progress.
- Catalog (memory-only) records are no longer drawn as unlabeled grey dots.

Rebuild:
- Tries the server first and waits for the rebuild it started using the
  new `rebuild` status on graph reads (up to ten minutes).
- When the server refuses (409, 429, or no route), `BrainMapLocalRebuild`
  reads conversations, memories, people and goals through the API, packs
  them into at most 24 batches under the extract endpoint's hourly limit,
  extracts through `/v1/knowledge-graph/extract`, attributes citations by
  label, stores the result under `brainmap:` ids in the local knowledge
  graph store and merges it under every server read, server winning on
  matching labels.
- The inspector resolves `conversation:` citations to the conversation's
  title and summary and opens the conversation; people and goals sources
  describe themselves.
- The `memory_graph_rebuild` bridge action now presses the real button
  path and `memory_graph_snapshot` reports what the map shows.

Verification: `swift test --filter
'BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|
DesktopAutomationSecondaryAction|GlassContentChrome'` — 208 tests,
0 failures (12 new in BrainMapLocalRebuildTests). Exercised in the
omi-brain-map-redesign named bundle against the dev backend: Rebuild fell
back to the desktop path after the server's 429 and rebuilt 236
conversations, 3 memories, 6 people and 2 goals in 17 batches into 246
entities and 280 connections, shown merged under the server graph.
ViewExporter renders 16–19 checked on the light ground.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
pyright (reportUnnecessaryCast / reportUnnecessaryIsInstance) on the typed
SharedKnowledgeGraph lists.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…n the duration guard

routers/knowledge_graph no longer imports the LLM extractor eagerly, so the
first test that touches utils.llm.knowledge_graph pays that module import
(1.19s CPU); the guard's structural exception applies.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…builds

The Rebuild button used to carry a spinner and narrate each step. Now the
old map fades under a minimal indeterminate bar with the words beneath it,
no percentage, and the button simply dims until the rebuild is done. Steps
still go to the log. A `20-brain-map-building` ViewExporter render covers
the state.

Verification: `swift test --filter
'MemoryAtlas|MemoryGraph|BrainMapLocalRebuild|ExternalPreviewBuild|MemoryHubBrainMap'`
— 167 tests, 0 failures; ViewExporter index 12 rendered and checked.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The building state moves to the top right, in the Rebuild button's place:
a thin bar that fills as the rebuild advances, "Building Brain Map" under
it, no number, and the map underneath untouched. The desktop rebuild
reports a real fraction (reading, then one batch at a time, then saving);
the server path paces the bar against a typical rebuild's duration and
completes it when the server reports the rebuild finished.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…p moves

- A round viewfinder button left of the zoom pill returns the camera to the
  whole map.
- Entity names, rings and territory captions no longer vanish for the
  length of every pan and zoom. The gesture still reuses the cached entity
  cohort; only positions move per frame.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Label budgets past overview were tuned for a wall of thousands of dots and
held most names back until the last zoom level. They are now generous
(neighbourhood 48, detail 110, focus 180, inspect 240 labels; per-cluster
16/40/96/200) so lower-ranked entities are named as soon as collision
admission finds room beside them. The performance harness ceilings move
with them; they bound the SwiftUI label overlay, which stays bounded.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The toolbar row sat above the canvas and cut the map off along the top,
territories included. It now floats over the map's top edge, so the map
owns the whole column and the search field and Rebuild control simply
sit on it. The selection label ceiling in the performance harness moves
to the detail-level budget introduced with the earlier-label change.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The canvas painted a dark disc under the account holder and the selection,
and a small dot under every entity that also has a glass ring. Through the
translucent glass those read as a shadow behind the person and a small
bubble inside each big one, with the lines seeming to end at the small
bubble. The ring is now the only mark for any ringed entity; the canvas
dot is drawn only for entities without one.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
… ground

Captions are 8pt tracked caps with a thin capsule rule and no fill, and no
hover state: they are part of the map, not chips. Placement keeps them
inside their zone (the off-coast fallback now applies only once the user
has gone into a place) and prefers ground with no entity mark under it.
Entity names stay hard blockers; marks are a preference, because a
territory that cannot be named loses its outline too, and on a real
account the strict version emptied the map of zones.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…re-solving it

Dragging and zooming the Brain Map re-solved caption placement every
frame: every candidate spot against every entity name and mark, twice,
for every island, plus the inland tests against each coastline. Under a
gesture nothing about that solution changes except where it is on
screen, so the layer solved with the camera at rest is now kept on the
render-plan cache in map coordinates and projected per frame; it is
re-solved when the camera settles. The glass marks also lose their
blurred shadow, which was the next most expensive thing drawn a couple
of hundred times per frame for a cue invisible at that size.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
A 28pt fade instead of a hard clip, so the map reads as continuing under
the chips rather than cropped by them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…ction

Territories came and went with the camera: hidden at inspect zoom and on
any selection, capped at eight, dropped whenever their caption found no
room, and dropped below 26pt on screen. Every island on screen is now
drawn at every zoom level and with any selection; the caption budget is
gone; a caption that finds no clear spot takes the least-crowded one, and
an island whose name still cannot be placed keeps its ground unnamed.
The visibility test moves with the rule: the redesign asked for the
ground to stay, so hiding it is the regression now.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
The blurred influence field could leave a lobe or sliver of land past a
group's last member, and a lake traced inside an island came back as a
ring of its own; both drew as a zone with nobody in it. A coastline ring
that holds none of the group's members is now dropped where coastlines
are built. Regression test: a ring of members keeps its island and every
island it gets holds a member.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Territories are off behind `drawsTerritories`. What matters about an
entity is now its size: rings and canvas dots scale by the square root
of the entity's connections (capped, so a hub is a landmark and not a
planet), the account holder is fixed at landmark size, and a selection is
drawn a step larger. Cluster rank no longer decides size.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
Nathan and others added 7 commits September 6, 2026 19:38
…egacy conversations in the rebuild

Review round on #12878. The rebuild call now returns a `rebuild_id`; every
status write carries it and is skipped when a later rebuild owns the status
document, so an earlier rebuild finishing cannot turn a running one into
"complete". Status reads and writes are best effort: a meta-document failure
neither fails a graph read nor the rebuild that already ran. The canonical
first page reports `shared_truncated` when the shared store was cut at its
read bound, since no later page carries what was cut. A shared edge over a
canonical relationship keeps the canonical edge id. Conversations are read
with `include_discarded=True` and filtered in Python, so rows written before
the field existed are not dropped by the store's equality filter, and
`get_conversations` names every row by its document id.

Verification: pytest on test_brain_map_rebuild_sources (6),
test_knowledge_graph_canonical_mutation_routes (21),
test_knowledge_graph_canonical_pagination (17), test_knowledge_graph_legacy_fallback (4),
test_knowledge_graph_rebuild_ordering (4), test_bounded_firestore_list_reads (17),
test_knowledge_graph_delete_route (2), test_app_client_schema_inventory (12); all pass.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…uild_id and shared_truncated

`backend/scripts/export_openapi.py --surface app-client --write`, then
generate_dart_models.py (misc) and generate_ts_openapi_types.py for the
four TypeScript clients. The Swift DTOs do not carry these schemas.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…e and waits for its own server rebuild

Review round on #12878, the rebuild path. The desktop rebuild reads every
source under the pinned authorization and fails, leaving the previous map
untouched, when a source cannot be read or a batch still fails after its one
retry; before, unreadable sources were skipped silently and a partial
extraction replaced the map. Edge citations are persisted (`memoryIdsJson`,
migration `addLocalKGEdgeCitations`), node ids hash the normalized label so
labels that only slug alike stay distinct, and rows the file indexer or a
chat tool save under the reserved `brainmap:` prefix are moved off it.

Waiting for a server rebuild now matches the `rebuild_id` the call returned,
or on a server without ids requires the rebuild to have both started and
finished after the request, so an earlier rebuild ending is not taken as this
one's. Graph reads are numbered and shown only if nothing later has been
shown, so a refresh overlapping a rebuild cannot put the old map back.

The `memory_graph_rebuild` bridge action is acknowledged synchronously by the
mounted surface (no receiver is reported as `no_receiver` rather than
`posted=true`) and, with `wait_seconds`, waits for the outcome and reports
the path taken and the resulting counts; the dead `inline` target is gone
and e2e S8b asserts on the outcome.

Verification: swift test --filter "BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph" (233 tests, 0 failures); pinned swift-format lint clean.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…only; islands keep inhabited lakes

Review round on #12878, the atlas surface. Catalog records are excluded from
hit-testing and from every zoom and label policy sized by the map
(`MemoryAtlasSnapshot.entityCount`). The people and goals sources in the
inspector are plain statements rather than rows that pretend to open
something. Territory caption placement scores each candidate once over the
marks that can touch it instead of inside the comparator. An island ring
holding none of its group's members is kept only as a lake inside one of the
group's islands where another group lives, so the hole survives even-odd
fill; the islands test now proves the tracer produced a lake before the rule
removes it. `ViewExporter.standaloneViewCount` matches its 13-entry registry,
with a test, and the unused `atlasSource()` test helper is gone.

Verification: swift test --filter "MemoryAtlas|ViewExporterRegistry|DesktopAutomationSecondaryAction" (0 failures); pinned swift-format lint clean.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…n waiter and the rebuild outcome out of oversized files

The product-file line-count ratchet flagged the base bridge file, the atlas
view model and RewindDatabase. The Brain Map actions now live in
DesktopAutomationBridge+MemoryAtlas.swift (the flow lint and the registry
tests glob every DesktopAutomationBridge*.swift), NotificationWaiter is its
own file, the rebuild outcome type sits with the rebuild in
BrainMapLocalRebuild.swift, and the local_kg_edges citations migration is
registered through LocalKGSchema next to the knowledge-graph store.

Verification: swift test --filter "BrainMapLocalRebuild|MemoryAtlas|MemoryGraph|MemoryHubBrainMap|DesktopAutomationSecondaryAction|GlassContentChrome|KnowledgeGraph|ViewExporterRegistry" (236 tests, 0 failures); pinned swift-format lint clean.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
…rebuild-sources test

The fast-unit duration guard charges a test's first heavy import to that
test; importing `database.conversations` at collection keeps the reader
test at 0.0s of call-phase CPU instead of 0.51s.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GaQVqgLc18FwPb6uzCVPao
@nathanchengx
nathanchengx force-pushed the feat/brain-map-redesign branch from e6966b5 to 22efe52 Compare September 7, 2026 00:43
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the Brain Map redesign end to end — this is substantial, coherent work, and the account-wide rebuild directly addresses the "three dots" problem of rebuilding a whole account from its memories alone. The engineering care shows; a few things I verified:

  • backend/utils/memory/brain_map_sources.py: the new source collection is pure, uid-scoped, and bounded (500 memories, 200 most-recent conversations at 4k chars each, single people/goals payloads). Locked/discarded/deleted conversations are filtered in _conversation_is_readable rather than by the store query, with the over-read to match — the right call for legacy rows without the discarded field. backend/database/conversations.py's setdefault('id', doc.id) is a safe fix so rebuild citations always address a conversation.
  • backend/routers/knowledge_graph.py: dropping _require_legacy_graph_mutation from POST /v1/knowledge-graph/rebuild is justified by the new invariant — I confirmed utils/llm/knowledge_graph.py's rebuild_knowledge_graph only replaces the shared knowledge_nodes/knowledge_edges store (after full extraction, so a failed rebuild leaves the old map intact) and never touches canonical assertions, while DELETE /v1/knowledge-graph keeps its canonical-state gate. The rebuild-status document is per-account, write-guarded by only_for_rebuild_id so an older finishing rebuild cannot clobber a newer one's status, and a read failure degrades to serving the graph without status.
  • backend/database/knowledge_graph.py: merge_shared_graph_records is deterministic (sorted iteration, canonical ids preserved on overlap, shared citations of canonical-owned memories stripped) and the first-page-only merge with shared_truncated reporting is a clean answer to paging a store that has no revisions.
  • Desktop: BrainMapLocalRebuild.swift reads the same sources through the authenticated client and extracts via the existing return-only extract endpoint in bounded batches (24 calls, under the 30/hour limit, with one retry each); KnowledgeGraphStorage.replaceRebuiltGraph deletes/inserts under the rebuild prefix in one transaction with parameterized SQL; the LocalKGSchema edge-citations migration is guarded and idempotent.
  • The rebuild waiting logic in MemoryGraphPage.swift (rebuild_id/timestamp matching with clock-skew allowance, fallback for pre-status servers) and the fetch-sequence guard against a stale read overwriting a fresh local rebuild are both well thought through.

Two minor observations, neither blocking: (1) write_knowledge_graph_rebuild_status is read-then-write rather than transactional, so two rebuilds finishing concurrently could interleave once — cosmetic, status-only. (2) Every first-page graph read now also loads the shared store and the assertions fence; bounded, but it is extra reads on a hot path, and a full-account rebuild is now up to ~700 extraction calls (vs ~500 memories before) — worth a glance at LLM spend per rebuild.

Automation/agent-facing note: this PR changes the desktop automation surface and CI guidance that agents consume — backend/tests/fast_unit_duration_allowlist.txt adds one narrowly-scoped slow-test entry (accurate: the router now imports the extractor lazily), the memory_graph_rebuild bridge action now drives the mounted surface with a wait_seconds param and a no_receiver outcome instead of calling the API directly, and memory_atlas_set_time is removed with the timeline. The new contracts are documented in the registry and pinned by DesktopAutomationSecondaryActionTests, BrainMapLocalRebuildTests, and e2e flow S8b, so the guidance agents see stays accurate — but any external automation calling the removed/changed actions will need updating.

Leaving for human maintainer review rather than approving: this needs a product direction decision on the redesign itself (the timeline/replay and territory zones are removed, and the map's visual identity changes substantially), and maintainer sign-off on the relaxed rebuild gate plus the desktop-local rebuild fallback. Both are exactly the kind of judgment the automation shouldn't make alone. The technical implementation, in my reading, is sound.

Thanks @nathanjcx — genuinely impressive PR.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added needs-maintainer-review Needs a human maintainer to sign off before merge macOS labels Sep 7, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Addendum to the earlier automated review of this head — it covered the rebuild invariant, merge semantics, and desktop rebuild path end to end, and nothing here changes its conclusion. Two smaller findings from a second pass that it did not cover, both in the desktop fallback rebuild, both non-blocking:

  1. Locked-conversation parity. The server rebuild filters locked conversations in _conversation_is_readable (backend/utils/memory/brain_map_sources.py), but the desktop fallback reads the standard list endpoint (APIClient.getConversations), which does not filter is_locked — redact_conversations_for_list only strips action_items/events/transcript_segments, keeping title and overview. BrainMapRebuildSources.conversation() has no isLocked check, so on the local path a paywalled conversation's title/summary still feed the extract endpoint and can appear as entities and citations. The data is already user-visible in the list, so this is an enforcement-parity question rather than a leak, but the two rebuild paths probably should agree on what counts as readable.

  2. Legacy-conversation completeness. The Swift client always sends include_discarded=false, so conversations written before the discarded field existed — exactly the rows the server rebuild over-reads with include_discarded=True — are silently missing from desktop-local rebuilds on old accounts. A one-line isLocked/legacy filter parity in BrainMapRebuildSources.conversation() (or an include_discarded override in Reads.live) would align both paths.

Neither blocks merge in my reading; both are worth a maintainer decision alongside the product-direction call on the redesign itself and sign-off on the relaxed rebuild gate.

— automated addendum on behalf of David (Git-on-my-level); the open maintainer decisions are the Brain Map product direction, the relaxed rebuild gate, and locked-conversation parity in the desktop fallback.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

… document

The rebuild status fence refused every write whose rebuild_id differed from
the document's, so once a first rebuild had finished, a second rebuild's
running claim — and then its complete — were both dropped. The document
stayed on the first rebuild's id forever, and a desktop waiting for the
rebuild it started polled to its ten-minute budget and reported failure
even though the rebuild had succeeded.

The fence now protects exactly what it documented: a rebuild starting
always claims the document (which also recovers a rebuild that crashed
leaving running behind), while a finish only lands while the document
still belongs to that rebuild — an earlier rebuild finishing still cannot
turn a later one's running into its own complete.

Verification: backend/.venv/bin/python -m pytest backend/tests/unit/test_knowledge_graph_canonical_mutation_routes.py backend/tests/unit/test_brain_map_rebuild_sources.py backend/tests/unit/test_knowledge_graph_legacy_fallback.py backend/tests/unit/test_knowledge_graph_rebuild_ordering.py backend/tests/unit/test_knowledge_graph_canonical_pagination.py backend/tests/unit/test_knowledge_graph_delete_route.py backend/tests/unit/test_knowledge_graph_extract_route.py backend/tests/unit/test_knowledge_graph_extract_helper.py backend/tests/unit/test_canonical_graph_state_probe.py — 76 passed; the three new fence regression tests false-failed against the old fence.

Failure-Class: none
…e-laying-out the entity overlay every frame

The redesign kept the SwiftUI entity overlay (glass marks, name labels, hit
targets) mounted during pan and zoom, where the pre-redesign atlas dropped it
for the length of the gesture, and roughly doubled the label budgets behind it
(12/24/36/72/96 became 12/48/110/180/240), so every gesture frame repositioned
up to a few hundred composed views. Scroll-wheel zoom never flagged the camera
as moving at all, so every scroll tick re-ran the full planner over the whole
graph (one pass measures ~13ms CPU on the 2,400-node production-scale fixture)
and re-admitted labels, rebuilding the overlay mid-scroll.

Mid-gesture on an unemphasised map — the same inputs that admit the cached
render plan — the Canvas now paints the cohort's marks and admitted names
itself, and the SwiftUI overlay returns the moment the camera rests and the
settled plan re-admits it. A selection or search keeps the overlay up:
emphasis is the point of those states, and their gestures bypass the plan
cache anyway. Scroll bursts now count as camera movement and settle 0.3s
after the last tick, so a burst plans once per detail band instead of once
per tick.

Measured layer: planner CPU on the synthetic fixture (debug build); the
overlay's frame cost is reasoned from the render path, and framerate on a
real 1,500-node account was not measured.

Verification: xcrun swift build -c debug --package-path Desktop; xcrun swift
test -c debug --package-path Desktop --filter "MemoryAtlas|MemoryGraph|BrainMap"
(177 tests, 0 failures, including the new overlay-gating harness test and the
gesture-cache work-budget tests); pinned swift-format lint clean; SwiftLint 0
violations; desktop test-quality ratchet at baseline.
@Git-on-my-level

Copy link
Copy Markdown
Member

QA evaluation of this PR (stacked with the other beta-candidate PRs) surfaced two issues; pushed two fix commits on top of your branch as maintainer (your commits are untouched — nothing rewritten):

cfb9aadd63 — fix(backend): let a second Brain Map rebuild claim the rebuild status document. The status fence dropped every write whose rebuild_id differed from the document's, including a second rebuild's initial running claim — so after a first rebuild finished, the second rebuild's running and complete writes were both discarded while the rebuild itself succeeded. The desktop waits for an exact id match, polls its 10-minute budget, and reports poll_budget_exhausted. The fence now only guards finishes (an earlier rebuild finishing still can't overwrite a later one's status), while a starting rebuild always claims the document — which also self-heals a crashed rebuild wedged on running. Three new regression tests in test_knowledge_graph_canonical_mutation_routes.py (the second-rebuild test false-fails on the old fence); 76 knowledge-graph/brain-map unit tests pass.

51584f2887 — perf(desktop): Brain Map paints gestures from the canvas. The redesign mounts the SwiftUI entity overlay unconditionally, so every pan/pinch frame re-laid-out up to a few hundred composed views (the pre-redesign atlas removed the overlay during camera moves), and scrollZoom never set isCameraMoving, so scroll ticks re-ran the full render planner every event (~13 ms/tick on the 2,400-node fixture). During a clean camera move the canvas now paints marks and admitted names itself (names stay visible mid-gesture, matching the redesign's intent); the overlay returns at rest; scroll bursts count as camera movement with a 0.3 s settle. canvasOwnsMarks gating is extracted with a harness test; 177 MemoryAtlas/MemoryGraph/BrainMap tests pass.

Line-count exceptions you'd already added to the PR body were left as-is. Happy to hand either root cause back if you'd rather take the fix a different way — everything is additive, revert with two reverts.

@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed this end to end — this is a genuinely cohesive piece of work: the macOS Brain Map redesign and the whole-account rebuild that feeds it, with strong tests on both sides (the fenced rebuild-status race, the canonical-wins merge, the citation prefixes, and the bridge acknowledgement contract are all pinned by tests; every backend suite, shard, and hermetic gate is green).

On the three red required checks — I dug into the logs, and none of them is caused by this diff:

  1. Desktop Swift Release Compile / Build & Tests fail compiling Tests/RealtimeTurnEvidenceTests.swift:525 — testingAttachRealtimeUserEvidence is #if DEBUG-only in Sources/FloatingControlBar/RealtimeTurnEvidence.swift (lines 46–50), which landed on main Sep 8–9 after this branch's base. The identical failure reproduces on an unrelated desktop PR (feat(desktop): opt-in on-device embeddings with FTS hybrid retrieval; backend keyword fallback for screen search #13456, run 34538456994); that PR's later run passes because it wrapped its own tests in #if DEBUG on its branch. This needs a small main-side fix (guard those three tests), not a change here.
  2. Desktop Swift Static & Test Contracts failed only the 1,800s wall-clock budget (2,754s) — all 822 suites passed, with zero test failures. The overage is dominated by flaky exit-1 batches re-running in isolation (~55–100s SwiftPM invocation overhead each) plus deferred ratcheted suites; the same budget also fails on unrelated PRs (feat(desktop): opt-in on-device embeddings with FTS hybrid retrieval; backend keyword fallback for screen search #13456: 2,176s). The largest single suite here, MemoryAtlasPerformanceHarnessTests (353s), is one this PR touches, but its heavy multi-frame harness tests pre-date it — this PR removed replay/timeline assertions rather than adding load.

Things I'd want a maintainer to sign off on before merge (beyond the CI situation):

  • Rebuild data scope: collect_brain_map_sources now sends up to 200 conversations (summary-first prose, ~4k chars each) plus the people directory and active goals to the extractor, where it used to be memories only. Per-user data, rate limit retained — but that's a product/privacy-adjacent scope decision.
  • Gate removal on POST /v1/knowledge-graph/rebuild: the reasoning is sound (the shared store is replaced, canonical assertions are never touched, the read merges canonical-wins, and DELETE keeps its gate), but it widens who can trigger a rebuild, and the domain-model doc change reflects it.
  • Local schema migration: LocalKGSchema.registerMigrations in RewindDatabase.swift plus the memoryIdsJson column — migration surfaces deserve a human eye.
  • Automation contract change: memory_graph_rebuild on the desktop bridge now drives the mounted Brain Map surface (server-then-local-fallback) with accepted/finished/no_receiver semantics instead of calling the API directly — better fidelity for QA agents, but the result shape changed, and the e2e flow was updated accordingly.

Leaving for human maintainer review (product direction on the redesign itself — dropping the timeline replay, territories, and type colours — and the rebuild-route decisions above). Thanks for the unusually thorough test suite on a change this size.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@nathanchengx nathanchengx closed this by deleting the head repository Oct 18, 2026
aryanorastar added a commit that referenced this pull request Oct 19, 2026
…22078)

Mobile Mind Map can show an empty screen because the compatibility graph
omits saved-memory catalog records and later canonical pages. Read the
canonical catalog when the compatibility view is empty or owner-only,
keep memories without relationships readable, and provide Refresh / Show
More without attempting the rejected canonical rebuild. Existing
nonempty compatibility/shared graphs remain visible, including the
projection proposed in #12878.

Canonical pages remain revision-fenced and session-bound. Stale cursors
restart at page one, late refresh responses cannot replace newer data,
label changes render, backend/session changes and rejected authorization
clear old data, and failed ordinary refreshes preserve same-session
content. Expired cursors discard the invalidated revision before retry,
including if that retry fails. The canvas keeps a 200-entity bound and
fitted small maps retain readable labels. Catalog records remain
separate from graph entities and never create relationships. Onboarding
skips the legacy mutation after a successful canonical read. Initial
compatibility failures stop without a second expensive graph read; each
read retains zero transport retries. The loopback regression fixture
uses a stable backend override and the existing token-I/O seam so
session fencing remains enabled.

The backend adds an absence-only response header so a genuinely new
account can show an empty state while an unreadable canonical revision
remains a retryable failure. The existing HTTP status/body stay
compatible.

Refs #20481, #20463. Complements #20744; this PR is independent of
#12878's broader macOS/account-wide rebuild work. It does not assert
that affected accounts have eligible Long-term memories or that missing
assertions/data have been repaired.

## Validation

- Canonical backend service/FastAPI route suite: 17 passed.
- Final focused Flutter HTTP/error/widget/layout suites: 49 passed,
including real loopback HTTP gateway retry bounds, authorization/backend
changes, stale cursor restart failure, label refresh, viewport fitting
and bounded large pages.
- Visual audit passed: empty, saved-memory catalog, and later-page graph
states. Inspected captures; recovered graphs now fit the viewport with
readable, separated labels.
- Focused analyzer reported no errors/warnings (pre-existing
informational lints remain).
- App-client schema inventory: 13 passed; explicit endpoint URLs retain
contract discovery while requests stay pinned to their backend.
- Normal pre-push gate passed without skip flags on `2d70dcd229`: all 41
shared preflight checks, backend typecheck (0 errors), runtime-image
source closure, selected backend tests, OpenAPI compatibility, generated
Dart/Swift/TypeScript models, Flutter build_runner and Dart formatting.
The [final Mobile App Checks
run](https://github.com/BasedHardware/omi/actions/runs/39102810940)
passed, including the analyzer ratchet, regular Flutter suite, generated
files and Mobile Release Eligibility. Native compile/emulator and
seeded-journey jobs were not selected for this Dart-only diff;
physical-device/store verification remains pending.

Commands: `cd app && flutter test --no-pub
test/unit/http_pool_manager_retry_test.dart
test/unit/knowledge_graph_read_test.dart
test/unit/knowledge_graph_error_message_test.dart
test/widgets/memory_graph_empty_state_test.dart
test/widgets/memory_graph_fit_to_bounds_test.dart`; `cd backend &&
.venv/bin/python -m pytest
tests/unit/test_knowledge_graph_canonical_pagination.py -q` (includes
the FastAPI request path) and separately
`tests/unit/test_app_client_schema_inventory.py -q`. Focused `flutter
analyze --no-pub --no-fatal-infos` covered the changed API,
graph/catalog widgets, identity helper and tests.

The [backend CI
run](https://github.com/BasedHardware/omi/actions/runs/39102810914)
passed five unit shards and the slow guardrails on its first attempt.
Shard 1 passed its assertions but hit an unrelated CPU timing guard
(`test_capture_evidence_admission.py`: 1.03s against 1.00s); all four
tests in that file also passed locally under the unchanged 1.00s limit.
Only failed jobs were retried on the same commit, with no budget or
allowlist changes.

## Release and customer verification

Merge, deploy the backend absence header first, then release iOS and
Android. Retest on physical phones with affected accounts: open Mind
Map, verify saved memories or relationships, load more, refresh/reopen,
and confirm onboarding no longer attempts a canonical rebuild. If still
empty, privately check memory eligibility, processing and assertion
state. No customer account or production records were accessed.

Public store release evidence checked 2026-10-18: [App Store iOS
1.0.558+
notes](https://apps.apple.com/us/app/omi-smart-meeting-notes/id6502156163)
and [Google Play notes (updated October
15)](https://play.google.com/store/apps/details?id=com.friend.ios&hl=en_US)
both explicitly list the canonical knowledge-graph 409 onboarding fix
from #20744. This supports public release on both platforms. The exact
Android binary/source SHA and rollout coverage have not been verified
through Codemagic; the available login has no Omi workspace access.
Release of that error handling does not establish that an affected
account has a populated map.

## Product invariants affected

- INV-MEM-1: existing memory tiers and eligibility remain unchanged.
- INV-MEM-4: read-only client recovery; no new promotion or graph
mutation authority.

Failure-Class: FC-derived-state-gate-without-legacy-source-path

The canonical presence/absence probe must preserve the compatibility
path for unprovisioned accounts while rejecting unreadable state as
empty. Backend route and mobile HTTP/widget tests guard both sides.


## UI evidence

![Mobile Mind Map
catalog](https://raw.githubusercontent.com/BasedHardware/omi/11ca3d4498347737ced04b153557d58092be1408/.agent-artifacts/ui-evidence/mobile-mind-map-recovery/001-mobile-android-mind-map-catalog.png)

![Recovered graph
canvas](https://raw.githubusercontent.com/BasedHardware/omi/11ca3d4498347737ced04b153557d58092be1408/.agent-artifacts/ui-evidence/mobile-mind-map-recovery/002-mobile-android-mind-map-graph.png)

![Empty map
refresh](https://raw.githubusercontent.com/BasedHardware/omi/11ca3d4498347737ced04b153557d58092be1408/.agent-artifacts/ui-evidence/mobile-mind-map-recovery/003-mobile-android-mind-map-empty.png)
aryanorastar added a commit that referenced this pull request Oct 26, 2026
Onboarding still treated a failed Mind Map read as an empty legacy
account and sent a rebuild POST. This could turn a canonical read
outage, invalid response or replaced account session into an
unnecessary/rejected mutation. The optional prebuild now stops on read
failure; the normal map view retains its read/retry path.

The orchestration moves from the widget to
`KnowledgeGraphApi.prebuildForOnboarding`, which uses the existing
production reader, rebuild and polling owners. Successful canonical
reads and populated compatibility maps never rebuild. A positively
absent canonical account can still use legacy rebuild; 409 remains
terminal and a queued legacy rebuild retains bounded stability polling.
No server guard, memory promotion, storage, auth policy or wire schema
changes.

Refs #20481. The issue discussion by julio23jaz-dotcom also identified
this catch-and-rebuild path. Builds on merged #20744 and #22078; #12878
is closed unmerged and is not a dependency. This finishes the reproduced
failed-read onboarding gap, not a claim about every affected account's
current graph.

## Verification

- Six regressions fail after a behavior-preserving extraction of the
original catch-and-rebuild method; seven successful/legacy scenarios
still pass. With the fix, all 13 pass through the real HTTP client
against loopback (synthetic responses and the existing local auth
gateway; no live identity provider).
- Focused graph/API/widget/identity suite: 88 passed.
- Analyzer ratchet: passed. Direct analysis reports only the existing
`avoid_print` in unchanged stability polling; no new diagnostic.
- Final diff reviewed; all 27 local manifest checks and the bounded
pre-push gate passed. The local history-dependent 90-day class ratchet
explicitly skipped on the shallow checkout; CI runs with full history.
Exact-head CI remains pending; stays draft.
- `make mobile-verify ARGS="fast --paths
app/lib/backend/http/api/knowledge_graph_api.dart
app/lib/pages/onboarding/wrapper.dart"`: both selected hermetic journeys
passed (9 checks; source `43866f9f0032844e08902aa01f41ce390cc6ef14`,
clean).

The loopback flow exercises the entire changed orchestration boundary,
including parsing, read failures, account replacement, no-write
outcomes, terminal conflict and successful legacy polling. No UI layout,
native or hardware behavior changes; no physical-device test is needed
for this boundary.

## Failure class

Failure-Class: new

`FC-failed-probe-permits-mutating-recovery`: a failed probe was caught
and reinterpreted as permission to mutate. Why isn't this a shared
primitive instead? It is: the API owner now holds the prebuild flow, and
its loopback contract tests are the reusable prevention artifact rather
than a widget-specific source check.

## Release and customer follow-up

Merge and release the mobile update on iOS/Android. No additional
backend deployment is required for this incremental fix. Existing
canonical-read backend support from #22078 remains required and was
previously verified deployed. Keep support tracking open until the
affected users confirm their map loads and remains available after
refresh/reopen on the released build. No customer data, assignment,
deployment or account mutation was performed.

UI-Evidence: none

The widget only delegates its existing optional background request; no
visible control or layout changes.

## Product invariants affected

none; canonical read/mutation and promotion authority are preserved
(INV-MEM-1, INV-MEM-4).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS needs-maintainer-review Needs a human maintainer to sign off before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants