Skip to content

feat: proactivity v2 — retire legacy desktop proactivity, add a budgeted proactive ledger, mentor v2 and commitment follow-ups - #20494

Merged
Git-on-my-level merged 94 commits into
mainfrom
lane/proactivity-v2
Oct 4, 2026
Merged

Git-on-my-level merged 94 commits into
mainfrom
lane/proactivity-v2

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Retire the legacy desktop proactivity producers and ship one server-owned v2 system across mobile, macOS and Windows. Eligible paid users can receive conversation-mentor advice and commitment follow-ups; each item carries a canonical conversation/task target, durable exposure and outcome identity, and a hard per-user daily model budget. The rollout remains off until explicitly enabled.

Deletions and preserved behavior

Delete macOS/Windows Insight, context buckets/director/extraction/visit coordinator, JIT proactivity triggers/watchlists/triage/reservations/delivery, parked Interject, and their settings, flag reads, telemetry, gateway lanes/quotas and proactivity_daily catalog rows. Forward GRDB/SQLite migrations remove only retired tables; canonical mirrors and task subject bindings survive.

Released-client compatibility stays cheap: desktop completions return static 429 with Retry-After: 3600 / feature_retired; JIT reservation/feedback routes return static 410 and trigger snapshot returns its disabled empty shape. These retirement handlers perform no inference. Old Insight/Focus calls through the shared Gemini proxy remain an accepted residual.

Preserve Focus/SuggestionPacing (only JIT suppression/feedback dependency removed), canonical JIT rollout authority and mirrors, Jev-gated screen TASK extraction, MemoryAssistant, live notes, goals, home suggestions, dictation, embeddings/Rewind, daily recap and interesting-memory review. Shared Gemini accounting and #20184 lane attribution remain intact. Legacy mentor remains behind its explicit flip, including its existing push behavior.

V2 architecture and integration

  • One encrypted Firestore item ledger, authenticated feed/outcome API, generated Dart/Swift/TypeScript clients and canonical source-deletion hooks. Stable item/event identities fence retries and cross-device outcomes; timeout IDs are retained without receiving value credit.
  • One Budget Authority reserves before every gateway provider attempt and settles from immutable accounting. The daily cap is 10% of reference monthly plan price / 30; free/basic model work is zero. Unknown spend remains held, and provider/quality fallback cannot bypass admission.
  • Mentor v2 exclusively selects the reserved gate/draft/critic pipeline, Jev same-point dedupe, safety suppression and a numeric-only usefulness judge in shadow. Commitment follow-ups use one-shot due-revision Cloud Tasks, one Luna phrasing call, and feed-only publication. Server-observed replies/completions join the same outcomes.
  • Mobile For You cards and desktop floating/notch cards/shared toasts render typed targets. Durable owner-scoped receipt/outbox stores dedupe feed/push/relaunch, retry failures and purge at sign-out/switch. Shown requires actual render; opened requires accepted target navigation; explicit feedback/dismissal are recorded; timeout never counts.
  • V2 mentor pushes keep the released /chat/mentor route. Identity-only listen wakeups refresh the authenticated desktop feed; they never inject push copy into chat or count transport acceptance as exposure. Legacy mentor messages are not intercepted. The mobile For You header now aligns with Daily Recaps.
  • Integrated mobile f0ae51ca391e, and producers 505612e36372. The sole producer-merge conflict kept People-cache invalidation before source-linked feed cleanup in conversation deletion.

Flags and enablement prerequisites

All v2 rollout gates default off: absent/false PostHog proactivity_v2, MENTOR_PIPELINE=legacy, and empty commitment queue bindings. Registry rows are gated registrations, not live rollout. Once v2 is explicitly enabled, the usefulness judge defaults to shadow (not enforce), its historical prefilter stays disabled, and follow-up push stays unearned.

The authoritative checklist is Enablement prerequisites: five customer-data Firestore serving/cohort/history indexes must be READY; enable expires_at TTL on proactivity_items and proactivity_budget_days; provision the one-shot Cloud Tasks queue, exact callback URL/audience, OIDC invoker and enqueue/act-as permissions; bind project/location/queue/URL/invoker on all task hosts. Backend/listen/pusher and gateway need consistent customer-data, Redis and PostHog routing; gateway additionally needs accounting enabled. Use MENTOR_PIPELINE=cohort consistently on mentor execution hosts and the gateway for per-user rollout; only flagged users select v2, and everyone else selects legacy. Create PostHog proactivity_v2 disabled/zero-percent before cohort rollout. This PR performs no flag creation, provisioning, deployment or production-data access.

Coordinator gates remain: #20184's attribution baseline, quality/safety ratification and native client acceptance before enablement. Hermetic tests do not establish notification usefulness.

Rollback

