Skip to content

Update README.md - #11

Merged
akshaynarisetti merged 1 commit into
mainfrom
Bentlybro-patch-1
Mar 29, 2024
Merged

akshaynarisetti merged 1 commit into
mainfrom
Bentlybro-patch-1

Conversation

@Bentlybro

@Bentlybro Bentlybro commented Mar 29, 2024 •

Copy link
Copy Markdown
Contributor

image

@akshaynarisetti akshaynarisetti left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much clearer now, thanks!

@akshaynarisetti
akshaynarisetti merged commit 6e3fd36 into main Mar 29, 2024
mdmohsin7 added a commit that referenced this pull request Oct 18, 2025
closes #3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
@ellaaicare

Copy link
Copy Markdown

iOS Investigation - Root Cause Analysis

After investigating the iOS codebase and backend integration:

iOS Side (Not the issue)

  • getConversations() in lib/backend/http/api/conversations.dart does NOT filter by source
  • Queries /v1/conversations?include_discarded=true&limit=50&offset=0&statuses=processing,completed
  • Uses ServerConversation.fromJson() which should handle any valid conversation

Backend Side (Likely issue)

The V2 pipeline stores conversations via FirestoreClient.store_voice_conversation() which writes directly to Firestore:

# Path: users/{uid}/conversations/{session_id}
conversation_data = {
    'id': session_id,
    'uid': uid,
    'created_at': datetime.utcnow(),  # ⚠️ Using naive datetime
    'transcript': transcript,
    'transcript_segments': segments,
    'source': source,
    'status': 'completed',
    'discarded': False,
    'is_voice_conversation': True,
    'turn_count': len(segments),
}

Potential Issues Found:

  1. Timezone-naive datetimes: V2 uses datetime.utcnow() which creates timezone-naive datetimes. The get_conversations() query may fail with created_at comparisons. Should use datetime.now(timezone.utc).

  2. Missing required fields: The normal conversation flow uses upsert_conversation() which includes many more fields:

    • language
    • structured (with title, overview, emoji, category, etc.)
    • started_at / finished_at
    • plugins_results
    • geolocation
  3. No encryption: Normal conversations use _prepare_conversation_for_write() which handles encryption. V2 bypasses this.

  4. Firestore composite index: The query uses (discarded, status, created_at DESC) - if V2 conversations have incompatible field types, they may be silently excluded.

Recommended Backend Fix:

V2 should use the same upsert_conversation() function from database/conversations.py instead of direct Firestore writes. This ensures consistent field structure, encryption, and indexing.

Quick Test:

Check if the V2 conversations appear with this query (bypasses REST API):

# In Firebase console, query:
# users/{uid}/conversations where source == 'voice_mode_v2_manual'

If they exist there but not via API, it's a query/field mismatch issue.

This is a backend issue, not iOS.

m13v pushed a commit that referenced this pull request Feb 26, 2026
…symlink)

## Root Cause

After `xcrun swift build --arch arm64`, `Desktop/.build/release/Omi Computer`
does NOT exist (the `release/` symlink is not updated). The `cp` fails silently,
leaving `/tmp/OmiComputer-arm64` empty. The echo showed a false-positive
`arm64 binary: arm64` because `file /tmp/OmiComputer-arm64` (non-existent)
outputs the filepath which contains "arm64", and grep -oE matched it.

## Fix

Use explicit arch-specific output paths throughout:
- arm64: `Desktop/.build/arm64-apple-macosx/release/$BINARY_NAME`
- x86_64: `Desktop/.build/x86_64-apple-macosx/release/$BINARY_NAME`
- Sparkle: x86_64 arch path, fallback to arm64
- SWIFT_BUILD_DIR: x86_64 arch path, fallback to arm64

The `release/` symlink is never used. Both arch dirs exist after build #11
confirmed that --arch x86_64 (run after arm64) creates x86_64-apple-macosx/.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
m13v pushed a commit that referenced this pull request Feb 26, 2026
…symlink)

## Root Cause

After `xcrun swift build --arch arm64`, `Desktop/.build/release/Omi Computer`
does NOT exist (the `release/` symlink is not updated). The `cp` fails silently,
leaving `/tmp/OmiComputer-arm64` empty. The echo showed a false-positive
`arm64 binary: arm64` because `file /tmp/OmiComputer-arm64` (non-existent)
outputs the filepath which contains "arm64", and grep -oE matched it.

