Repository navigation
feat: chat-first UI for canonical memory users - #10171
Conversation
commented
Jul 21, 2026
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
commented
Jul 21, 2026
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d082a9fe7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return MemorySystem.LEGACY | ||
|
|
||
| return MemorySystem.CANONICAL | ||
| return MemorySystem.CANONICAL if canonical_memory_cohort.is_canonical_memory_user(uid) else MemorySystem.LEGACY |
There was a problem hiding this comment.
Preserve canonical selection for local memory fixtures
In the local/offline dev harness, seed-memory-scenario still writes Alice/Bob as canonical_users and child_env_for exports that selection as MEMORY_CANONICAL_USERS, but this resolver now ignores both db_client and the harness env/manifest and only checks the static production/E2E whitelist. After seeding the documented happy_path, alice therefore resolves LEGACY and /v3/memories/run-canonical-promotion no longer exercise the canonical memory path the fixture advertises.
Useful? React with 👍 / 👎.
9d082a9 to
9ec1bb3
Compare
Adds the server-owned, fail-closed chat_first_ui capability and operator guardrails, plus the singleton source filter and Firestore indexes required for the Omi capture archive. Regenerates all affected app clients.\n\nVerification:\n- BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-chat-first-backend-tests.txt bash backend/test.sh\n- backend/scripts/openapi_runner.sh scripts/export_openapi.py --surface app-client --check ../docs/api-reference/app-client-openapi.json\n- Python Swift/TypeScript OpenAPI generator freshness checks\n- app-client OpenAPI compatibility against origin/main\n- Black and git diff --check\n- fresh Sol pre-commit review
Projects the server-owned Chat-first capability through the desktop agent runtime and adds a main-Chat-only structured block tool. The backend validates canonical references; the local journal atomically binds receipts to the producing assistant turn. Legacy surfaces keep the unchanged base manifest and render new block cases inert.\n\nVerification:\n- backend focused chat-first capability/block suite (64 tests)\n- desktop agent focused journal/manifest/session suite (103 tests)\n- desktop agent build and tool-surface generator check\n- desktop Swift debug build and agent-logic harness\n- app-client OpenAPI export, generator freshness, compatibility, Black, desktop test-quality, and git diff checks\n- fresh Sol review-and-fix gate
Keep the generation-fenced main-Chat capability when an accepted run inherits its context snapshot, while reapplying the destination surface gate so non-main sessions remain off.\n\nVerification:\n- 55 focused agent capability/context/history/manifest tests\n- desktop agent TypeScript build\n- fresh Sol regression review and diff check
Adds the capability-gated main-Chat search_chat_history tool. The stdio child relays only after normal authorization; the parent kernel searches the caller's current-generation journal with strict ownership, date, excerpt, and 500-turn bounds.\n\nVerification:\n- 65 focused journal/search/manifest tests\n- desktop agent TypeScript build and tool-surface generator check\n- fresh Sol review: 69 focused tests and tool-surface contract suite\n- shared full agent harness deferred until concurrent T06 Swift compile completes
Adds fail-closed server-owned proactive intent, deferral, budget, receipt, and materialization-fetch contracts. It reserves budget before any judge call, emits no feature work for capability-off users, and never writes a chat transcript.\n\nVerification:\n- 35 focused T04 backend/API/generator tests (plus 11 generator tests)\n- app-client OpenAPI export, TS/Swift generation, and compatibility checks\n- Black and git diff checks\n- fresh Sol review-and-fix gate\n\nDeferred: source-owner wake hooks, real grounded judge binding, kernel materialization, and UI rendering.
Adds a server-sampled, fail-closed parallel shell with Chat as home, typed primary/More navigation, and capability projection before chat warmup. More→Dashboard routes to the one Chat rather than embedding an inline second composer; legacy shell behavior is preserved.\n\nVerification:\n- ChatFirstShell XCTest suite (including stable goals automation route)\n- Swift debug build and desktop test-quality check\n- agent-logic Swift gate: 438 focused lifecycle/state tests\n- agent runtime/node harness: 104 + 104 tests\n- named omi-chat-first-t06 bundle: signed/launched, healthy runtime, capability-off legacy shell and legacy Chat/Tasks/Conversations routes verified\n- fresh Sol review-and-fix gate\n\nEnabled live shell was not exercised because the server-authoritative dev control returned off for the seeded account; no local override was used.
Add the cohort-gated rich main-chat block renderer and an Omi-hardware capture archive with source-safe cache queries, typed discuss-in-chat routing, and honest playback states.\n\nVerification: git diff --check and desktop test-quality static check passed. Runtime Swift builds/tests are intentionally deferred to the final consolidated verification pass at user direction; no queued results are claimed.
Make question suggestions durable, one-tap normal chat interactions with tail-only controls, restart recovery, and a separate capability-gated deferral outbox. Add the cohort-only shared-store Tasks workspace with owner-fenced rollback behavior and source-safe capture links.\n\nVerification: static diff checks and independent Sol review/fix gates completed. Runtime builds, test suites, harness, and UI exercise are intentionally deferred to the single final verification pass at user direction.
Add the cohort-gated foreground Chat materializer, receipt-safe ordered kernel batch, and normal journal reconciliation for server-owned proactive intents.\n\nVerification: static diff checks plus a fresh Sol review/fix gate completed. Runtime builds, suites, harness, and UI exercise remain deferred to the single final verification pass at user direction.
Add the cohort-scoped canonical Goals surface and a generation-bound rich/sparse cold-start path. Cold-start delivery remains receipt-backed, and sparse-sequence terminal state now lifts proactive suppression through a durable journal receipt.\n\nVerification: static diff checks and fresh Sol review/fix gates completed. Runtime builds, suites, harness, and UI exercise remain intentionally deferred to the final consolidated verification pass at user direction.
Add shape-only Chat-first analytics, local-only focus acknowledgement evidence, and non-production fixture contracts for cohort-negative validation.\n\nVerification: static diff checks plus fresh Sol review/fix gate completed. The consolidated runtime, manifest-byte, and named-bundle verification pass begins next.
Repair Swift runtime, wire, and view integration faults surfaced by the consolidated desktop compile.\n\nVerification: static parse/diff checks and a fresh Sol repair review passed; focused Swift runtime verification resumes next.
Repair actor-isolated analytics injection, materialization driver capture, and explicit shared task-store ownership.\n\nVerification: static parse/diff checks and fresh Sol review passed; focused Swift verification resumes next.
Add an explicit JournalOperationResult initializer for materialization fields and repair async archive assertions.\n\nVerification: focused desktop compile and 39 Chat-first/capture tests passed; fresh Sol review passed.
Project immutable journal revisions correctly and reclaim expired deferral leases without allowing stale delivery settlement.\n\nVerification: focused journal suite passes 54/54; fresh Sol review passed.
Failure-Class: none
Failure-Class: none
Failure-Class: none
Failure-Class: none
Apply the repository-pinned Flutter 3.44.5 formatter to the 75 changed Dart files in this branch. Verification: pinned formatter reports 75 files formatted, 0 changed after the write.
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7da3ff32c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return None | ||
| assert eligibility.account_generation is not None | ||
| generation = eligibility.account_generation | ||
| sequence_id = f'cold-start:{generation}' |
There was a problem hiding this comment.
Scope cold-start terminal receipts by owner
When two canonical users use the same Mac with the same account generation (normally 0), this assigns both sequences the identical cold-start:0 identity. The desktop SQLite table keys terminal receipts solely by sequence_id, and its recorder rejects an existing row owned by another account; therefore, if the first user signs out before their completion/abandonment receipt is acknowledged, the second user's terminal journal transaction rolls back and their cold-start sequence remains active indefinitely. Include owner identity in the durable key or make the local receipt key owner-scoped.
AGENTS.md reference: AGENTS.md:L88-L89
Useful? React with 👍 / 👎.
| const selected = findSelectedQuestionBlock(store, conversationId, questionId); | ||
| if (selected) { | ||
| const continuityKey = questionInteractionContinuityKey(questionId, selected.optionId); |
There was a problem hiding this comment.
Give re-raised questions a new interaction identity
When a deferred question is released, the backend deliberately materializes the original question verbatim with the same question_id. Because this lookup searches every historical assistant turn before checking the current tail, it finds the original selection: selecting the same option returns the old exchange as a duplicate, while selecting any other option is rejected. Consequently every successfully re-raised question remains unanswered and blocks later proactive materialization; scope duplicate detection to the current parent or mint a distinct interaction identity for each release.
AGENTS.md reference: desktop/macos/AGENTS.md:L375-L379
Useful? React with 👍 / 👎.
| `SELECT turn_json | ||
| FROM conversation_turn_revisions | ||
| WHERE conversation_id = ? AND generation = ? | ||
| ORDER BY turn_seq DESC | ||
| LIMIT ?`, |
There was a problem hiding this comment.
Search only the latest revision of each turn
For any turn that was updated after insertion—especially a streaming assistant turn—this query returns every stored revision rather than the canonical final turn. A history search can therefore emit duplicate or obsolete partial text, let revisions of one turn consume the result limit, and exhaust the 500-row scan before reaching 500 logical turns. Select the latest revision per turn_id (or search the current conversation_turns projection) so replacement semantics are preserved.
AGENTS.md reference: desktop/macos/AGENTS.md:L380-L382
Useful? React with 👍 / 👎.
| return ProactiveWakeResult(outcome='declined') | ||
|
|
||
|
|
||
| def persist_capture_arrival_intent( |
There was a problem hiding this comment.
Invoke capture-arrival persistence after finalization
No production code calls this function—the only repository references outside its definition are unit tests—so completing an Omi capture never creates a capture_arrival intent. As a result, the deterministic capture-arrival path documented by this change and supported by the desktop materializer is dead in real usage; invoke it from the existing post-commit conversation-finalization boundary while preserving its failure isolation.
Useful? React with 👍 / 👎.
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcab12567c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not is_canonical_memory_user(uid): | ||
| raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail='Not found') |
There was a problem hiding this comment.
Use the canonical resolver in task route guards
Fresh evidence beyond the earlier resolver comment is that resolve_memory_system now honors MEMORY_CANONICAL_USERS for local/offline users, but this guard still calls the static production whitelist directly. Such a fixture user is therefore classified as canonical and can receive the canonical/Chat-first shell while every route using require_canonical_task_user returns 404; the intent and candidate database guards repeat the same mismatch. Route and store admission should use the same resolved cohort predicate as rollout selection.
Useful? React with 👍 / 👎.
| collection = _user_ref(uid, firestore_client=client).collection(DEFERRALS_COLLECTION) | ||
| candidates: list[ProactiveDeferral] = [] | ||
| for snapshot in collection.stream(): |
There was a problem hiding this comment.
Query only pending deferrals that can be released
On every foreground materialization, this streams the user's entire deferral collection and filters generation, state, and due time in Python. Released rows are retained, so accounts that regularly defer questions incur an ever-growing Firestore read and latency cost even when nothing is due; the subject-triggered wake path performs the same scan. Query pending rows by generation and due time or subject with a bounded limit instead of scanning historical deferrals.
Useful? React with 👍 / 👎.
| captures = rows | ||
| count = remoteTotal |
There was a problem hiding this comment.
Reconcile the selected capture when refreshing
If a selected capture is subsequently discarded, deleted, or otherwise removed from the server-scoped archive, Refresh replaces captures but leaves selectedCapture untouched. The removed capture therefore remains visible in the detail pane, including its stale playback controls, even though it no longer appears in the authoritative list; refresh should clear a missing selection or replace it with the refreshed matching record.
Useful? React with 👍 / 👎.
| def run_post_commit_wake( | ||
| uid: str, | ||
| trigger: ProactiveWakeTrigger, | ||
| **kwargs, | ||
| ) -> ProactiveWakeResult: | ||
| """Failure-isolated convenience seam for background mutation owners.""" | ||
|
|
||
| try: | ||
| return wake_after_commit(uid, trigger, **kwargs) |
There was a problem hiding this comment.
Invoke proactive wakes after task and goal commits
A repo-wide search finds this exported wake wrapper referenced only by its definition and unit tests, with no production task or goal mutation boundary invoking it. Consequently a deferred question is never re-raised when its task or goal meaningfully changes—the only working release path is the later foreground due-time scan—and the task/goal judgment tier cannot receive production triggers. Call this failure-isolated wrapper from the relevant post-commit mutation owners.
Useful? React with 👍 / 👎.
| private func navigateToLegacyDestination(_ item: SidebarNavItem) { | ||
| if usesChatFirstShell { | ||
| chatFirstNavigation.selectLegacyDestination(item) | ||
| } else { | ||
| selectedIndex = item.rawValue | ||
| } |
There was a problem hiding this comment.
Route Continue in Omi through Chat-first navigation
The new shell uses chatFirstNavigation instead of selectedIndex, but the existing .openMainChatRequested handler still assigns only selectedIndex = dashboard. For an enrolled user viewing Tasks, Goals, Memories, or Conversations, the floating bar's “Continue in Omi” action therefore leaves the current Chat-first route unchanged and its pending main-chat request unconsumed. Handle that notification through this adapter (and consume the request) so it selects .chat for the new shell.
Useful? React with 👍 / 👎.
Failure-Class: none
Keep the Home ask-field focus request alive when chat is already visible, and make the related source-contract helpers balance nested braces. The canonical-goals timeout was not reproducible in the focused suite. Failure-Class: none
Record the one-line chat-focus control-flow addition with the required product-file baseline justification. Failure-Class: none
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c45e7808b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function questionInteractionContinuityKey(questionId: string, optionId: string): string { | ||
| return `qri_${createHash("sha256").update(`${questionId}\u0000${optionId}`).digest("hex").slice(0, 32)}`; | ||
| } | ||
|
|
||
| function stableQuestionInteractionTurnID(continuityKey: string, role: "user" | "assistant"): string { | ||
| return `turn_${createHash("sha256").update(`${continuityKey}\u0000${role}`).digest("hex").slice(0, 16)}`; |
There was a problem hiding this comment.
Scope question reply identities to the conversation
When another conversation—particularly after switching accounts on the same Mac—selects the same option for the same questionId, these helpers generate identical turn IDs because neither the owner nor conversation participates in the hash. recordJournalTurn then resolves that ID globally through findJournalTurnById and rejects it as belonging to another conversation, so the second selection cannot create its user/assistant exchange. Include the conversation or owner identity while preserving retry stability within one logical interaction.
AGENTS.md reference: desktop/macos/AGENTS.md:L375-L379
Useful? React with 👍 / 👎.
| promptMaterializationCoordinator.activate(using: viewModelContainer.chatProvider) | ||
| viewModelContainer.canonicalGoalsStore.activate(capability: capability) | ||
| automationRuntime.install() | ||
| AnalyticsManager.shared.chatFirst(.routeEntered(route: .chat, origin: .shellLaunch)) |
There was a problem hiding this comment.
Report the restored route on shell launch
When navigation restores a persisted route such as Tasks, Goals, Memories, or More, the shell mounts that destination but always emits a chat_first_route_entered event for Chat. Relaunch traffic is therefore attributed to the wrong route and biases route-entry analytics; derive the event route from navigation.route rather than hard-coding .chat.
Useful? React with 👍 / 👎.
| AnalyticsManager.shared.chatFirst( | ||
| .richBlock(kind: .goalLink, outcome: .acted, action: .open) | ||
| ) | ||
| navigation.open(focus: .goal(id: goalID)) |
There was a problem hiding this comment.
Fence concurrent goal-link resolutions
When a user clicks goal A and then goal B before A's detail request finishes, each GoalLinkView independently awaits its request and unconditionally navigates on completion. If B resolves first and A resolves later, this callback overwrites the newer navigation and unexpectedly opens A; track a shared/latest open request or otherwise verify that this link is still the pending destination before calling navigation.open.
Useful? React with 👍 / 👎.
| if isinstance(block, CaptureLinkSpec): | ||
| capture = conversations_db.get_conversation(uid, block.conversation_id) | ||
| return bool(capture and capture.get('source') == 'omi' and not capture.get('discarded', False)) |
There was a problem hiding this comment.
Reject locked captures during block validation
For a free-tier user whose Omi capture has is_locked=true, this predicate accepts the capture as available because it checks only provenance and discard state. Clicking the resulting card then calls the detail route, which rejects locked conversations with 402, and the desktop renders the link as stale/unavailable despite the backend having approved it; apply the same locked-entity check already used for task cards (and for capture-backed question subjects).
Useful? React with 👍 / 👎.
| if not is_canonical_memory_user(uid): | ||
| return False |
There was a problem hiding this comment.
Finalize claimed dispatches after cohort revocation
If canonical enrollment is removed after an integration dispatch is claimed but before its external side effect reports completion, this branch refuses to persist either success or failure and leaves the row in processing. The external sync may already have succeeded; if the account is later re-enrolled, the expired lease is claimable again and the same integration side effect can be delivered twice. Completion of an already-authorized lease must record its terminal result even if current cohort membership changed.
Useful? React with 👍 / 👎.
Address Chat-first review findings across proactive intent identity, deferral release queries, capture finalization, task/goal wakes, owner-scoped journal state, and navigation focus handling. Preserve the resolved main-branch changes and generated indexes. Verification: focused backend suite 181 passed; preflight runner tests 35 passed, 2 skipped; agent runtime build and 90 tests passed; Swift Chat-first tests 32 passed.
Update the merged migration count fixture and exact desktop ratchet baselines after syncing the owner-scoped receipt migration. Failure-Class: none Verification: npm run build && npm test -- --run (57 files, 652 tests passed).
Verification: backend/.venv/bin/pytest tests/unit/test_app_client_swift_generator.py -q (8 passed).
Verification: backend/scripts/generate_ts_openapi_types.py --check and generate_swift_openapi_types.py --check pass.
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c2ca35792
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for task_id in task_ids: | ||
| run_task_changed_wake(uid, task_id=task_id, mutation_key=mutation_key) |
There was a problem hiding this comment.
Batch proactive wakes instead of issuing one per task
For batch mutations, this loop performs synchronous proactive processing once per updated task; each call resolves eligibility with a Firestore control read, and enrolled users perform additional intent queries/transactions. The batch-delete route permits 10,000 IDs and the other batch routes permit hundreds, so a successful mutation can spend thousands of sequential network round trips before returning and time out even for out-of-cohort users. Resolve eligibility once and dispatch or batch the post-commit wakes rather than invoking the full pipeline per ID.
Useful? React with 👍 / 👎.
| default: | ||
| throw new Error("Chat-first intent block type is invalid"); |
There was a problem hiding this comment.
Handle memoryLink blocks during proactive materialization
When /v1/chat/materialize-prompts returns a proactive intent containing a memoryLink, this switch falls into the default error even though backend/models/chat_first.py includes MemoryLinkSpec in the accepted ChatFirstBlockSpec union. The entire local materialization transaction then aborts without a receipt, so that valid intent is retried indefinitely and can block later intents; normalize memory_id and summary into the existing runtime memoryLink shape here.
Useful? React with 👍 / 👎.
| AnalyticsManager.shared.chatFirst( | ||
| .richBlock(kind: .captureLink, outcome: .acted, action: .open) | ||
| ) | ||
| navigation.open(focus: .capture(id: conversationID, momentTs: moment)) |
There was a problem hiding this comment.
Fence concurrent capture-link resolutions
If the user clicks capture A and then capture B before either detail request completes, each card owns an independent task and this callback navigates unconditionally. If B resolves first and A later, A overwrites the newer destination—even after the Chat view has disappeared—because these unstructured tasks are not cancelled on unmount. Use the same root-owned latest-resolution fence added for goal links before opening the capture.
Useful? React with 👍 / 👎.
| return #"{"ok":false,"error":"invalid_canonical_goal"}"# | ||
| } | ||
| do { | ||
| let goal = try await api.createCanonicalGoal( |
There was a problem hiding this comment.
Pin canonical goal creation to the authorized owner
When the authorization generation changes after this tool was admitted—such as a sign-out/re-auth or account switch before request headers are built—this call uses the unscoped createCanonicalGoal overload and can authenticate with the new session. The old authorizationSnapshot is checked only after the backend mutation, so a stale run can create a goal despite no longer being authorized and then merely discard the result; pass the expected owner and captured authorization snapshot through the mutation API as the read and focus paths already do.
Useful? React with 👍 / 👎.
| persist_capture_arrival_intent( | ||
| uid, | ||
| conversation_id=conversation_id, | ||
| summary=summary, | ||
| ) |
There was a problem hiding this comment.
Offload capture-arrival persistence from the event loop
finalize_persisted_conversation is async, but this direct call performs synchronous Firestore eligibility reads and an intent transaction on its event-loop thread for every finalized Omi capture. Under concurrent finalizations those network waits block health checks and unrelated requests; invoke it through await run_blocking(db_executor, ...) or an appropriate tracked background primitive while retaining failure isolation.
AGENTS.md reference: backend/AGENTS.md:L283-L291
Useful? React with 👍 / 👎.
| if (input.disposition === "accept" && terminalized.status === "completed") { | ||
| appendNextColdStartSequenceQuestion(store, input.ownerId, terminalized, now); |
There was a problem hiding this comment.
Abandon cold start when its selected continuation fails
If the model/tool continuation after a sparse cold-start selection ends failed, cancelled, timed out, or discarded, this condition neither appends the next step nor records an abandoned terminal receipt. The parent question is already selected, so the unrelated-user-turn retirement path cannot recover it; the backend therefore keeps has_active_sparse_cold_start_sequence true indefinitely and suppresses daily openers and task/goal judgment even after normal Chat continues. Record an abandoned receipt when a selected sequence continuation reaches a non-success terminal state.
Useful? React with 👍 / 👎.
| if let cached = try? await local.detail(id: id), cached.isOmiCaptureArchiveRecord { | ||
| guard selectedCapture == nil || selectedCapture?.id == id else { return nil } | ||
| selectedCapture = cached |
There was a problem hiding this comment.
Reject locked cached captures before publishing detail
When the server has marked a capture locked but its transcript remains in the local cache from an earlier sync, this predicate accepts it and immediately publishes the cached detail, including locally stored transcript segments. The authoritative detail request then returns 402, but the catch leaves selectedCapture visible, so the Chat-first archive exposes content that the backend currently denies; require an unlocked cached record and clear any provisional detail when remote authorization fails.
Useful? React with 👍 / 👎.
| case "pending": | ||
| return .pending(pollAfterMs: response.pollAfterMs) | ||
| case "unavailable": | ||
| return .unavailable |
There was a problem hiding this comment.
Prefer cached file playback while the aggregate is pending
When the aggregate artifact is pending or unavailable but at least one individual audio file is already cached, these early returns prevent the later fileFallback branch from ever seeing that playable file. The backend response in backend/utils/sync/playback.py always includes a conversation_audio object, so the fallback is effectively unreachable against the current API and users cannot play the ready part while the aggregate merge is preparing; prefer a ready aggregate, then a cached file, and only then report the aggregate's pending/unavailable state.
Useful? React with 👍 / 👎.
Keep the top-level auth and cohort branches behind concrete type boundaries so the release compiler can type-check DesktopHomeView within its timeout.\n\nVerification: xcrun swift build -c release --package-path Desktop --triple arm64-apple-macosx; xcrun swift test --package-path Desktop --filter 'ChatFirstShellTests|MainChatNavigationRequestStoreTests' (19 passed); swift-format lint.\n\nFailure-Class: none
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a818ed7d0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| PYTHON="$(PYTHON)" bash scripts/dev-harness/chat-first-e2e-fixture.sh "$(CHAT_FIRST_E2E_ACTION)" "$(CHAT_FIRST_E2E_CASE)" "$(CHAT_FIRST_E2E_SECONDS)" | ||
|
|
||
| run-canonical-promotion: | ||
| PYTHON="$$PYTHON" PYTHONPATH="scripts/dev-harness:backend$(if $(PYTHONPATH),:$(PYTHONPATH),)" "$$PYTHON" scripts/dev-harness/run-canonical-promotion.py "$(PROMOTION_USER)" |
There was a problem hiding this comment.
Point the promotion target at an existing script
Invoking make run-canonical-promotion always fails because the recipe executes scripts/dev-harness/run-canonical-promotion.py, but a repo-wide rg --files -uu finds no such file or generated artifact; only run-canonical-maintenance.py exists. Add the promotion script in this change or remove/correct the unusable target.
Useful? React with 👍 / 👎.
| for task in action_items_db.get_action_items(uid, completed=False, limit=3): | ||
| task_id = task.get('id') | ||
| if isinstance(task_id, str) and task_id: | ||
| blocks.append(TaskCardSpec(type='taskCard', task_id=task_id)) |
There was a problem hiding this comment.
Skip locked tasks when building proactive openers
For a canonical free-tier account with locked incomplete tasks, get_action_items can return rows with is_locked=true, and this code emits them as taskCard blocks without the validation performed by /v1/chat-first/blocks/validate. The materialized card then hydrates through the action-item detail route, which rejects locked tasks with 402, so daily and rich cold-start openers immediately render stale/unavailable cards; filter locked rows before constructing the blocks.
Useful? React with 👍 / 👎.
| authorizationSnapshot: scope.authorizationSnapshot | ||
| ) | ||
| guard scopeIsCurrent(scope), detail.goal.goalId == normalizedGoalID else { return nil } | ||
| selectedGoalDetail = detail |
There was a problem hiding this comment.
Fence shared goal-detail publication by request
When goal A and goal B are opened concurrently, each loadDetail publishes to the shared store before GoalLinkView checks the new navigation generation fence. If B resolves and navigates first but A completes last, the route remains focused on B while selectedGoalDetail becomes A (or is cleared if A fails); displayedDetail then rejects the mismatch and the Goals page can remain on “Loading goal.” The fresh evidence beyond the earlier navigation-race finding is that the navigation fence now works, but this preceding shared-store mutation is still unfenced.
Useful? React with 👍 / 👎.
| .background(OmiColors.backgroundPrimary) | ||
| .onAppear { | ||
| tasksStore.isActive = true | ||
| Task { await tasksStore.loadTasksIfNeeded() } |
There was a problem hiding this comment.
Hydrate the exact task requested by a deep link
When a capture links to a completed task—or an incomplete task outside the initially loaded page—opening that link leaves the focus pending indefinitely. This startup call loads incomplete tasks only, while the page scrolls and acknowledges focus only for IDs already in visibleTasks; unlike task cards and goal-detail task actions, it never calls resolveCanonicalTask(id:) for pendingTaskID. Resolve the requested ID explicitly before attempting to scroll and acknowledge it.
Useful? React with 👍 / 👎.
| Button("Check audio") { | ||
| Task { _ = await playback.prepare(for: capture, forceRefresh: true) } | ||
| } |
There was a problem hiding this comment.
Retry the pending moment after audio becomes ready
When a timestamped capture deep link initially resolves playback as pending, resolvePendingFocusIfNeeded correctly leaves the focus unacknowledged, but this retry button only refreshes playback. If the aggregate is now ready, it neither seeks to the requested moment nor acknowledges the focus, and the .task(id: pendingFocusToken) does not rerun because the focus token has not changed. Re-run the pending moment resolution after a successful refresh.
Useful? React with 👍 / 👎.
| isLoadingMore = true | ||
| defer { isLoadingMore = false } | ||
|
|
||
| let query = CaptureArchiveQuery(offset: captures.count) |
There was a problem hiding this comment.
Track the server page offset independently of inserted details
When a deep link opens an older capture outside the first server page, loadDetail inserts that record at the front of captures; using captures.count as the next server offset then assumes the collection is still a contiguous prefix. For example, first-page rows 0–49 plus detail row 100 produce offset 51, permanently skipping row 50, and the duplicate detail in the fetched page can make hasMore become false with that row still absent. Maintain a separate pagination offset based only on fetched list pages.
Useful? React with 👍 / 👎.
| # never a legacy/general-memory fallback. Device-scoped reads remain on | ||
| # the canonical service path because V3's compatibility projection has | ||
| # no device-scope representation. | ||
| if scope_request.device_scope != 'all': |
There was a problem hiding this comment.
Distinguish canonical readiness from device-scope eligibility
For a code-enrolled canonical user whose control or projection is temporarily missing or stale, canonical_read_enabled makes is_canonical false, so a device-scoped request is rejected by the earlier 400 “only supported for canonical users” check and never reaches this new fail-closed path. The same account receives the intended retryable 503 for an all-device read, while device-scoped clients are incorrectly told the feature is permanently unsupported; determine device-scope eligibility from resolve_memory_system and reserve readiness for the 503 decision.
Useful? React with 👍 / 👎.
| whyItMatters: input.whyItMatters, | ||
| successCriteria: input.successCriteria, | ||
| accountGeneration: controlGeneration, | ||
| idempotencyKey: "chat-first-goal:\(UUID().uuidString.lowercased())" |
There was a problem hiding this comment.
Reuse the goal-creation key when retrying a tool call
If the backend commits a canonical goal but its response is lost, retrying the same create_canonical_goal tool execution generates a fresh idempotency key and creates a second goal instead of returning the first mutation receipt. This defeats the endpoint's safe-retry boundary and can duplicate goals during transport or runtime retries; derive the key from the stable run/tool-call identity rather than a new UUID on every invocation.
Useful? React with 👍 / 👎.
| let outputURL = evidenceRoot.appendingPathComponent("rewind-\(evidenceDigest).jpg") | ||
| try data.write(to: outputURL, options: .atomic) |
There was a problem hiding this comment.
Remove orphaned Rewind evidence files
The tool writes a raw screenshot copy into Application Support/Omi/ChatEvidence before journal admission, but neither the catch path nor journal clearing removes it; a repo-wide search finds no other cleanup for this directory. If the run is superseded or evidence append fails, the unreferenced image remains indefinitely, and even successfully journaled images survive chat deletion, bypassing the original Rewind cache lifecycle. Delete the file on failed admission and clean referenced evidence when its journal is cleared.
Useful? React with 👍 / 👎.
| _ = try await client.focusCanonicalGoal( | ||
| goalID: normalizedGoalID, | ||
| replacementGoalID: replacementGoalID, | ||
| focusRank: nil, |
There was a problem hiding this comment.
Make Set as focus replace the primary goal
With the normal state of one focused goal and available focus capacity, this request passes the old primary as replacementGoalID but sends focusRank:nil. The backend ignores replacement unless the focus set is already full and assigns the new goal the next free rank, so the old rank-0 goal remains primaryFocusedGoal; after reconciliation this method still returns success while the page continues showing the old focus. Use an operation that explicitly replaces or reorders the primary regardless of remaining focus capacity.
Useful? React with 👍 / 👎.
Keep the top-level auth and cohort branches behind concrete type boundaries so the release compiler can type-check DesktopHomeView within its timeout.\n\nVerification: xcrun swift build -c release --package-path Desktop --triple arm64-apple-macosx; xcrun swift test --package-path Desktop --filter 'ChatFirstShellTests|MainChatNavigationRequestStoreTests' (19 passed); swift-format lint.\n\nFailure-Class: none
Type-erase the decorated main-content presentation and lifecycle stages so the pinned Xcode 16.4 release compiler can type-check the home shell within its timeout.\n\nVerification: xcrun swift build -c release --package-path Desktop --triple arm64-apple-macosx\nFailure-Class: none
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30ee7d305d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ((startAtMs !== null && turn.createdAtMs < startAtMs) || (endAtMs !== null && turn.createdAtMs > endAtMs)) { | ||
| continue; | ||
| } | ||
| const excerpt = chatHistorySearchExcerpt(turn.content, query); |
There was a problem hiding this comment.
Include structured blocks in Chat history search
When an older result exists only as a rich assistant turn, this searches only turn.content; for example, materializeChatFirstIntentInTransaction deliberately stores proactive turns with empty content and all visible questions/entity summaries in contentBlocks. Consequently, search_chat_history reports no match for journaled decisions that the user can still see in Chat. Search a bounded textual projection of supported structured blocks alongside plain content.
AGENTS.md reference: desktop/macos/AGENTS.md:L383-L389
Useful? React with 👍 / 👎.
| [now, now, input.continuityKey], | ||
| ); | ||
| } else { | ||
| const retryable = !input.errorCode?.endsWith("_4xx") && attempts < 5; |
There was a problem hiding this comment.
Keep transient deferral deliveries retryable
When the backend remains offline or returns retryable 408/429/5xx responses for five deliveries, this converts the durable “Ask me later” row to failed. The drain query never selects failed rows, and startup recovery only requeues rows left in delivering, so the selection is permanently lost and the question is never re-raised even after connectivity recovers. Keep transient failures retryable with capped backoff, reserving terminal failure for non-retryable responses.
Useful? React with 👍 / 👎.
| } else { | ||
| captures.insert(detail, at: 0) | ||
| } | ||
| try? await local.store(detail) |
There was a problem hiding this comment.
Fence capture-cache writes to the initiating owner
If the signed-in owner changes while an archive detail request is completing, this unfenced cache write can resume after the switch and persist the previous owner's capture—including transcript segments—through whichever per-user SQLite pool is now current. The regular conversation repository prevents this exact race by passing a ConversationCacheWriteScope and captured generation into syncServerConversation, but the new archive data source omits both and has no owner-generation check. Carry an owner-scoped generation through archive reads and cache writes so a stale response is discarded.
Useful? React with 👍 / 👎.
| AnalyticsManager.shared.chatFirst( | ||
| .question(lifecycle: isDeferral ? .deferred : .answered) | ||
| ) |
There was a problem hiding this comment.
Emit question outcomes only after journal acceptance
When a tap is rejected because another send acquired the lock, the capability changed, or the question ceased to be the actionable tail, this still emits answered or deferred before selectQuestionCardOption reaches any concurrency, quota, or kernel-admission check. Those rejected taps therefore inflate successful question outcomes and can distort the Chat-first experiment; make the selection API report acceptance and emit these lifecycle outcomes only after the kernel commits the reply.
AGENTS.md reference: desktop/macos/AGENTS.md:L26-L30
Useful? React with 👍 / 👎.
| guard let lastAttemptAt else { return true } | ||
| return now.timeIntervalSince(lastAttemptAt) >= minimumInterval |
There was a problem hiding this comment.
Schedule a materialization retry after debounce
When the user returns to Chat less than 60 seconds after the previous materialization attempt, this rejects the transcript-ready trigger but schedules no work for the remaining interval. If a capture/task intent arrived meanwhile—or the previous request failed—the only other triggers are a later route reopen or window foreground/key notification, so keeping the window open can leave the ready intent and pending receipts untouched indefinitely. Schedule one delayed attempt for the end of the interval while the transcript remains visible.
Useful? React with 👍 / 👎.
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b81658b53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| private func resolvePendingMemoryFocus() async { | ||
| guard case .memory(let id) = navigation.pendingFocus else { return } | ||
| guard await viewModelContainer.memoriesViewModel.openMemory(id: id) else { return } |
There was a problem hiding this comment.
Resolve memory focus after the initial sync
When a memory link is opened before MemoriesViewModel has finished its first load—such as on a fresh launch or while the scheduled warmup is still running—this task races the page's own loadMemoriesIfNeeded(). openMemory checks only the current page and SQLite cache, so it can return false before the valid server memory is downloaded; because pendingMemoryFocusID does not change when loading later completes, the task never retries, leaving the detail panel closed and the focus permanently unacknowledged. Wait for the active memory-load lifecycle or fetch the referenced memory explicitly before resolving the focus.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| nonisolated static func questionInteractionContinuityKey(questionID: String, optionID: String) -> String { | ||
| "qri_\(sha256Prefix("\(questionID)\u{0}\(optionID)", byteCount: 16))" |
There was a problem hiding this comment.
Match the kernel's scoped question identity
Fresh evidence after the earlier identity-scoping change is that the kernel now hashes owner, conversation, question, and option, while this client turn ID still hashes only question and option. Every accepted question selection therefore returns a continuity key and turn IDs that fail the strict checks in sendMessage; the kernel has already journaled the selection and exchange, but Swift reports that the suggestion is unavailable and never starts the continuation. Derive the client identity from the same owner/conversation-bound inputs or accept the kernel-issued identity.
AGENTS.md reference: desktop/macos/AGENTS.md:L375-L379
Useful? React with 👍 / 👎.
| if let selectedCapture { | ||
| // Keep the selected value coherent with the server-authoritative page. | ||
| // A removed capture must not remain open as stale local state. | ||
| self.selectedCapture = rows.first(where: { $0.id == selectedCapture.id }) |
There was a problem hiding this comment.
Preserve deep-linked detail across the first-page refresh
When the archive is first mounted with a pending capture deep link, its initial-list task and focus-detail task run concurrently. If the detail resolves first, this later first-page refresh replaces the full selected detail with the list's redacted row, or clears it entirely when the linked capture is older than page one; the detail panel then loses its transcript or disappears, and an already acknowledged focus will not retry. Keep the independently validated detail selected rather than treating absence from one paginated page as deletion.
Useful? React with 👍 / 👎.
| client = _db(firestore_client) | ||
| _require_current_control(uid, account_generation=account_generation, firestore_client=client) | ||
| collection = _user_ref(uid, firestore_client=client).collection(INTENTS_COLLECTION) | ||
| for snapshot in collection.stream(): |
There was a problem hiding this comment.
Query cold-start state without scanning intent history
For established accounts, every foreground materialization calls this helper and has_active_sparse_cold_start_sequence, and both stream the user's entire proactive-intent collection before filtering in Python. That collection grows with daily openers and capture-arrival intents, so Chat foregrounding becomes progressively slower and incurs an unbounded number of Firestore reads; sufficiently long histories can time out prompt materialization altogether. Store the per-generation cold-start state directly or use indexed, limited server-side predicates.
Useful? React with 👍 / 👎.
Keep the task-sharing unit fixture isolated after proactive task wakes import the chat-first eligibility boundary.
left a comment
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d419adaf6f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fi | ||
|
|
||
| chat-first-e2e-fixture: | ||
| PYTHON="$(PYTHON)" bash scripts/dev-harness/chat-first-e2e-fixture.sh "$(CHAT_FIRST_E2E_ACTION)" "$(CHAT_FIRST_E2E_CASE)" "$(CHAT_FIRST_E2E_SECONDS)" |
There was a problem hiding this comment.
Expand the fixture interpreter through the shell
When the checkout path contains a shell-significant character such as " or $(), the resolved venv path is interpolated directly into the recipe despite PYTHON being exported specifically to avoid this. For example, a value containing "; ... terminates the assignment and changes the command, so make chat-first-e2e-fixture either fails or executes unintended shell text in exactly the linked-worktree scenario this Makefile change is meant to support. Use PYTHON="$$PYTHON" here, as the adjacent target does.
Useful? React with 👍 / 👎.
| @@ -2372,10 +2372,6 @@ workflows: | |||
| exit 1 | |||
| fi | |||
| cp -Rf .harness/agent-runtime/agent-node_modules "$APP_BUNDLE/Contents/Resources/agent/node_modules" | |||
There was a problem hiding this comment.
Restore the agent manifests to release bundles
Every Codemagic release now copies only agent/dist, package.json, and node_modules, so Contents/Resources/agent/src/runtime/omi-tool-manifest.ts is absent. The mandatory signed-artifact smoke explicitly rejects a bundle without that file in assert_helper_runtime_integrity, meaning every desktop candidate reaches the smoke step and fails before publication; restore the runtime-source copy here (and in the matching local bundler) or update the audit and its consumers together.
AGENTS.md reference: desktop/macos/AGENTS.md:L60-L65
Useful? React with 👍 / 👎.
| released = intent_db.release_due_deferrals( | ||
| uid, | ||
| account_generation=generation, | ||
| now=resolved_now, | ||
| subject=trigger.subject, | ||
| ) |
There was a problem hiding this comment.
Cancel deferrals when their subject is deleted
When a user has deferred a question about a task or goal and then deletes that entity, the delete routes invoke this wake with the deleted subject, and release_due_deferrals immediately turns the pending deferral back into a ready intent. Unlike agent-authored blocks, this proactive materialization path performs no entity-availability validation, so Chat re-raises the original question about an entity that no longer exists. Distinguish deletion from an ordinary subject update and retire the matching deferral instead of releasing it.
Useful? React with 👍 / 👎.
| guard task.source == "transcription:omi", | ||
| let conversationID = task.conversationId | ||
| else { return nil } |
There was a problem hiding this comment.
Match capture badges to persisted task provenance
For production tasks created from a finalized Omi conversation, the canonical candidate writer persists source as the candidate's source_surface, which conversation_capture sets to conversation; the legacy conversation writer also stores source: conversation. Therefore this transcription:omi predicate is satisfied only by the synthetic E2E fixture, and real capture-derived tasks never display their Capture badge. Persist an Omi-specific provenance value at the backend boundary or derive the badge from authoritative conversation provenance rather than the fixture-only string.
Useful? React with 👍 / 👎.
| let taskLinks = capture.structured.actionItems.compactMap(\.targetTaskID) | ||
| if taskLinks.isEmpty { | ||
| Text("No linked tasks or goals are available for this capture.") |
There was a problem hiding this comment.
Include newly created tasks in capture links
For the common candidate_action=create extraction path, target_task_id is intentionally omitted because there is no pre-existing target; after acceptance, the new task ID is stored on the candidate/task but is not written back into the conversation's structured action item. Consequently this projection finds only update/complete targets and reports “No linked tasks” for tasks actually created from the capture. Build the links from canonical task provenance or return accepted result task IDs in the capture-detail projection.
Useful? React with 👍 / 👎.
Summary
Verification
make preflightbash scripts/dev-harness/run-tests.sh(71 passed, 6 skipped)cd backend && .venv/bin/pytest tests/unit/test_chat_first_blocks.py tests/unit/test_workstream_router_contract.py -q(33 passed)cd desktop/macos/agent && npm run build && npm test -- --run tests/omi-tool-manifest.test.ts tests/chat-first-capability-projection.test.ts tests/surface-session.test.ts tests/conversation-journal.test.ts(99 passed)cd desktop/macos/Desktop && swift test --filter ChatFirstRichBlockTests(8 passed)python3 .github/scripts/test_pr_preflight.py(22 passed)Product invariants
INV-AGENT-*, INV-AUTH-1, INV-CHAT-1, INV-DATA-1, INV-BETA-1, INV-VOICE-1, INV-MEM-1, INV-MEM-3
Failure-Class: none