Repository navigation
feat: add verbatim transcript chunks as third context-director retrieval source - #11613
Conversation
There was a problem hiding this comment.
3 issues found across 8 files
Confidence score: 3/5
- In
desktop/macos/Desktop/Sources/Services/APIClient/APIClient+Tools.swift, the new/v1/tools/conversations/search-chunkscall is ahead of the app-client OpenAPI contract, which is already causing the desktop REST inventory test to fail and risks client/server drift for this endpoint — add the matching backendToolResponseroute to the app-client API reference so generated/validated clients stay in sync. - In
backend/tests/unit/test_tools_router.py, the “best-scored chunk first” assertion is effectively unverified because bothconv-afixtures are hydrated with indistinguishable content, so ordering/selection regressions could slip through unnoticed — make the chunk rows uniquely identifiable so the test can actually detect ranking behavior. - In
desktop/macos/changelog/unreleased/20260815-director-verbatim-transcript-retrieval.json, implementation-heavy wording can blur the user-facing change and lead to release-note confusion — rewrite the entry to focus only on observable user impact.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_tools_router.py">
<violation number="1" location="backend/tests/unit/test_tools_router.py:1186">
P3: The test comment claims "best-scored chunk first," but the test can't detect the chunk-selection behavior. Both conv-a rows are hydrated with identical fields (`text='User: verbatim evidence'`, `conversation_title='Standup'` via `_hydrate_with`), so the assertion `response.sources[0]` reflects only that the first conv-a row (score 0.91) was picked because of input order — it would equally pass if the 0.88 row were selected. To make the dedupe/preference contract real, give the two conv-a chunks distinct identifiable content (e.g. distinct text or title) and assert the chosen one has the higher score.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/Services/APIClient/APIClient+Tools.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/Services/APIClient/APIClient+Tools.swift:202">
P2: This route makes the desktop REST inventory test fail because the app-client OpenAPI contract does not contain `/v1/tools/conversations/search-chunks`. Add the backend `ToolResponse` route to `docs/api-reference/app-client-openapi.json` and regenerate the contract before shipping.</violation>
</file>
<file name="desktop/macos/changelog/unreleased/20260815-director-verbatim-transcript-retrieval.json">
<violation number="1" location="desktop/macos/changelog/unreleased/20260815-director-verbatim-transcript-retrieval.json:2">
P3: The changelog entry leads with a user-visible outcome but then explains the implementation ("context director's lookup", "verbatim transcript excerpts", "conversation summaries"). Reword to the user-visible effect only, e.g. proactive notifications can now cite exact, dated quotes from your conversations when they answer detail questions.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| ) async throws -> ToolResponse { | ||
| let body = SearchChunksRequest(query: query, limit: limit) | ||
| return try await post( | ||
| "v1/tools/conversations/search-chunks", |
There was a problem hiding this comment.
P2: This route makes the desktop REST inventory test fail because the app-client OpenAPI contract does not contain /v1/tools/conversations/search-chunks. Add the backend ToolResponse route to docs/api-reference/app-client-openapi.json and regenerate the contract before shipping.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/Services/APIClient/APIClient+Tools.swift, line 202:
<comment>This route makes the desktop REST inventory test fail because the app-client OpenAPI contract does not contain `/v1/tools/conversations/search-chunks`. Add the backend `ToolResponse` route to `docs/api-reference/app-client-openapi.json` and regenerate the contract before shipping.</comment>
<file context>
@@ -181,6 +186,26 @@ extension APIClient {
+ ) async throws -> ToolResponse {
+ let body = SearchChunksRequest(query: query, limit: limit)
+ return try await post(
+ "v1/tools/conversations/search-chunks",
+ body: body,
+ customBaseURL: nil,
</file context>
| response = self._call() | ||
| assert not response.is_error | ||
| # All three excerpts render, but sources dedupe to one per conversation, | ||
| # best-scored chunk first. |
There was a problem hiding this comment.
P3: The test comment claims "best-scored chunk first," but the test can't detect the chunk-selection behavior. Both conv-a rows are hydrated with identical fields (text='User: verbatim evidence', conversation_title='Standup' via _hydrate_with), so the assertion response.sources[0] reflects only that the first conv-a row (score 0.91) was picked because of input order — it would equally pass if the 0.88 row were selected. To make the dedupe/preference contract real, give the two conv-a chunks distinct identifiable content (e.g. distinct text or title) and assert the chosen one has the higher score.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/tests/unit/test_tools_router.py, line 1186:
<comment>The test comment claims "best-scored chunk first," but the test can't detect the chunk-selection behavior. Both conv-a rows are hydrated with identical fields (`text='User: verbatim evidence'`, `conversation_title='Standup'` via `_hydrate_with`), so the assertion `response.sources[0]` reflects only that the first conv-a row (score 0.91) was picked because of input order — it would equally pass if the 0.88 row were selected. To make the dedupe/preference contract real, give the two conv-a chunks distinct identifiable content (e.g. distinct text or title) and assert the chosen one has the higher score.</comment>
<file context>
@@ -1119,6 +1122,113 @@ def test_is_error_propagated_in_envelope(self):
+ response = self._call()
+ assert not response.is_error
+ # All three excerpts render, but sources dedupe to one per conversation,
+ # best-scored chunk first.
+ assert response.result_text.count("Excerpt") == 3
+ assert [(s.kind, s.source_id) for s in response.sources] == [
</file context>
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "change": "Improved proactive notifications on detail questions: the context director's lookup now also searches verbatim transcript excerpts with dates, not just conversation summaries" | |||
There was a problem hiding this comment.
P3: The changelog entry leads with a user-visible outcome but then explains the implementation ("context director's lookup", "verbatim transcript excerpts", "conversation summaries"). Reword to the user-visible effect only, e.g. proactive notifications can now cite exact, dated quotes from your conversations when they answer detail questions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/changelog/unreleased/20260815-director-verbatim-transcript-retrieval.json, line 2:
<comment>The changelog entry leads with a user-visible outcome but then explains the implementation ("context director's lookup", "verbatim transcript excerpts", "conversation summaries"). Reword to the user-visible effect only, e.g. proactive notifications can now cite exact, dated quotes from your conversations when they answer detail questions.</comment>
<file context>
@@ -0,0 +1,3 @@
+{
+ "change": "Improved proactive notifications on detail questions: the context director's lookup now also searches verbatim transcript excerpts with dates, not just conversation summaries"
+}
</file context>
The transcript-chunks search endpoint returned plain text with no typed sources, so clients could not cite verbatim evidence. Emit source_sink entries shaped exactly like the sibling conversation-search endpoint: kind 'conversation' with the PARENT conversation id (shared ref namespace — no client citation-validation changes), a single-line verbatim preview capped at 600 chars, and an ISO created_at from the chunk's unix timestamp (falling back to the conversation start time). Sources dedupe to one per parent conversation, best-scored chunk first; hydrate_chunk_texts now attaches the conversation title and start time so the router needs no second Firestore read. Verification: cd backend && BACKEND_UNIT_TEST_FILE_LIST=<list with tests/unit/test_tools_router.py tests/unit/test_transcript_chunk_hydration_metadata.py> ./test.sh -> 103 + 3 passed. Failure-Class: none Co-Authored-By: Claude Opus 5 <[email protected]>
…eval source The context director's single retrieval hop searched only conversation summaries + memories; summaries drop dates/names/numbers, so detail questions went unanswered (measured notify-rate 3/8 -> ~8/8 with dated verbatim evidence in controlled tests). Add APIClient.toolSearchConversationChunks mirroring toolSearchConversations, run it as a third independent async-let in the retrieval executor, and map its sources through the existing items(fromSources:kind:) path so every excerpt is flattened to one bounded line below the quoted-data section header before it can reach a prompt. Chunk sources arrive as kind 'conversation' with the parent conversation id, so they share the summary results' ref namespace: merge dedupes by ref preferring the chunk item (verbatim beats summary), caps combined conversation-kind items at 2x perSourceResultLimit, and the prompt section cap grows to a full three-source hop (9 items) so memory items are never silently truncated. Failures still degrade to empty per source; an older backend returns the envelope with no sources, which is byte-identical to today's behavior. Verification: xcrun swift test --package-path Desktop --filter ContextProactivityRetrievalHopTests (all pass, incl. new merge/cap tests). Failure-Class: none Co-Authored-By: Claude Opus 5 <[email protected]>
7bc2e1b to
c186fc7
Compare
…rdware#11613 Main added /v1/tools/conversations/search-chunks to APIClient without app-client OpenAPI export; CI merge of main into this tip fails inventory. Mirror the existing /search known-missing entry so BasedHardware#10962 stays green. Co-authored-by: Cursor <[email protected]>
…rdware#11613 Same main-wide gap as BasedHardware#10962: CI merges main's APIClient search-chunks path without app-client OpenAPI export. Co-authored-by: Cursor <[email protected]>
…rdware#11613 Main-wide CI merge failure; unrelated to X-connector job split. Co-authored-by: Cursor <[email protected]>
…ventory (#11629) The third context-director retrieval source (#11613) added a macOS client call to /v1/tools/conversations/search-chunks, but /v1/tools is not part of the app-client OpenAPI surface, so test_desktop_rest_inventory now fails on main and on every open PR whose checks merge with it. The backend route exists with a typed ToolResponse, so this records it in KNOWN_MISSING_ROUTES with the follow-up (expose the tools search routes in the app-client contract), exactly how the sibling entries track their gaps.
…se dwell to 2s (#11634) ## What Two locked-in outcomes from the context-buckets dogfood review (offline replay against 2.5 days of live data, 2,127 visits / 200 buckets / 2,945 validated facts): **1. Workstream pooling (flag-gated, non-prod on / prod+beta off).** Extraction labels every fact with a `workstream` — the durable project its content belongs to, judged by content rather than app, biased toward reusing the active label vocabulary quoted into the prompt. Labels survive `ContextWorkstreamTag.sanitize` into a new `bucket_facts.workstreamTag` column (migration `addBucketFactWorkstreamTag`). At director time, the visit's live tag (own facts first, else a ≥80% bucket majority of ≥3 tagged facts) pulls quality-gated validated facts from sibling buckets of the same workstream into a non-citable `RELATED WORKSTREAM CONTEXT` section of the volatile prompt: worthiness ≥ 0.3, scaffolding filtered, ranked by worthiness + 6h-half-life recency, max 3 per source bucket, top 8 (~300 tokens median in replay). Pooled facts carry no refs, so delivery grounding stays own-bucket by construction. Delivery dedup widens to the workstream's sibling buckets under the same prompt cap, and provenance records the tag plus pooled fact ids. **2. Base dwell 8s → 2s.** Replay: buckets that ever become notify-eligible 77 → 141; director runs with context 458 → 814; budget gates bound the added volume. With the base now equal to `ContextDwellPolicy`'s shortened floor, the cumulative-engagement policy became a no-op, so the policy, its store query, and its tests are removed rather than left as a dead layer. Deliberately **not** in this PR: browser destination-identity migration (rewrites stored identities; separate change). ## Why A single research task fragments across apps — in the replay corpus, one project (omi) spanned ~30 buckets in 6 apps, and each fragment had to independently earn its own second dwell before it could ever notify. Pooling makes the cross-app context collide: in the replayed real sequence (Telegram `omi pr reviews` → GitHub PR list → 26s read of PR #11613), the director's section would have carried the email question about the last Omi macOS release from one minute earlier plus the CI-watch work from the Claude session. ## Verification - `xcrun swift build -c debug --package-path Desktop` clean. - Focused suites all pass: `ContextWorkstreamPoolingTests` (5: sanitization, live-tag fallback, floor/scaffold/diversity gates, deterministic ranking, non-citable section), `ContextProactivityEngineTests` (22), `ContextDepartureEvaluationStoreTests` (2, incl. a new integration test proving tags persist through `writeExtraction`, resolve as the live tag, and pool across buckets with the weak/scaffolding facts dropped), `ContextBucketSchemaTests` (8, incl. new migration/column/index assertion). - Selection thresholds (0.3 floor, top-8, 3/bucket, 6h half-life) were tuned against the live fact corpus in the replay, not guessed. - Per operator instruction, full `make preflight` and broader suites were deliberately skipped; local pre-push gates (changelog, flow coverage, format/lint, test-quality) all passed on push. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11634?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
… spec Siblings of test_desktop_rest_inventory.py (macOS): every first-party client now has an inventory proving its hardcoded backend routes exist in the app-client OpenAPI spec, after #11613 shipped a desktop route with no spec entry and broke that guard for every open PR. Known gaps are seeded from the current live surfaces with the same follow-up notes the macOS list carries, and an anti-rot test forces entries out of the allowlist as soon as the spec catches up or the call site disappears. Verification: both suites pass locally; removing a KNOWN_MISSING entry reproduces the missing-route failure with the discovered route named.
…suites, and REST route inventories (#11632) ## Summary Omi ships the same product on Flutter, macOS, and Windows against one backend, and the recurring failure mode is a rule that gets fixed on one platform and silently diverges on another. This PR adds the shared guard surface for that class: a platform-neutral contract fixture set at `contracts/parity/` that every client runs through its own production code, plus per-client REST route inventories so each first-party client is pinned to backend-owned OpenAPI authority the way macOS already is. Real instances this would have caught, from the merged history: - #10198 fixed local-day grouping in the app; #10980 and #10984 fixed the same class again on macOS. The day-key fixtures pin the rule once for every platform. - #11613 added a desktop route with no spec entry, which broke the macOS inventory guard for every open PR (unblocked by #11629). The new Windows and Flutter inventories close the same hole for the other two clients before it happens there. - The Windows task bucketing comment claimed it mirrors the Flutter app's grouping. It does not: the app has a separate Overdue bucket plus a 7-day aging rule for dateless tasks, macOS and Windows fold overdue into Today. The bucket fixtures pin BOTH live models per case and the README carries a divergence register, so converging is an explicit fixture edit instead of silent drift. - Two live DST bugs found by writing the label fixtures: Windows `formatDue` and the conversations `sectionLabel` computed Tomorrow and Yesterday as fixed 24h offsets, which degrade relative labels to dated ones on the two DST transition days each year. The neighboring `bucketOf` comment already warned about exactly this hazard. Both fixed to calendar day arithmetic. - One live backend wire bug found by writing the wire fixtures: a naive datetime reaching `ActionItemResponse` serialized with no UTC offset, the one wire form the clients disagree on (Dart and JS decode it as local wall time, Swift ISO8601 decoding rejects it). The response model now stamps UTC on naive values, with a red-first regression test. - One more client divergence found by the suite's own first CI run: a present-but-unparseable due_at string makes the Dart generated wire reject the WHOLE item with a FormatException, while the Windows sync mapper maps it to no-due-date and keeps the item. One corrupt timestamp in a list response breaks the app's decode path but not Windows sync. The two junk-due fixture cases now pin both behaviors as an explicit strict versus tolerant model split (divergence register entry 4) with the backend asserted on the strict side. ## What is in here - `contracts/parity/` fixtures + README: task due buckets (dual model), local day keys (offset-keyed expectations), action item wire decode agreement set, relative day labels including DST transition cases. Times are local calendar components so every platform evaluates them in its own zone with identical results. - Backend: `test_parity_contracts.py` validates the fixtures structurally and arithmetically (a malformed fixture cannot pass vacuously on every client at once), proves backend round-trip of the parseable wire vectors, rejects the junk forms clients only tolerate defensively, and pins the new naive-timestamp guard. - Windows: `bucketOf`/`formatDue` extracted from the Tasks page into `lib/taskBuckets.ts` (behavior unchanged, comment corrected), DST fixes, `mapBackendItem` exported, and two conformance suites (28 + 8 cases). - Flutter: the page-private categorization extracted to `task_categorization.dart` as a pure injectable-now function (behavior unchanged), and a conformance suite covering buckets, `conversationLocalDayKey`, and the generated wire decode. - Inventories: `test_windows_rest_inventory.py` and `test_flutter_rest_inventory.py`, siblings of the macOS one, with known gaps seeded from the current live surfaces (mirroring the macOS list's follow-up notes) and an anti-rot test that forces allowlist entries out as soon as the spec catches up. - macOS: no Swift adapter in this PR. The fixtures already encode the macOS model, and the README lists the adapter as the tracked follow-up with exact file pointers; shipping untested Swift from a non-Mac machine into the flaky Swift lane seemed worse than saying so plainly. - Two small repairs found along the way, each in its own commit: the AGENTS.md lean check compared backslash paths against forward-slash budget keys on Windows (every budgeted file misreported), and the app guide pointed at Firebase config files deleted in e81f1e8, which fails `agent-doc-references` for any PR touching agent docs. Why a fixture set instead of per-platform tests: the failing pattern is cross-platform disagreement, not single-platform regression. A shared vector file makes a behavior change reviewable as a cross-platform decision, and the backend integrity test keeps the fixtures themselves honest. ## Verification - Backend: `python -m pytest tests/unit/test_parity_contracts.py tests/unit/test_windows_rest_inventory.py tests/unit/test_flutter_rest_inventory.py -q` passes 17/17. The naive-timestamp test failed 4 cases before the validator (offsetless emission reproduced) and passes with it. 79 neighboring action item tests pass unchanged. - Windows: full vitest suite 5199 passed, 18 skipped (546 files). `npm run typecheck` clean on both configs. Mutation check: reintroducing the fixed-offset math fails exactly the 4 DST label cases; restoring the fix returns 28/28. DST cases executed locally on a US Pacific machine; they are counted skips on UTC CI and the non-DST cases always run. - Flutter: no local Flutter SDK on this machine; the suite is discovered by `app/test.sh` and is CI-verified (the first CI run passed 1031 of 1033 parity-adjacent cases and the two failures were the genuine strict-decode divergence above, now pinned). Dart formatting was aligned with CI exactly: dart 3.12.2 (the flutter 3.44.5 bundled version) with an explicit language version 3.0, verified with set-exit-if-changed. The extraction is a pure move plus a `now` parameter defaulting to the wall clock. - `make preflight`: 26 checks pass locally; `desktop-backend-candidate-probe-fixtures` fails only because the probe requires `signal.SIGALRM`, which does not exist on Windows runners (untouched by this diff; passes on Linux CI). Product invariants affected: none ## Notes for review - The `task_due_buckets.json` dual-model column is deliberate: it documents that the platforms disagree today rather than pretending one of them is authoritative. Whichever way product converges, the change is one fixture edit plus the losing platform's code. - The inventories' KNOWN_MISSING sets are seeded with the same surfaces and reasons the macOS list already tracks (unmodeled responses, unexported routers), so this PR does not regenerate the app-client spec; the anti-rot test guarantees the lists only shrink.
…1206) * feat(chat): hard-scope Ask to a conversation or timeframe (#4515) PageContext was only a soft prompt hint; tools still searched the whole bank. Fail-closed chat_scope clamps get/search conversation tools, strengthens the prompt, and wires Ask-about-this + Today/This week chips on web and Flutter. Co-authored-by: Cursor <[email protected]> * fix(chat): address #11206 cubic/CI hard-scope review Fail-closed scoped fetch respects discarded/statuses; gate memory tools under conversation scope; validate aware PageContext dates; page-local Flutter scope + l10n chips; derive web chip state from context; expand unit coverage and bump the agentic line-count ratchet. Failure-Class: none Co-authored-by: Cursor <[email protected]> * fix(chat): clear #11206 pyright, format, and retrieval ARCHITECTURE Fix PageContext date validator typing for pyright, dart-format message_provider, and add backend/utils/retrieval/ARCHITECTURE.md so the new chat_scope module passes architecture guardrails. Failure-Class: none Co-authored-by: Cursor <[email protected]> * chore(chat): format generated l10n at page_width 120 for CI Match app/analysis_options.yaml page_width so flutter gen-l10n on CI's Flutter 3.44.9 stable tip is a no-op against checked-in files. Co-authored-by: Cursor <[email protected]> * fix(chat): restore gen-l10n style and format message_provider Generated Files wants Flutter 3.44.9 gen-l10n output (expanded pluralLogic, no trailing comma on last Locale), not dart-format rewrites. Restore that style from the previously green tip and keep the new chatScope keys. Format message_provider with page_width 120 after pub get for the Formatting check. Failure-Class: none Co-authored-by: Cursor <[email protected]> * fix(chat): black-format scoped-chat Python for CI Repo Formatting check requires black 26.5.1 at line-length 120 on the PageContext / chat_scope surfaces. Failure-Class: none Co-authored-by: Cursor <[email protected]> * fix(chat): format app_en.arb with 4-space indent for CI Repo Formatting ARB check requires json.dumps(..., indent=4). Failure-Class: none Co-authored-by: Cursor <[email protected]> * fix(chat): clear #11206 unit isolation + cubic scoped-load nits Co-authored-by: Cursor <[email protected]> * fix(chat): ratchet agentic 1516 + stub chat_scope for prompt-cache CI Co-authored-by: Cursor <[email protected]> * fix(chat): fail-closed unknown scope fields and restore memory-search contract Unknown timestamps/status no longer pass timeframe/status filters, scoped conversation fetch honors offset, and the MemoryService search source-contract matches the post-merge call shape. Co-authored-by: Cursor <[email protected]> * fix(chat): narrow scoped memory timestamps * merge(main): resolve #11206 PageContext import conflict Keep Field (GenerateReply bounds from main) with ValidationInfo / field_validator for timezone-aware start_date/end_date (#4515). Workflow files left at pre-merge tip (OAuth cannot push workflow scope). Co-authored-by: Cursor <[email protected]> * fix(ci): sync desktop release workflows with main for Hygiene desktop-candidate-source-gate expects the 2700s App-token clamp; update-branch kept the tip's stale 5400s copy. Co-authored-by: Cursor <[email protected]> * fix(chat): close scoped Ask retrieval gaps * fix(chat): align scoped memory checks with CI * fix(chat): preserve memory search type contract * fix(chat): format scoped memory retrieval * fix(test): allowlist search-chunks desktop inventory gap from #11613 Same main-wide gap as #10962: CI merges main's APIClient search-chunks path without app-client OpenAPI export. Co-authored-by: Cursor <[email protected]> * fix(chat): refilter hydrated search and restore memory oversample Stale timeframe-scoped semantic hits are dropped after hydration, and MemoryService.search again defaults to a 3× candidate pool when candidate_limit is omitted. Also restore the gen-l10n blank line CI expects. Co-authored-by: Cursor <[email protected]> * chore(ci): retrigger hermetic after unrelated listen-pusher flake Co-authored-by: Cursor <[email protected]> * chore(ci): retrigger hygiene with refreshed line-count ratchet * fix(chat): remove unused chunkCount in streamTextMessage * chore(ci): retrigger hermetic after scope-detect cancellation flake * docs(backend): drop stale claudeAgentEnabled reference from retrieval ARCHITECTURE.md The Claude Agent VM path and its claudeAgentEnabled flag were retired on main; the chat_scope boundary note pointed at a setting that no longer exists anywhere in the repo. * chore(ci): retrigger hermetic gauntlet after runner-cancel flake Sync Cloud Tasks Stack Gauntlet was auto-cancelled mid apt-get on the prior run, which failed Backend Hermetic Merge Gate downstream. No code issue; retriggering for a clean run. * chore(ci): retrigger hygiene with corrected line-count exception * chore(ci): retrigger hermetic gauntlet after third apt-get mirror stall * fix(ci): bypass stalled Azure apt mirror The hosted runner's Azure Ubuntu mirror repeatedly stalled Redis setup until the 20-minute gauntlet deadline. Use the existing archive.ubuntu.com fallback directly for each Redis-dependent gauntlet.\n\nVerification:\n- actionlint -config-file .github/actionlint.yaml .github/workflows/backend-hermetic-e2e.yml\n- python3 backend/scripts/check_workflow_contracts.py --changed-files .github/workflows/backend-hermetic-e2e.yml\n- git diff --check\n\nFailure-Class: none * fix(ci): bypass stalled Azure apt mirror in Linux package helper smoke Same stall as backend-hermetic-e2e's Redis install (69e5a9e): the hosted runner's Azure Ubuntu mirror hangs InRelease fetches, this time in desktop-windows-ci's Linux runtime dependency install, until the job's 6-hour default timeout cancels it. Drop the mirror the same way, falling back to archive.ubuntu.com directly. Verification: - actionlint -config-file .github/actionlint.yaml .github/workflows/desktop-windows-ci.yml - git diff --check Failure-Class: none * fix(app): restore fetchChatApps() on ChatPage init dropped by hard-scope Ask The initial hard-scope commit replaced the fetchChatApps() call with the initialChatContext branch in the same hunk instead of alongside it, so every ChatPage open silently stopped fetching enabled chat apps, not just ones without a scope context. Found by Git-on-my-level on review. Verification: - dart format --line-length 120 app/lib/pages/chat/page.dart - flutter analyze app/lib/pages/chat/page.dart -> no issues Failure-Class: none * fix(web): restore main's indentation in the apps detail page My merge of main auto-resolved web/frontend/src/app/apps/[id]/page.tsx after #11696 changed it, and left the iOS/Android URL ternary indented two spaces deeper than main. Frontend Lint fails on it with two prettier/prettier "Delete ··" errors at 159:5 and 160:1. This PR has no semantic change to that file — the whole diff against main was those two indentation lines — so the fix is to take main's version verbatim rather than re-format a file this branch should not be touching at all. Verification: - git diff origin/main -- the file is now empty - web/frontend was the only directory affected Failure-Class: none * chore(ci): retrigger hygiene after declaring INV-MEM-4 Hygiene skips on body-only edits, so the product-invariants check needs a push to re-read the declaration. --------- Co-authored-by: Cursor <[email protected]>
What
Adds the verbatim transcript-chunks layer as a third retrieval source for the macOS context director's single bounded retrieval hop (granularity-aware retrieval).
Measured motivation: the director's retrieval hop searched only conversation summaries + memories. Summaries drop dates/names/numbers; with dated verbatim evidence the director's notify-rate on a real question beat went from 3/8 to ~8/8 in controlled tests. The backend already documented that detail questions need
/v1/tools/conversations/search-chunks, but that endpoint returned plain text with no typed sources, so the client could not cite it.Backend half
search_conversation_chunksnow emits typed sources shaped exactly like the sibling conversation-search endpoint:kind='conversation',source_id= parent conversation id, single-line verbatim preview capped at 600 chars, ISOcreated_atfrom the chunk's unix timestamp (falling back to the conversation start time). Sources dedupe to one per parent conversation, best-scored chunk first.hydrate_chunk_textsattaches the parent conversation's title and start time so the router needs no second Firestore read.'conversation'means no new ref namespace; client citation validation is untouched.Client half
APIClient.toolSearchConversationChunksmirrorstoolSearchConversations.async letinContextDirectorRetrievalExecutor.retrieve; failures degrade to empty per source, per the executor's philosophy.mergeConversationItemsdedupes by ref against summary results preferring the chunk item (verbatim beats summary), chunk items lead the merged order, and combined conversation-kind items are capped atconversationKindCombinedLimit = 2x perSourceResultLimit.maximumPromptItems = 9(a full three-source hop) so memory items are never silently truncated behind a full conversation merge.Injection hardening
Verbatim excerpts are untrusted user-conversation text entering the director prompt. They flow through the exact same fail-closed path as summaries:
ContextDirectorRetrievalHop.items(fromSources:kind:)flattens title/preview viaContextDestinationKey.singleLine(bounded, newline/control-char free), and the prompt section's static quoted-data framing (sectionHeader) always precedes any retrieved byte. The backend additionally flattens the preview to one line before it leaves the server.Deploy order (safe both ways)
Verification
cd backend && BACKEND_UNIT_TEST_FILE_LIST=<tests/unit/test_tools_router.py, tests/unit/test_transcript_chunk_hydration_metadata.py> ./test.sh— 103 + 3 passed (new: typed-source shape, per-conversation dedupe, single-line/600-cap preview, ISO date + fallback, empty-result sources; realhydrate_chunk_textsmetadata attachment).xcrun swift test --package-path Desktop --filter ContextProactivityRetrievalHopTests— 19 tests, 0 failures (new: chunk-over-summary merge preference, combined cap, prompt-section cap keeps memory items).make preflight(local lane): PREFLIGHT_RESULT.scripts/pr-preflight --suggest: product invariants affected — none; nofix:commits, no failure-class declaration required.items()path.Review
Independent cursor review (grok, via agentctl) of the branch diff against origin/main on three axes — citation-safety, injection-hardening of verbatim excerpts entering the director prompt, and cap correctness — returned no findings on all three:
conversation+ parent conversation id;retrievedNamespacesunchanged; retrieved-namespace refs still validate only against the per-call allowlist (empty unless the hop completed); no second id space opened.response.sources→items(fromSources:kind:)→promptSection(neverresult_text); the server flattens the preview to one line and the client re-flattens viaContextDestinationKey.singleLine; quoted items appear only belowsectionHeaderin the uncached suffix.maximumPromptItems, provenanceprefix(10)bound not exceeded.Failure class
Failure-Class: none
🤖 Generated with Claude Code