## Fix

Use explicit arch-specific output paths throughout:
- arm64: `Desktop/.build/arm64-apple-macosx/release/$BINARY_NAME`
- x86_64: `Desktop/.build/x86_64-apple-macosx/release/$BINARY_NAME`
- Sparkle: x86_64 arch path, fallback to arm64
- SWIFT_BUILD_DIR: x86_64 arch path, fallback to arm64

The `release/` symlink is never used. Both arch dirs exist after build #11
confirmed that --arch x86_64 (run after arm64) creates x86_64-apple-macosx/.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
m13v added a commit that referenced this pull request Feb 26, 2026
…symlink) (#5165)

## Root Cause

After `xcrun swift build --arch arm64`, `Desktop/.build/release/Omi
Computer` does NOT exist (the `release/` symlink is not updated by
`--arch` on Codemagic M2). The `cp` failed silently. The echo showed a
**false-positive** `arm64 binary: arm64` because `file
/tmp/OmiComputer-arm64` (non-existent file) outputs the filepath which
contains "arm64", and `grep -oE` matched it.

Build log evidence (build `69a065cb5f240a649219ee41`):
- Line 200: `cp: Desktop/.build/release/Omi Computer: No such file or
directory`
- Line 201: `arm64 binary: arm64` ← false positive from filename match,
not real binary

## Fix

Use explicit arch-specific output paths throughout (never use `release/`
symlink):
- arm64 binary: `Desktop/.build/arm64-apple-macosx/release/$BINARY_NAME`
- x86_64 binary:
`Desktop/.build/x86_64-apple-macosx/release/$BINARY_NAME`
- Sparkle: x86_64 arch path, fallback to arm64
- SWIFT_BUILD_DIR: x86_64 arch path, fallback to arm64

Both arch dirs confirmed to exist in build #11 (x86_64-apple-macosx/
created when --arch x86_64 runs after arm64).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
m13v added a commit that referenced this pull request Feb 26, 2026
## Problem

Build #12 failed at \"Build Swift app (arm64 + x86_64)\" on a fresh
Codemagic Mac mini M2:

```
ERROR: arm64 binary not found at Desktop/.build/arm64-apple-macosx/release/Omi Computer
artifacts
checkouts
repositories
workspace-state.json
```

Root cause: SPM needs to download ~673MB of binary artifacts (Firebase,
Sentry, Sparkle xcframeworks) on a fresh machine. When `xcrun swift
build --arch arm64` runs, it tries to download everything **and
compile** in a single step. The download failed/aborted mid-way (375MB
of 673MB downloaded), leaving no `arm64-apple-macosx/` directory — so
compilation never started. Without `set -e`, the script continued to the
binary existence check and exited with 1.

Build #11 succeeded only because that machine had a warm SPM cache from
previous builds.

## Fix