Disable proactivity_v2 to stop new v2 generation/push and suppress in-flight v2 publication; outstanding attempts retain holds and settle normally. Existing outcomes remain accepted. In cohort mode the next evaluation selects legacy for a false/unknown flag; selection never falls back after a v2 attempt. Set MENTOR_PIPELINE=legacy consistently on every execution host and gateway to restore legacy for everyone. Preserve ledgers, attempt IDs and budgets through retention, with no refunds or history rewrite. Forward local table deletions are not reversed by a flag: the retired desktop features cannot be re-enabled without a separate compatible release.

Product invariants

Affected product/invariants/: INV-CUTOVER-1, INV-AGENT-*, INV-AUTH-1, INV-CHAT-1, INV-DATA-1, INV-VOICE-1, INV-MEM-4, INV-MEM-1, INV-MEM-5, INV-UI-1, INV-UI-2, INV-UI-3. Budget and owner boundaries fail closed; feed items are derived advice, not alternate memory/task mutation authority. Existing capture, canonical task/memory, chat and voice behavior remain intact.

Failure-Class: none

This is the integrated feature replacement; integration fixes complete its producer/consumer contracts, not a new incident-class exception.

Final review fixes

  • P1 accounting: v2 provider adapters carry raw receipt completeness. Settlement requires both billable components, non-negative integer counts, valid cache/reasoning subsets and consistent reported totals. Invalid/incomplete usage records unknown cost, keeps the full hold and rejects publication. Legacy accounting normalization is unchanged. Executor regressions cover total-only/missing/malformed/negative/fractional/inconsistent usage and valid zero counts.
  • P2 mentor delivery: after chat persistence returns, record its message ID and timestamp on the item. Chat-write failure records failed chat state and skips push while leaving the feed available. Thread replies require that persisted association or independent exposure; feed availability and push acceptance alone cannot earn delivery/action credit. Regression covers successful publication, failed chat persistence, and a later unrelated reply; persisted-chat replies still work when push is denied.
  • P2 follow-up retries: pre-claim infrastructure failures return HTTP 503. A deterministic callback retries an active claim; after five minutes only a claim with no durable attempt may resume with a new token. Abandoned claims with any attempt reconcile to failed with all money retained and no provider redispatch. Real HTTP/ledger/executor tests verify recovery and no duplicate spend.
  • Cohort rollout blocker: MENTOR_PIPELINE=cohort uses the server admission flag resolver/client/cache per user. True selects v2; false/unknown/error selects unchanged legacy. Selection is exclusive and identical on mentor hosts and gateway admission. Default remains legacy. Contract enablement prerequisites, producers, registry and runtime validator include cohort; flagged/unflagged/unknown/error users are tested on both sides.

Fix-round validation: after merging main at 6eb534630f, backend/test.sh passed 939 tests across 22 affected/overlapping files, including all 520 original fix-round regressions, the real HTTP callback with the strict ledger and budget executor, and Gemini attribution. Windows node/renderer typecheck and 64 tests across 10 files passed. xcrun swift build --build-tests --jobs 2 compiled all test targets and 44 focused Swift tests passed. Heavy commands started with one-minute load <=30; a transient earlier duration-guard failure was rerun at low load without threshold changes. make preflight passed 81 checks on the merged head (522.18s). The normal pre-push hook passed at published head b017771c88fdb8f0a8004b09af30a503c2c974fd: all 81 checks (628.47s), backend typecheck (zero errors), 39 selected backend files, OpenAPI, Flutter generation/localization, Swift and desktop tools. Backend test concurrency was reduced to two workers after a load-sensitive duration guard; no checks, thresholds or allowlists were skipped or relaxed. git ls-remote and the PR head confirm the exact published SHA; the PR remains open and draft. No PR merge or deployment is performed.

Earlier integration verification

  • All three OpenAPI surfaces, all Dart, Swift, Windows/TypeScript, plan catalog, feature-flag registry and Firestore index generators: replay produced no drift.
  • Backend full backend/test.sh: all 1,543 selected files exercised. The retired-JIT fixture dependency was corrected and its four tests passed; 63 files hit duration guards during host-load spikes. Serial and individually gated reruns cleared all failures. Two persistent test-setup costs were corrected: stub the summary fixture's adjacent-conversation lookup and collect the memory wrapper import before the timed call; those unchanged behavioral assertions passed all 17 tests. No duration threshold or allowlist was changed. Focused cross-branch contracts/listen: 93 passed.
  • Swift xcrun swift build --build-tests --jobs 2: passed after restoring missing worktree-local XCFramework artifacts. Focused consumer, adapter, owner, notification, pacing and KEEP suites: 89 passed.
  • Windows node/renderer typecheck passed; full Vitest: 5,549 passed, 33 skipped across 548 passing files (6 skipped). Focused feed/adapter/listen: 15 passed.
  • app/test.sh: protected spine 138 passed; full general suite 4,311 passed, 5 skipped, with one merged capture-fixture compile error. Corrected the fake's typed People response and reran through app/test.sh: spine 138 plus capture 2 passed. Producer/push parity and header geometry passed. Synthetic production-Home visual capture passed and was inspected: aligned headers and both producer cards, with no clipping.
  • make preflight: 81 checks passed (619.92s). The normal pre-push hook passed all 81 contracts again at published head 2d456e53b45f (471.57s), backend typecheck (zero errors), 38 selected backend files, OpenAPI, Flutter build_runner/localization generation, Swift and desktop tool gates. Line-count ratchet passed with the declarations below.