1. **New \"Resolve SPM packages\" step** — runs `xcrun swift package
resolve` before building, with a 3-attempt retry loop. This
pre-downloads all binary artifacts. If the first attempt fails partway,
the second attempt resumes from where it left off (SPM checkpoints
downloads).

2. **`--triple` instead of `--arch`** — switches from `xcrun swift build
--arch arm64` to `--triple arm64-apple-macosx`. This matches the local
`release.sh` behavior and ensures the output binary **always** lands in
`.build/arm64-apple-macosx/release/` regardless of the machine's native
architecture (on native M2, `--arch arm64` may use the `release/`
symlink path).

3. **SPM cache** — adds `~/Library/Caches/org.swift.swiftpm` to
Codemagic's build cache so binary xcframeworks are not re-downloaded on
every subsequent build.

## Result

- Fresh machine: resolve step downloads packages with retry, then both
builds compile using already-cached artifacts
- Warm machine: resolve is instant (already cached), builds proceed
normally

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
closes BasedHardware#3241

before:


https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44

logs:

```
flutter: ----------------FIREBASE CRASHLYTICS----------------
flutter: Bad state: No element
flutter: 
#0      ListBase.firstWhere (dart:collection/list.dart:132:5)
#1      SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22)
BasedHardware#2      _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13)
BasedHardware#3      _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48)
BasedHardware#4      _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27)
BasedHardware#5      _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21)
BasedHardware#6      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24)
BasedHardware#7      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11)
BasedHardware#8      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5)
BasedHardware#9      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7)
BasedHardware#10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27)
BasedHardware#11
```

after:


https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df

<img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15
52 PM"
src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3"
/>
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…symlink)

## Root Cause

After `xcrun swift build --arch arm64`, `Desktop/.build/release/Omi Computer`
does NOT exist (the `release/` symlink is not updated). The `cp` fails silently,
leaving `/tmp/OmiComputer-arm64` empty. The echo showed a false-positive
`arm64 binary: arm64` because `file /tmp/OmiComputer-arm64` (non-existent)
outputs the filepath which contains "arm64", and grep -oE matched it.

## Fix

Use explicit arch-specific output paths throughout:
- arm64: `Desktop/.build/arm64-apple-macosx/release/$BINARY_NAME`
- x86_64: `Desktop/.build/x86_64-apple-macosx/release/$BINARY_NAME`
- Sparkle: x86_64 arch path, fallback to arm64
- SWIFT_BUILD_DIR: x86_64 arch path, fallback to arm64

The `release/` symlink is never used. Both arch dirs exist after build BasedHardware#11
confirmed that --arch x86_64 (run after arm64) creates x86_64-apple-macosx/.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…symlink) (BasedHardware#5165)

## Root Cause

After `xcrun swift build --arch arm64`, `Desktop/.build/release/Omi
Computer` does NOT exist (the `release/` symlink is not updated by
`--arch` on Codemagic M2). The `cp` failed silently. The echo showed a
**false-positive** `arm64 binary: arm64` because `file
/tmp/OmiComputer-arm64` (non-existent file) outputs the filepath which
contains "arm64", and `grep -oE` matched it.

Build log evidence (build `69a065cb5f240a649219ee41`):
- Line 200: `cp: Desktop/.build/release/Omi Computer: No such file or
directory`
- Line 201: `arm64 binary: arm64` ← false positive from filename match,
not real binary

## Fix

Use explicit arch-specific output paths throughout (never use `release/`
symlink):
- arm64 binary: `Desktop/.build/arm64-apple-macosx/release/$BINARY_NAME`
- x86_64 binary:
`Desktop/.build/x86_64-apple-macosx/release/$BINARY_NAME`
- Sparkle: x86_64 arch path, fallback to arm64
- SWIFT_BUILD_DIR: x86_64 arch path, fallback to arm64

Both arch dirs confirmed to exist in build BasedHardware#11 (x86_64-apple-macosx/
created when --arch x86_64 runs after arm64).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
…Hardware#5166)

## Problem

Build BasedHardware#12 failed at \"Build Swift app (arm64 + x86_64)\" on a fresh
Codemagic Mac mini M2:

```
ERROR: arm64 binary not found at Desktop/.build/arm64-apple-macosx/release/Omi Computer
artifacts
checkouts
repositories
workspace-state.json
```

Root cause: SPM needs to download ~673MB of binary artifacts (Firebase,
Sentry, Sparkle xcframeworks) on a fresh machine. When `xcrun swift
build --arch arm64` runs, it tries to download everything **and
compile** in a single step. The download failed/aborted mid-way (375MB
of 673MB downloaded), leaving no `arm64-apple-macosx/` directory — so
compilation never started. Without `set -e`, the script continued to the
binary existence check and exited with 1.

Build BasedHardware#11 succeeded only because that machine had a warm SPM cache from
previous builds.

## Fix

1. **New \"Resolve SPM packages\" step** — runs `xcrun swift package
resolve` before building, with a 3-attempt retry loop. This
pre-downloads all binary artifacts. If the first attempt fails partway,
the second attempt resumes from where it left off (SPM checkpoints
downloads).

2. **`--triple` instead of `--arch`** — switches from `xcrun swift build
--arch arm64` to `--triple arm64-apple-macosx`. This matches the local
`release.sh` behavior and ensures the output binary **always** lands in
`.build/arm64-apple-macosx/release/` regardless of the machine's native
architecture (on native M2, `--arch arm64` may use the `release/`
symlink path).

3. **SPM cache** — adds `~/Library/Caches/org.swift.swiftpm` to
Codemagic's build cache so binary xcframeworks are not re-downloaded on
every subsequent build.

## Result

- Fresh machine: resolve step downloads packages with retry, then both
builds compile using already-cached artifacts
- Warm machine: resolve is instant (already cached), builds proceed
normally

🤖 Generated with [Claude Code](https://claude.com/claude-code)
mdmohsin7 added a commit that referenced this pull request Jun 27, 2026
Git-on-my-level added a commit that referenced this pull request Jul 9, 2026
P1 fixes:
- ChatProvider: resume suspended waiter continuation inside the task
  group body on timeout, preventing withTaskGroup hang (#1).
- AgentRuntimeProcess: route stale-alive latch through handleTermination
  so in-flight continuations are resumed and the old terminationHandler
  is properly superseded (#2).
- WALService: startRecording no longer discards retained frames when the
  best-effort retry fails — preserves audio for next flush (#14).

P2 fixes:
- WALService: remove duplicate wal_write_failed health event recording
  in createWalFromCurrentFrames; writeFramesToDiskAndWait already
  records it (#3).
- BleAudioService: reset isDecodeDegraded on successful decode so the
  flag reflects current processor state instead of staying sticky (#5).
- TranscriptionRetryService: record db-backoff pause via
  DesktopDiagnosticsManager.recordFallback for observability (#7).
- APIClient: derive auth retry outcome from response status code instead
  of assuming success before callers validate 2xx (#9).
- APIClientAuthRetryTests: clean up UserDefaults authUserId in tearDown
  to prevent state leak (#8).
- ChatBridgeModeSwitchTimeoutTests: remove meaningless defer { assertion
  that passes regardless of mode-switch cleanup (#10).
- TranscriptionRetryResilienceTests: check busy-error guard by semantic
  elements instead of exact formatting (#11); remove fragile negative
  assertion (#12).
- capture-lifecycle.yaml: remove 5 files from covers: that the hermetic
  seam does not exercise at runtime (#13).

Verification:
- xcrun swiftc -parse on all 8 changed Swift files: clean
- git diff --check: no whitespace errors
- check-desktop-changelog.py: fragment found
- check-e2e-flow-coverage.py --strict: passes (exit 0)

Co-authored-by: Cursor <[email protected]>
kodjima33 pushed a commit that referenced this pull request Jul 15, 2026
…bounded (#9795)

database.mem_db.proactive_noti_sent_at maps "<uid>:<app_id>" -> (sent_ts, expiry_ts). An expired
entry is deleted only when its own key is read again in get_proactive_noti_sent_at, so keys for
churned users or uninstalled apps are never revisited and accumulate for the whole process lifetime.
The repo's own guidance requires module-level dicts to add a TTL or size cap (backend gotcha #11).

set_proactive_noti_sent_at now sweeps already-expired entries (which get() already treats as gone)
and, if still over _MAX_PROACTIVE_NOTI_ENTRIES, drops the entries nearest to expiry, so the map stays
bounded. The sweep runs only when the map exceeds the cap, so the common path is unchanged.

tests/unit/test_mem_db_proactive_noti_cap.py: expired entries are swept when over the cap, the cap
holds even when all entries are live, and get still returns a live value and None for an expired one.
aryanorastar pushed a commit to aryanorastar/omi that referenced this pull request Jul 22, 2026
…time

feat(windows): Phase 6 — realtime voice (speak to Omi, hear Omi)
abunet pushed a commit to abunet/omi that referenced this pull request Aug 6, 2026
abunet added a commit to abunet/omi that referenced this pull request Aug 14, 2026
…oses 4 cursor P1s (cubic 10887 BasedHardware#2/BasedHardware#3/BasedHardware#5/BasedHardware#11)

`__name__` is Firestore's document-name token; the neutral store forwarded it as an ordinary payload
field, so the Mongo adapter prefixed it to `d.__name__` (which never exists — the document name lives in
`_id`, the full logical path). Four production-reachable P1s shared this one root cause on the Mongo
on-prem path:

- BasedHardware#2 canonical maintenance cron `collection_group(...).order_by("__name__").start_after(cursor)` raised
  NotImplementedError on resume -> the seed pass was stuck at page 1.
- BasedHardware#3 `where("__name__", ">=", cutoff)` (monthly chat usage) matched a nonexistent `d.__name__` -> empty
  result -> usage undercounted.
- BasedHardware#5/BasedHardware#11 `order_by("__name__")` + cursor keyed/sorted on `d.__name__` -> page 2+ empty for the
  staged-task and review-queue legacy scans.

Central fix in the adapters (Firestore itself handles __name__ natively):
- Mongo `query`: a sole `__name__` order (or no order) keys purely by `_id` honoring direction; the sort
  maps `__name__`->`_id`. Mongo `_filter`/`query_group` filters map `__name__`-> full-path `_id`.
- Mongo/Firestore `query_group`: a `__name__` order is the implicit document-name keyset — strip it so it
  doesn't conflict with start_after.
- Firestore adapter: `__name__` filter value -> a DocumentReference (Firestore's contract).
- Facade `_GroupQuery.order_by("__name__")`: no-op (the canonical-cron path).

Verify (rule 12, live dual-backend fresh): contract 102 passed (+6: __name__ filter, sole-__name__
pagination, group __name__ cursor — each x2 backends). Facade hermetic 18 (the cron no-op). Guard 0;
store/facade sweep 0 regressions.
Git-on-my-level added a commit that referenced this pull request Aug 15, 2026
…indings

Five of the six PR review comments were valid. Four cost nothing: measured on
the same 134 contexts, precision and recall are identical before and after
(nano 74%/31%, reasoning lane 89%/52%).

A bare domain is now rejected. `github.com` with no section satisfied every
other guard and would have collapsed every repository into one bucket; the
prompt always asks for `<domain>/<section>`, so that contract is enforced.

Forbidden labels are checked in every position rather than only the first.
`google-chrome/tabs` hides the browser name in its second label and passed
whenever the title happened to ground it -- the existing test read as covering
this but only passed because its title grounded nothing.

A domain of nothing but generic parts is rejected, so `com/feed` can no longer
become a shared key for every site with "feed" in its title.

A generic section word can no longer stand in for domain evidence. Otherwise
`x.com/feed` grounds on any page mentioning a feed. The section fallback itself
is kept deliberately: browser titles truncate from the left, so
`fix: thing #11 · acme/omi` never contains "github", and requiring domain
evidence outright -- the literal suggestion in review -- regressed repository
grouping by 5 points of recall while removing zero false merges. Blocking only
the generic words closes the hole at no measured cost.

`legacy_explicit_open` is protected alongside `explicit_open`. The one-time
UserDefaults import records a user's own prior binding under that source, and a
derived key must not overwrite it.

The `Window:` prompt line is now flattened. It carries the raw page-controlled
title, so a newline could append text reading as prompt structure even though it
sits below the untrusted preamble. This one predates the feature, but routing
turns extraction output into an identity decision, which raises what it is worth.

132 tests pass, 29 in this file.

Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Aug 15, 2026
…ucket (#11592)

* feat(desktop): group browser tabs of one site into a shared context bucket

Bucket identity is sha256(app::normalized window title), so every distinct tab
title becomes its own bucket. On a real beta profile that produced 83 buckets
from 742 visits, 50 of them Chrome, with X alone split ten ways and four
separate buckets for PRs in one repository. 74 of the 83 never produced a
single notification.

Two changes.

The normalizer now strips a *leading* unread badge. The existing count regexes
were `$`-anchored, so `(4) Home / X` and `Home / X` hashed apart; the trailing
form stays messaging-app-only because `Issue (123)` there is genuine identity.
It also matches Slack's web title, which reads "1 new item" rather than
"1 new message" and so never matched the shipped pattern.

Beyond that, browser contexts get a destination key -- `x.com/feed`,
`github.com/acme/repo` -- proposed by the extraction call that already runs,
then cached on the reference hash in `subject_bindings`. Several hashes can
then share one bucket. The model is consulted once per novel title and never
again, so identity stays stable and replayable; nothing is asked of it on the
hot path.

Measured over 134 real contexts against a fixed a-priori label set:

  routing over candidate buckets, all apps    38% precision / 18% recall
  destination key, all apps                    6% / 35%
  destination key, browser-scoped             61% / 33%
  ... plus deterministic site hint            76% / 34%
  ... on the reasoning lane's model           85% / 54%
  ... plus the grounding guard                89% / 54%

Three findings drove the shape. Emitting a canonical key beat matching against
candidate buckets (76% vs 53%), and is order-independent, so the result cannot
depend on which buckets happened to be recent. Scoping to browsers is what made
it viable at all: unscoped, the model answers `telegram` for every thread and
collapses unrelated private conversations, which is 6% precision and by far the
worst outcome available. And a deterministic site hint was worth +15 points
where feeding richer accumulated context was worth +2 -- the model was short of
identity signal, not context.

Failing closed always means keeping the existing per-title identity, so the
error is a surplus bucket rather than a polluted fact set. Explicit bindings
outrank derived ones, an applied destination is never re-adjudicated, entries
already written are never re-parented, and the routing rules sit below
`untrustedPreamble` because window titles are attacker-controlled. Forward-only:
existing buckets are untouched and no history is rewritten.

Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(desktop): close over-merge holes found reviewing destination routing

An adversarial review of the previous commit found four ways two unrelated
contexts could still land in one bucket.

The grounding guard was the serious one. Domain labels were substring-matched
with no length floor, so `x.com` reduced to "x" and grounded against any title
containing that letter: `fix: thing #11 · acme/omi` accepted `x.com/feed`, and
because an applied destination is never re-adjudicated, one bad extraction
parked a GitHub tab in the X bucket permanently. Short labels now have to match
a whole title token; only labels of four or more characters may substring-match.
A plain length floor was the earlier attempt and was wrong in the other
direction -- it dropped `x.com` entirely and made X, the most fragmented site in
the sample, ineligible to merge.

Forbidden domains were compared against the whole domain string, so
`chrome.com/tabs` passed where `chrome/tabs` was rejected; now checked per
label. Web messengers were reachable through the browser path, where a title
like `general | acme | Slack` grounded `slack.com/acme` and merged distinct
private threads -- the exact failure browser scoping exists to prevent -- so
messenger hosts and messenger-looking titles are excluded outright. And
`isBrowser` matched substrings, which made `Ledger Live` and `Archive Utility`
browsers; it is now an exact application-name set.

Two more, also from review. The join path never touched the destination
bucket's `lastVisitedAt` or `visitCount`: `finalizeVisit` credits the per-title
bucket and `context_visits.bucketID` keeps pointing there, so stale GC and
overflow GC would both prefer deleting the destination over the orphans feeding
it -- worst for the visit-once titles this feature exists to join. And
`promptFragment` interpolated the raw title into its rule text, so a newline in
an attacker-controlled title could forge rule structure while still sitting
below the untrusted preamble.

Tightening costs 2 points of recall on the measured set (89%/54% -> 89%/52% on
the reasoning lane) and closes failure classes that sample never exercised.

126 tests pass, 23 new.

Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(desktop): harden destination grounding against automated review findings

Five of the six PR review comments were valid. Four cost nothing: measured on
the same 134 contexts, precision and recall are identical before and after
(nano 74%/31%, reasoning lane 89%/52%).

A bare domain is now rejected. `github.com` with no section satisfied every
other guard and would have collapsed every repository into one bucket; the
prompt always asks for `<domain>/<section>`, so that contract is enforced.

Forbidden labels are checked in every position rather than only the first.
`google-chrome/tabs` hides the browser name in its second label and passed
whenever the title happened to ground it -- the existing test read as covering
this but only passed because its title grounded nothing.

A domain of nothing but generic parts is rejected, so `com/feed` can no longer
become a shared key for every site with "feed" in its title.

A generic section word can no longer stand in for domain evidence. Otherwise
`x.com/feed` grounds on any page mentioning a feed. The section fallback itself
is kept deliberately: browser titles truncate from the left, so
`fix: thing #11 · acme/omi` never contains "github", and requiring domain
evidence outright -- the literal suggestion in review -- regressed repository
grouping by 5 points of recall while removing zero false merges. Blocking only
the generic words closes the hole at no measured cost.

`legacy_explicit_open` is protected alongside `explicit_open`. The one-time
UserDefaults import records a user's own prior binding under that source, and a
derived key must not overwrite it.

The `Window:` prompt line is now flattened. It carries the raw page-controlled
title, so a newline could append text reading as prompt structure even though it
sits below the untrusted preamble. This one predates the feature, but routing
turns extraction output into an identity decision, which raises what it is worth.

132 tests pass, 29 in this file.

Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
@undivisible
undivisible deleted the Bentlybro-patch-1 branch August 20, 2026 11:30
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.

3 participants