Every heavy command started with 1-minute load <=30. Full backend/app runs started at 6.77/10.08; Windows full/typecheck at 28.68/29.04; Swift build/focused at 24.28/13.90; final preflight at 4.42. Later load spikes reached ~190. Timing failures were rerun at lower load, with a stricter <=15 gate for the last individual files. Test-only fixture corrections cover People responses, manual-speaker lookup, summary adjacency isolation and memory module setup; production behavior is unchanged. The frozen historical JIT prompt checksum remains pinned after removal of its live Swift-source dependency.

The earlier integration validation above was recorded at 2d456e53b45f. This fix round merges main through 6eb534630f, regenerates the five conflicted Swift/TypeScript clients from the combined schema, and preserves #20184 Gemini attribution on all surviving producers while keeping Insight retired. Full evidence and the synthetic capture are in the coordinator's run directory (integration-verification.md, integration-home-render/). No hosted CI, installed-device/native Windows delivery or deployment is claimed by local checks.

Line-Count-Exception: backend/database/action_items.py | 1600 -> 1633 | Shared canonical task mutations observe v2 completion and source deletion adjacent to the persisted mutation
Line-Count-Exception: backend/database/chat.py | 1507 -> 1524 | Existing mentor chat writes retain internal item mapping and server-observed reply outcomes
Line-Count-Exception: backend/database/conversations.py | 3487 -> 3490 | Source deletion clears derived feed content after invalidating People stats
Line-Count-Exception: backend/database/firestore_index_registry.py | 2121 -> 2160 | Register five spine and producer serving queries in the existing authoritative index registry
Line-Count-Exception: desktop/macos/Desktop/Sources/Rewind/Core/RewindDatabase.swift | 3585 -> 3586 | Register one forward retirement migration implemented in its dedicated module
Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 2850 -> 2855 | Existing analytics authority emits bounded outcome action, channel and surface

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Git-on-my-level
Git-on-my-level merged commit d04010d into main Oct 4, 2026
63 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/proactivity-v2 branch October 4, 2026 01:59
chicoenmascarado added a commit to chicoenmascarado/omi that referenced this pull request Oct 4, 2026
The Insight assistant was retired in BasedHardware#20494; the remaining callers are tasks, memories, goals and focus.
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Oct 5, 2026
Port the snooze and presence gates onto proactivity v2 (BasedHardware#20494):
- NotificationService: keep the snooze/presence gate in sendNotification,
  which the v2 ProactivityNotificationAdapter now calls, and take main's
  removal of the retired JIT detail-card and context-director paths.
- Keep main's owner guard in recordPresentation and route onPresented only
  through the presentation receipt so it fires once.
- FloatingControlBarManager.presentNotification: keep the proactive
  snooze/presence recheck and notch-only speech policy; drop the retired JIT
  generation guard and interject grace.
- Drop retired Insight delivery telemetry from the suppression paths and the
  two tests that only asserted its enum strings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wizard815 pushed a commit to Wizard815/omi-local that referenced this pull request Nov 25, 2026
scripts/failure-class fails closed when a changed definition has a
scope_hint matching no tracked file. The upstream sync adds every
upstream definition at once, so it trips on four hints whose files
upstream itself has since removed:
- desktop/windows/src/main/jit/** (BasedHardware#20494, BasedHardware#22209), in
  FC-client-rederives-authority-verdict and FC-sync-gated-on-consumer-trigger;
- backend/utils/free_tier_cohort.py (BasedHardware#22238) and free_tier_memory_policy.py
  (BasedHardware#22209), in FC-cohort-gate-consulted-without-its-subject;
- backend/utils/task_intelligence/rollout.py (BasedHardware#18722), in
  FC-gate-principal-outside-consolidated-entitlement.

Each definition keeps its remaining, live hints.

Verification: scripts/pr-preflight --suggest reported exactly these four
scope_hint_matches_nothing errors before; git cat-file confirms none of
the paths exist on upstream/main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0148HLrpWR8Mimn43rkNvGKg

This branch was successfully deployed

1 active deployment
staging - docs — 40826669 Deployed Oct 4, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant