Repository navigation
fix: make the review card, the voice guard, and the follow-up tail actually work (#12635 follow-up) - #12669
Conversation
There was a problem hiding this comment.
22 issues found across 58 files
Confidence score: 2/5
backend/utils/other/notifications.pycan report a successful daily-summary run after a Firestore timezone chunk failed, causing users in that chunk to miss notifications; propagate per-chunk failure status or the underlying exception fromnotification_db.get_users_for_daily_summary.HomeKnowsImpressionLedger.adoptCurrentOwner()indesktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsImpressionLedger.swiftcan show the previous account’s cached knows-list to the new owner, whileDesktopAutomationActivationActions.swiftcan send one fixture’s requests to different accounts; clear owner-scoped caches and capture one authorization snapshot for all awaited requests.MemoryReviewCard.swiftandapp/lib/widgets/components/memory_review_card.dartcan treat unsynced or failed local reads as valid empty state, re-enable unknown verdict controls, or invalidate another surface’s load; preserve failures for retry and coordinate shared loading instead of starting a competing request.ChatStreamingBuffer.swiftcan retain failed or owner-switched streamed content, andFloatingBarVoicePlaybackService.swiftcan speak failure notices aloud; finish buffers on every terminal path and include allChatTurnFailureNoticecopies in the TTS exclusion set.
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="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingBarVoicePlaybackService.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingBarVoicePlaybackService.swift:1145">
P2: When a voice-only request fails through `ChatTurnFailureNotice`, this guard still allows the failure notice into TTS because the new set omits that copy. Include all `ChatTurnFailureNotice` failure copies in the shared suppression predicate, including classified notices.</violation>
</file>
<file name="desktop/macos/Desktop/Tests/MemoryReviewCardTests.swift">
<violation number="1" location="desktop/macos/Desktop/Tests/MemoryReviewCardTests.swift:520">
P3: This unit test polls with a wall-clock wait: waitForSettled(...timeoutMs: 2_000) loops on Task.sleep(100ms) in DesktopAutomationActivationActions.waitUntil. The accept it drives is deterministic (UnusedMutator returns immediately), so the settle can be awaited deterministically rather than polled; if a poll wait is genuinely unavoidable here, add the `// omi-test-quality: wall-clock-wait` annotation the repo policy requires so check_desktop_test_quality.py doesn't flag it.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/MainWindow/Dashboard/MemoryReviewCard.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/MainWindow/Dashboard/MemoryReviewCard.swift:241">
P2: After the backend accepts a vote, this `try?` discards local mirror failures. Rebuilding the card can therefore show `.none` and re-enable its controls until an unrelated sync; retry or durably queue the mirror failure instead of silently losing it.</violation>
<violation number="2" location="desktop/macos/Desktop/Sources/MainWindow/Dashboard/MemoryReviewCard.swift:352">
P2: When the local mirror has not synced one summary memory, this line marks the partial read successful after the row was mapped to `.none`. The mounted card then never retries and offers controls for an unknown verdict; treat incomplete ID coverage as a failed read.</violation>
</file>
<file name="app/test/widgets/memory_review_card_test.dart">
<violation number="1" location="app/test/widgets/memory_review_card_test.dart:316">
P3: In `a verdict cast elsewhere after a correction still wins`, the shallow copy in `_mutableProvider` (`List<Memory>.from(rows)`) shares the same `Memory` instances the provider stores, so `row.userReview = true` mutates the live provider state directly. The reload is incidental, and the test passes even if refresh/projection semantics broke — it validates only that the card re-reads provider state, not that a fresh fetch carries the other device's verdict. Construct a fresh `Memory` (or a deep copy) for the post-refresh state so the verdict arrives only through `loadMemories()`.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/MainWindow/Dashboard/ChatDailySummaryCard.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/MainWindow/Dashboard/ChatDailySummaryCard.swift:273">
P2: When a regenerated summary changes only a memory's category, this identity stays unchanged and SwiftUI reuses the old `MemoryReviewCardStore`, so the row keeps the previous category label and analytics category. Include `category` in the section identity (or otherwise update the captured items) so category-only refreshes rebuild the section.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/MainWindow/Pages/DashboardPage.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/MainWindow/Pages/DashboardPage.swift:1051">
P2: When the mounted row is an insight, this handle returns before `openKnowsRow` finishes its asynchronous navigation and ledger write. `home_knows_open` can therefore report `opened=true` while `wasOpened=false`; make the handle/action await the insight open before reading the ledger, or provide a settled result.</violation>
</file>
<file name="backend/utils/chat_followup.py">
<violation number="1" location="backend/utils/chat_followup.py:66">
P2: When a no-tail answer legitimately ends with `<<`, this threshold removes the operators as if they were partial marker residue. Keep the two-character prefix and only strip once the actual marker prefix `<<<` is present.</violation>
</file>
<file name="backend/utils/other/notifications.py">
<violation number="1" location="backend/utils/other/notifications.py:179">
P1: When a Firestore timezone chunk fails, `notification_db.get_users_for_daily_summary` swallows the exception before this wrapper sees it. Propagate per-chunk success status or the exception from the DB helper so partial reads keep the checkpoint.</violation>
</file>
<file name="backend/utils/memory/learned_today.py">
<violation number="1" location="backend/utils/memory/learned_today.py:210">
P2: When a later memory page fails, this `break` still renders selections from earlier pages even though this helper's fail-open contract is to show no card. Return an empty result after reporting the failure so a partial read cannot omit a higher-ranked memory from the card.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsImpressionLedger.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsImpressionLedger.swift:286">
P1: When the account changes while the Home knows-list remains mounted, `adoptCurrentOwner()` resets only impression de-duplication and leaves the page’s cached `knowsLedger` from the previous account. The new owner can therefore inherit old suppressions/counts, and opening or dismissing a stale row can merge that row into the new owner’s ledger. Reload and replace the page ledger on `runtimeOwnerDidChange`, and guard direct open/dismiss mutations against the active owner.</violation>
</file>
<file name="backend/routers/daily_summary_e2e.py">
<violation number="1" location="backend/routers/daily_summary_e2e.py:105">
P2: When the local/offline server is used with any authenticated account outside the two manifest-backed E2E principals, this endpoint still overwrites that account's deterministic daily-summary document. Require `is_chat_first_e2e_fixture_uid(uid)` and return 404 for non-fixture UIDs, matching the sibling Chat-first harness boundary.</violation>
</file>
<file name="backend/utils/retrieval/agentic.py">
<violation number="1" location="backend/utils/retrieval/agentic.py:808">
P2: When a failure arrives after a partial follow-up marker, `joined.find` returns -1 and the helper appends the outcome after the marker residue. The persisted answer then exposes text such as `<<<FOLL`; strip partial delimiters before appending outcome text, reusing `split_followup_tail`.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsComposer.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsComposer.swift:120">
P2: Near the 14-day due-date boundary, the greeting and rows can evaluate eligibility at different instants and disagree. Evaluate both from one page-scoped timestamp, passing that same `now` to `openTaskCount` and `compose`.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift:162">
P2: When memory creation or the summary seed fails after earlier creates succeed, this action returns without rolling back those real memories. Delete the already-created IDs on failure and provide teardown for successful fixture runs.</violation>
<violation number="2" location="desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift:162">
P2: If the signed-in owner changes during this awaited fixture, the memory creates and summary POST can use different accounts. Capture one authorization snapshot before the first request, pass it to every request, and abort when that snapshot is no longer current.</violation>
<violation number="3" location="desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift:323">
P2: When teardown runs before `createTask`'s background sync finishes, it deletes only the local row and skips backend deletion, but the unawaited POST can still create a server task. Wait for sync and retain backend IDs before allowing fixture teardown.</violation>
<violation number="4" location="desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift:551">
P2: If an automation request is cancelled while either polling helper waits, `try?` swallows cancellation and the MainActor loop spins until the deadline. Propagate cancellation or return immediately when `Task.isCancelled` becomes true.</violation>
</file>
<file name="backend/utils/other/daily_summary_budget.py">
<violation number="1" location="backend/utils/other/daily_summary_budget.py:54">
P2: For high-token-per-character text, the 360,000-character fallback can still exceed the model context. Measure with the model tokenizer or choose a token-safe bound instead of relying on the rough four-characters-per-token estimate.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarView.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarView.swift:1659">
P3: The comment says this joins tokens the way the sibling hold hint does, but the sibling (`PushToTalkMicButton.shortcutLabel`) uses `pttShortcut.displayLabel`, which joins with a space; `.joined()` here joins with no separator. For a chord like ⌃⌥O the follow-up chip shows "or hold ⌃⌥O" while the sibling shows "or hold ⌃ ⌥ O". Use `settings.pttShortcut.displayLabel` (or `displayTokens.joined(separator: " ")`) so the two hints actually read the same as the comment claims.</violation>
</file>
<file name="desktop/macos/Desktop/Sources/Chat/ChatStreamingBuffer.swift">
<violation number="1" location="desktop/macos/Desktop/Sources/Chat/ChatStreamingBuffer.swift:31">
P2: When a streamed turn fails or `TaskChatState` changes owners, the buffer retains the full unnormalized response even after the visible message is terminal or removed. Call `finishStreaming` on every terminal path and clear all accumulators during owner invalidation; otherwise repeated task turns grow memory and can keep the previous owner's answer in memory.</violation>
</file>
<file name="app/lib/widgets/components/memory_review_card.dart">
<violation number="1" location="app/lib/widgets/components/memory_review_card.dart:121">
P2: When another surface is already loading the shared provider, this guard starts a second `loadMemories()` because the card did not start that request. The second request invalidates the first via `_loadSequence`, so a failed or partial second response can discard a successful first result; track the provider's actual in-flight future or distinguish never-initialized from in-flight before loading.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| stats.groups_attempted += 1 | ||
| try: | ||
| users = await _get_users_for_daily_summary(timezones_by_hour[target_hour], target_hour) | ||
| users, group_fully_read = await _get_users_for_daily_summary(timezones_by_hour[target_hour], target_hour) |
There was a problem hiding this comment.
P1: When a Firestore timezone chunk fails, notification_db.get_users_for_daily_summary swallows the exception before this wrapper sees it. Propagate per-chunk success status or the exception from the DB helper so partial reads keep the checkpoint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/utils/other/notifications.py, line 179:
<comment>When a Firestore timezone chunk fails, `notification_db.get_users_for_daily_summary` swallows the exception before this wrapper sees it. Propagate per-chunk success status or the exception from the DB helper so partial reads keep the checkpoint.</comment>
<file context>
@@ -176,13 +176,25 @@ async def send_daily_summary_notification() -> None:
stats.groups_attempted += 1
try:
- users = await _get_users_for_daily_summary(timezones_by_hour[target_hour], target_hour)
+ users, group_fully_read = await _get_users_for_daily_summary(timezones_by_hour[target_hour], target_hour)
except Exception as e:
# One hour group's read failing must not cost the other 23 groups.
</file context>
|
|
||
| /// An owner change is the start of a new visit whether or not the view was | ||
| /// rebuilt: the previous owner's keys describe another account's ledger. | ||
| private func adoptCurrentOwner() { |
There was a problem hiding this comment.
P1: When the account changes while the Home knows-list remains mounted, adoptCurrentOwner() resets only impression de-duplication and leaves the page’s cached knowsLedger from the previous account. The new owner can therefore inherit old suppressions/counts, and opening or dismissing a stale row can merge that row into the new owner’s ledger. Reload and replace the page ledger on runtimeOwnerDidChange, and guard direct open/dismiss mutations against the active owner.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/MainWindow/Dashboard/HomeKnowsImpressionLedger.swift, line 286:
<comment>When the account changes while the Home knows-list remains mounted, `adoptCurrentOwner()` resets only impression de-duplication and leaves the page’s cached `knowsLedger` from the previous account. The new owner can therefore inherit old suppressions/counts, and opening or dismissing a stale row can merge that row into the new owner’s ledger. Reload and replace the page ledger on `runtimeOwnerDidChange`, and guard direct open/dismiss mutations against the active owner.</comment>
<file context>
@@ -226,33 +244,57 @@ final class HomeKnowsImpressionStore {
+
+ /// An owner change is the start of a new visit whether or not the view was
+ /// rebuilt: the previous owner's keys describe another account's ledger.
+ private func adoptCurrentOwner() {
+ let current = ownerID()
+ guard current != visitOwnerID else { return }
</file context>
| nonisolated static func shouldSpeak(_ text: String) -> Bool { | ||
| let lowercased = text.lowercased() | ||
| if lowercased == "failed to get a response. please try again." { | ||
| if FloatingBarAnswerFailureCopy.isFailureCopy(lowercased) { |
There was a problem hiding this comment.
P2: When a voice-only request fails through ChatTurnFailureNotice, this guard still allows the failure notice into TTS because the new set omits that copy. Include all ChatTurnFailureNotice failure copies in the shared suppression predicate, including classified notices.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/FloatingControlBar/FloatingBarVoicePlaybackService.swift, line 1145:
<comment>When a voice-only request fails through `ChatTurnFailureNotice`, this guard still allows the failure notice into TTS because the new set omits that copy. Include all `ChatTurnFailureNotice` failure copies in the shared suppression predicate, including classified notices.</comment>
<file context>
@@ -1140,9 +1140,9 @@ final class FloatingBarVoicePlaybackService: NSObject, AVAudioPlayerDelegate, AV
+ nonisolated static func shouldSpeak(_ text: String) -> Bool {
let lowercased = text.lowercased()
- if lowercased == "failed to get a response. please try again." {
+ if FloatingBarAnswerFailureCopy.isFailureCopy(lowercased) {
return false
}
</file context>
| // candidate, so the catalog's first entry has to be the last one written to be the hub's | ||
| // first row. | ||
| for text in HomeKnowsFixture.taskCatalog.reversed() { | ||
| guard await TasksStore.shared.createTask(description: text, dueAt: nil, priority: nil) != nil else { |
There was a problem hiding this comment.
P2: When teardown runs before createTask's background sync finishes, it deletes only the local row and skips backend deletion, but the unawaited POST can still create a server task. Wait for sync and retain backend IDs before allowing fixture teardown.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/Automation/DesktopAutomationActivationActions.swift, line 323:
<comment>When teardown runs before `createTask`'s background sync finishes, it deletes only the local row and skips backend deletion, but the unawaited POST can still create a server task. Wait for sync and retain backend IDs before allowing fixture teardown.</comment>
<file context>
@@ -70,5 +78,678 @@ extension DesktopAutomationActionRegistry {
+ // candidate, so the catalog's first entry has to be the last one written to be the hub's
+ // first row.
+ for text in HomeKnowsFixture.taskCatalog.reversed() {
+ guard await TasksStore.shared.createTask(description: text, dueAt: nil, priority: nil) != nil else {
+ return ["error": "createTask failed for \(text)"]
+ }
</file context>
|
|
||
| # Fallback bound when the deployed budget is missing or nonpositive. ~360k chars | ||
| # is roughly 90k tokens, comfortably inside the 272k-token model limit. | ||
| DEFAULT_MAX_HISTORY_CHARS = 360_000 |
There was a problem hiding this comment.
P2: For high-token-per-character text, the 360,000-character fallback can still exceed the model context. Measure with the model tokenizer or choose a token-safe bound instead of relying on the rough four-characters-per-token estimate.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/utils/other/daily_summary_budget.py, line 54:
<comment>For high-token-per-character text, the 360,000-character fallback can still exceed the model context. Measure with the model tokenizer or choose a token-safe bound instead of relying on the rough four-characters-per-token estimate.</comment>
<file context>
@@ -33,11 +33,25 @@
+
+# Fallback bound when the deployed budget is missing or nonpositive. ~360k chars
+# is roughly 90k tokens, comfortably inside the 272k-token model limit.
+DEFAULT_MAX_HISTORY_CHARS = 360_000
_CURSOR_HOUR = 'hour'
</file context>
| XCTAssertEqual(before["row0_settled"], "false") | ||
|
|
||
| card.send(.accept, to: item) | ||
| _ = await MemoryReviewFixture.waitForSettled(store: card, item: item, timeoutMs: 2_000) |
There was a problem hiding this comment.
P3: This unit test polls with a wall-clock wait: waitForSettled(...timeoutMs: 2_000) loops on Task.sleep(100ms) in DesktopAutomationActivationActions.waitUntil. The accept it drives is deterministic (UnusedMutator returns immediately), so the settle can be awaited deterministically rather than polled; if a poll wait is genuinely unavoidable here, add the // omi-test-quality: wall-clock-wait annotation the repo policy requires so check_desktop_test_quality.py doesn't flag it.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Tests/MemoryReviewCardTests.swift, line 520:
<comment>This unit test polls with a wall-clock wait: waitForSettled(...timeoutMs: 2_000) loops on Task.sleep(100ms) in DesktopAutomationActivationActions.waitUntil. The accept it drives is deterministic (UnusedMutator returns immediately), so the settle can be awaited deterministically rather than polled; if a poll wait is genuinely unavoidable here, add the `// omi-test-quality: wall-clock-wait` annotation the repo policy requires so check_desktop_test_quality.py doesn't flag it.</comment>
<file context>
@@ -348,8 +422,140 @@ final class MemoryReviewCardTests: XCTestCase {
+ XCTAssertEqual(before["row0_settled"], "false")
+
+ card.send(.accept, to: item)
+ _ = await MemoryReviewFixture.waitForSettled(store: card, item: item, timeoutMs: 2_000)
+
+ let after = MemoryReviewFixture.rowDetail(index: 0, item: item, store: card)
</file context>
| testWidgets('a verdict cast elsewhere after a correction still wins', (tester) async { | ||
| // The optimistic paint is not a permanent override: once the write has | ||
| // persisted the row is derived from live memory state again. | ||
| final row = _memory(id: 'mem-live'); |
There was a problem hiding this comment.
P3: In a verdict cast elsewhere after a correction still wins, the shallow copy in _mutableProvider (List<Memory>.from(rows)) shares the same Memory instances the provider stores, so row.userReview = true mutates the live provider state directly. The reload is incidental, and the test passes even if refresh/projection semantics broke — it validates only that the card re-reads provider state, not that a fresh fetch carries the other device's verdict. Construct a fresh Memory (or a deep copy) for the post-refresh state so the verdict arrives only through loadMemories().
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/test/widgets/memory_review_card_test.dart, line 316:
<comment>In `a verdict cast elsewhere after a correction still wins`, the shallow copy in `_mutableProvider` (`List<Memory>.from(rows)`) shares the same `Memory` instances the provider stores, so `row.userReview = true` mutates the live provider state directly. The reload is incidental, and the test passes even if refresh/projection semantics broke — it validates only that the card re-reads provider state, not that a fresh fetch carries the other device's verdict. Construct a fresh `Memory` (or a deep copy) for the post-refresh state so the verdict arrives only through `loadMemories()`.</comment>
<file context>
@@ -251,6 +264,79 @@ void main() {
+ testWidgets('a verdict cast elsewhere after a correction still wins', (tester) async {
+ // The optimistic paint is not a permanent override: once the write has
+ // persisted the row is derived from live memory state again.
+ final row = _memory(id: 'mem-live');
+ final provider = _mutableProvider([row]);
+ addTearDown(provider.dispose);
</file context>
| let tokens = settings.pttShortcut.displayTokens | ||
| guard let token = tokens.first, !token.isEmpty else { return nil } | ||
| return "or hold \(token) to ask aloud" | ||
| let shortcut = settings.pttShortcut.displayTokens.joined() |
There was a problem hiding this comment.
P3: The comment says this joins tokens the way the sibling hold hint does, but the sibling (PushToTalkMicButton.shortcutLabel) uses pttShortcut.displayLabel, which joins with a space; .joined() here joins with no separator. For a chord like ⌃⌥O the follow-up chip shows "or hold ⌃⌥O" while the sibling shows "or hold ⌃ ⌥ O". Use settings.pttShortcut.displayLabel (or displayTokens.joined(separator: " ")) so the two hints actually read the same as the comment claims.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarView.swift, line 1659:
<comment>The comment says this joins tokens the way the sibling hold hint does, but the sibling (`PushToTalkMicButton.shortcutLabel`) uses `pttShortcut.displayLabel`, which joins with a space; `.joined()` here joins with no separator. For a chord like ⌃⌥O the follow-up chip shows "or hold ⌃⌥O" while the sibling shows "or hold ⌃ ⌥ O". Use `settings.pttShortcut.displayLabel` (or `displayTokens.joined(separator: " ")`) so the two hints actually read the same as the comment claims.</comment>
<file context>
@@ -1649,11 +1649,16 @@ struct FloatingControlBarView: View {
- let tokens = settings.pttShortcut.displayTokens
- guard let token = tokens.first, !token.isEmpty else { return nil }
- return "or hold \(token) to ask aloud"
+ let shortcut = settings.pttShortcut.displayTokens.joined()
+ guard !shortcut.isEmpty else { return nil }
+ return "or hold \(shortcut) to ask aloud"
</file context>
| let shortcut = settings.pttShortcut.displayTokens.joined() | |
| let shortcut = settings.pttShortcut.displayLabel |
4fdda59 to
e876a48
Compare
kodjima33
left a comment
There was a problem hiding this comment.
Flagged author. Bug-fix bundle (5 distinct defects, each root-caused with code paths) following up #12635, but diff (4185 lines, 59 files, spans backend+desktop+app) fails the scoped-diff <=300 confidence-gate criterion. CI green, tests added, no abuse signals found. ~3/5 confidence -> approve-only, do not merge.
…sking
Four defects in the new mobile chat/daily-summary chrome, each with a test
that fails without its fix.
MemoryReviewCard never loaded its memories on the surface that shows it
first. `_ensureMemoriesLoaded` bailed on `provider.loading`, but
`MemoriesProvider._loading` starts `true` and is only cleared by a load —
and nothing in app start-up calls `init()`; only the memories page does. So
when chat or a daily summary was the first memory surface of a session,
every row rendered permanently unresolved: content from the block, all three
controls disabled, forever. Now the card skips only while a fetch it started
is still running.
After a correction the optimistic "Updated." was reinstated permanently, so
the row could never again read live state — a later refresh, or a verdict
cast on another device, was outranked by a local paint from minutes ago.
That contradicts the card's own contract ("the row goes back to reading the
live memory"). The override is dropped on completion; the sticky "Updated."
now applies only while nothing live answers for the id, which is the case
the comment was really about: a knowledge-ledger correction appends a
replacement under a NEW id, so the referenced id stops resolving.
In that same case the row went on rendering the ORIGINAL learned text under
"Updated.", because the content fell back to the block item once the memory
stopped resolving. The submitted correction is remembered and shown instead.
Both natively rendered content blocks also invented fallback prose that
repeated what they render. `ServerMessage` fills an empty `text` from its
content blocks, so a follow-up-only answer put the question in the bubble
AND in the chip, and a review card put "Things I learned today" above a card
that draws that heading itself. Worse, the review-card fallback was
unconditional while `MemoryReviewCardBlock.tryFromBlock` returns null for an
item-less block — an unusable card left a heading standing over nothing.
Both now contribute no fallback text, matching the `evidence` case beside
them.
Co-Authored-By: Claude Opus 5 <[email protected]>
…cises d3cf5b8 added seven `covers:` entries to satisfy the `desktop-e2e-flow-coverage` gate. The gate is a text match on the covers list; it cannot tell an earned entry from an unearned one, which is exactly why an unearned one is expensive: it reports these modules as e2e-covered when nothing runs them. chat-hermetic claimed the follow-up tail split, the chip view, and question-origin attribution. The flow runs against `OMI_LLM_STUB`, sends a plain typed query and asserts the exact reply `MARKER:chat-hermetic`. No stub path emits a `<<<FOLLOWUP>>>` tail — `exact_reply_token` strips the trailing `?` that `ChatFollowUpTail.validatedQuestion` requires — so no chip can exist, and `main_chat_snapshot` returns no field that could assert one. home-stage claimed the knows-list impression ledger and the memory review rows. Its steps drive reset, the five `home_*` actions, `chat_drafts_snapshot` and `daily_summary_snapshot`; the last is explicitly read-only and shape-only and renders no review rows, and no step opens the knows list or asserts rotation, dismissal, or telemetry. Making the claims true needs a stub that can emit a tail plus a chip read seam, and a bridge action that drives the knows list and the review card — new harness surface, not a flow edit. Until then the honest state is an uncovered file and a red gate. A comment now sits where each removed block was, so the entries are not re-added without the steps. `desktop-e2e-flow-coverage` after this change (its manifest command, `check-e2e-flow-coverage.py --strict --base origin/main`) exits 1 with "Uncovered: 7" naming exactly those files. The checker has no exemption or allowlist mechanism: its only advice is "Add e2e/flows/*.yaml covers: entries or rerun without --strict". Co-Authored-By: Claude Opus 5 <[email protected]>
Three defects in the typed lane's closing-question path, all in what the parser lets through after the delimiter. The tail validator documented a multi-sentence rejection it never implemented, so "Who else was there? What did they decide?" passed every other bound and became one chip carrying two prompts. Reject an internal sentence or question terminator; the period arm only fires on a real sentence boundary, so "3.5" and "10 a.m. standup" stay legal. A turn that timed out or failed part-way through the marker leaves residue like "<<<FOLL" at the end of the model output. `split_followup_tail` finds no complete delimiter, so it returned the text untouched and the router persisted the fragment into the transcript — against the function's own promise that a half-formed tail never leaks. Strip a trailing partial delimiter of two or more characters; a lone "<" is far likelier to be real text. Backend-authored text that ends a turn — a safety-guard stop, a provider apology, a refusal — is appended after the model has already written its marker, where the parser drops it with the rest of the tail. The user was left with a partial answer, no reason for it, and a chip inviting them one hop further into a turn that never finished. `_put_outcome_text` voids the pending marker first, so the outcome message stays in the persisted answer and the stopped turn offers no chip. A guard stop remains a deliberate reply rather than a producer failure, which is the contract the terminal-exit table in test_chat_agent_provider_retry.py pins. Co-Authored-By: Claude Opus 5 <[email protected]>
The desktop adapter (ChatFirstBlockValidation.swift) converts a
`memoryReviewCard` for the chat-first journaling endpoint, but the
server-side block union had no such member, so every such request was
rejected as `invalid_request` and the card was never journaled.
Add `MemoryReviewCardSpec` to `ChatFirstBlockSpec` in the shape the Swift
adapter actually emits — `summary_id`, `date`, and `items` of
`{memory_id, content, category}` — and to `_entity_available`, following
`MemoryLinkSpec`: every row is a claim the owner can accept or correct in
place, so the card is admissible only while each row is a memory this
account still owns. Without that branch the new member would fall through
to the question-card arm and raise on a missing `subject`, turning a
rejection into a 500.
`summary_id`, `date` and `category` accept an empty string because the
adapter substitutes one when the source block carried none; rejecting the
whole card over a blank provenance field would journal nothing at all.
`items` is bounded at 8 against a generator that selects three, which caps
the entity reads one card costs. The legacy v1 union is deliberately left
alone.
Co-Authored-By: Claude Opus 5 <[email protected]>
…g agree with what they show Review findings on the daily-summary review card and the Home knows-list, each verified against the code path before changing anything. Review card - A vote made here never reached the local mirror the desktop reads memories from, so the row read "unreviewed" again the next time the card was built. The edit path already mirrors its content for exactly this reason; review now does the same. The backend is still the only writer of `user_review` — this records what that write accepted, it does not decide it. - `MemoryReviewStateReading` now throws. A failed mirror read was indistinguishable from "nobody voted", and it burned the once-per-mount flag, so every row stayed unreviewed for as long as the card was mounted. The attempt is marked only after a read succeeds, and a failed read sends no events at all. - The review section is keyed by its rows, not only by the summary id. A summary regenerated for the same day kept the old store alive: new memories never appeared and corrected ones kept text the record no longer contained. - A whitespace-only `memory_id` is trimmed at the wire and filtered by the card, so a row can never address a blank identifier. - `memories_learned` entries decode independently. One entry of the wrong shape discarded the entire array, hiding every valid row beside it; the outer `try?` still absorbs a payload that is not an array. Knows-list - `HomeKnowsRotationPolicy.availability` is the shared eligibility predicate. `openTaskCount` used to disagree with `compose` three ways — it counted a task id repeated across the overdue/today/no-due-date buckets once per bucket, counted a task more than 14 days past due that the list hides, and excluded a dismissed task whose text has since changed and which the list resurfaces — so "N things need you" could name rows that were not underneath it. Rotation state (show cap, same-day) deliberately still does not count. - `recordShown` clears `lastOpenedAt` when the content hash moves. A prior open belonged to the old text, and carrying it over exempted the new content from the show cap and the same-day rule permanently. - The once-per-visit de-duplication set is scoped to the effective owner. The ledger is owner-scoped at every read and write, but the visit set was not, and a question row is keyed by its text. - An insight row with no matching recommendation opens nothing, so it is no longer recorded as opened — that poisoned the rotation by exempting an unopened row from the cap. Each branch records only after its open happened. - Empty-slot telemetry is bounded to slots the rail could actually have shown; the chat strip renders three rows and was reporting over four. desktop/macos: swift build -c debug -> Build complete (66.58s); swift test over MemoryReviewCardTests, ChatDailySummaryTests, HomeKnowsComposerTests, HomeKnowsRotationPolicyTests, HomeKnowsImpressionStoreTests, HomeKnowsImpressionDefaultsTests -> 90 tests, 0 failures; swift-format lint clean on the changed files; swiftlint 0 violations in 1535 files. Co-Authored-By: Claude Opus 5 <[email protected]>
… contract The block the desktop adapter converts had no test in the chat-first suite: the union addition was verified by validating the adapter payload directly, which leaves nothing to catch a later contract edit that drops the variant. Two cases, both through the real validate endpoint: the exact adapter shape (including the empty-string summary_id/date substitutions the adapter makes when the source block carried no provenance) is admitted, and a card naming one memory this account does not own is rejected whole as entity_unavailable rather than admitted row by row. Co-Authored-By: Claude Opus 5 <[email protected]>
… origin arm from drifting Four defects around the grounded follow-up chip, all of the same shape: a rule written in one place and enforced in another. Failure copy was read aloud. The empty-response notice was rewritten to "Omi couldn't get an answer for that one." while FloatingBarVoicePlaybackService's shouldSpeak went on suppressing the retired sentence verbatim, so a voice query that produced nothing had its failure notice spoken. Both halves now come from FloatingBarAnswerFailureCopy — the window renders the constant, the guard suppresses everything in the type — so a copy edit cannot re-open the gap. The generic-chip filter diverged from the backend. isGeneric dropped any question whose lowercased probe merely had a prefix in a hand-written list, so "What else did Priya flag in that review?" was eaten on the client after the server had already built and sent it; symmetrically "Did that answer your question?" passed the client because only "does that answer" was listed. The filter is now utils/chat_followup.py's _GENERIC_PATTERNS verbatim, with the same word boundaries and the same end-anchor on "what else", and the trailing "?!. " strip now matches Python's rstrip rather than trimming both ends. The push-to-talk hint named one key of a chord. followUpVoiceHint rendered displayTokens.first, so a user bound to ⌃⌥ was told to hold ⌃ — a key that does not start voice. It joins every token, the way the sibling hold hint does. An armed question origin outlived a dispatch that never sent. questionOriginating is armed at the tap and consumed by the question event; openAIInputWithQuery returns early when there is no window, no provider, or the voice turn changed owner, and those paths emit nothing, so the arm survived and stamped `followup` on the next unrelated question — corrupting the one measurement the chip exists to produce. Each abort now calls questionOriginationAborted(). Not fixed here, and larger than reported: ChatFollowUpTail.strippingPendingTail is a one-way projection whose output ChatStreamingBuffer.appendTextSegment stores back as the accumulator it feeds in next flush. Once a flush contains the delimiter, the delimiter is gone from the only buffer left and every later token of the question streams into the visible prose. This cannot be fixed inside the projection; the caller must keep the raw accumulated answer. The precondition is now documented on the function, and a property test pins that no raw flush boundary can show a piece of the tail. Verified: swift build -c debug "Build complete! (35.25s)"; swift test --filter ChatFollowUpChipTests "Executed 19 tests, with 0 failures"; FloatingBarVoiceResponseSettingsTests 7/0, VoiceTurnOutputOwnershipTests 19/0, AgentPillLifecycleTests 83/0; swift-format lint exit=0; swiftlint "Found 0 violations, 0 serious in 6 files". Co-Authored-By: Claude Opus 5 <[email protected]>
`ChatStreamingBuffer.appendTextSegment` wrote the normalized projection back into `message.text` and then appended the next delta to it, so the projection was re-derived from what it had already withheld. `normalizeStreamingAssistantText` withholds the follow-up tail: the marker and the question after it must never appear as prose. Because the withheld text was gone from the only buffer by the next flush, the projection had no delimiter left to recognise and streamed the question out a token at a time. This is not an edge case around a split marker — a replay of every flush boundary leaks at every boundary from the delimiter onward, and the question always spans several 35ms flushes. It was display-only: the authoritative terminal answer overwrites the streamed text, so nothing wrong was persisted, but the reader saw the chip's question typed into the answer and then snatched away. The buffer now keeps the raw text per streaming message and per trailing text block, appends deltas to that, and only ever writes the projection outward. The accumulator is seeded from the message so a resumed turn keeps its prefix, and released when the authoritative answer lands or the turn is discarded, so the map does not outlive the turn and a reused id never resumes from a stale answer. Found by adversarial review of #12635. The reported symptom was the narrow split-marker case; the general one is above. Failure-Class: FC-projection-fed-its-own-output Co-Authored-By: Claude Opus 5 <[email protected]>
… claimed The `desktop-e2e-flow-coverage` gate is a text match on a flow's `covers:` list and never looks at its steps, so an earlier commit on this branch satisfied it by naming three follow-up-chip files in two flows that do not exercise them. 2e231d678a removed those entries, correctly, leaving the gate red. This adds the steps that make the claim true rather than restoring the text. Nothing about the chip was reachable from a flow before, for three reasons, each fixed here: - The hermetic stub had no path that emits `<<<FOLLOWUP>>>`. Its one steerable path, `exact_reply_token`, strips trailing non-alphanumerics and so cannot even produce the `?` a chip question requires. It now answers one trigger phrase with a grounded answer plus a real tail, with the delimiter imported from `utils.chat_followup` so the two cannot drift. - `main_chat_snapshot` exposed no field that could show a chip. `last_assistant_follow_up_question` projects the block, and the flow asserts it alongside `last_assistant_text` by exact equality — the absence of the question from the prose is the valuable half, and only exact equality catches a split that failed. - Nothing could tap the chip. `tap_chat_follow_up_chip` performs the chip's own send and reports the `origin` the `question_asked` emit carried; `origin` is consumed inside that emit and is unreadable afterwards, so it is observed at the seam rather than guessed at. The tap itself moved out of `ChatBubble`'s closure into `FollowUpChipTap` so the bridge is a second caller of the chip's send and never a second implementation of it. Restores `covers:` for ChatFollowUpTail, FollowUpChip, and AnalyticsManager+QuestionOrigin, each behind a step. `FollowUpChip` is the view, so it is asserted by an `ax.expect` that runs on the ui lane only; the flow says so where the entry is, and on the bridge lane S8 pins the block it renders from and S10 drives the send its button performs. Verified: `desktop-flow-lint.py` OK (74 flows, 188 actions); the coverage gate drops from 8 uncovered to 5; `swift build -c debug` clean; 21 ChatFollowUpChipTests pass including two new ones that pin the stub's exact wire shape and the new snapshot field; 10 test_desktop_llm_stub.py pass. The flow itself was NOT run — tier 2 needs `PROVIDER_MODE=offline make dev-up` and Docker is unavailable on this machine. The four Dashboard files and ChatStreamingBuffer stay uncovered on purpose; see the report for what each would need. Co-Authored-By: Claude Opus 5 <[email protected]>
`ChatStreamingBuffer` is uncovered and the follow-up tail added in the previous commit does stream through it, which makes it look like an obvious entry to add to this flow's `covers:`. It is not one. The projection's failure is display-only — the authoritative terminal answer overwrites the streamed text — so every assertion the harness can make after `wait_main_chat_idle` passes whether or not the question leaked into the prose token by token on the way there. Covering it needs an assertion during streaming, which no typed step can express. Written down so the next reader reaches that conclusion in a minute rather than adding an entry no step is behind. Co-Authored-By: Claude Opus 5 <[email protected]>
…b could not resume Seven defects on the scheduled daily-summary path, found in review of #12635. **The card was dead in production.** `_send_summary_notification` called `generate_comprehensive_daily_summary` without `memories_learned`, so the parameter kept its None default, `summary_data['memories_learned']` was always `[]`, `memory_review_card_block` always returned None, and the `memoryReviewCard` block was never attached on the only path real users receive. The /daily-summary-settings/test route selected correctly, which is why it looked shipped. Both senders now select through one helper, `learned_today.memories_learned_payload`, which keeps the module import-pure (the MemoryService import stays lazy, a7aba22). The existing test passed because its generator stub returned the refs regardless of what it was given; the stub now behaves like the real generator and echoes its parameter, so the test fails without the fix. **The resume checkpoint could never be read.** The cursor key carried the UTC hour, so the execution that exhausted its budget wrote `...T18` and the next one read `...T19`. The key is now stable and bounded by its TTL; `rotate_to` already prevents a carried-over cursor from starving a fresh cohort, because a run walks the whole rotated list rather than a suffix. **A partial user read finished as if it were complete.** A dropped timezone chunk was logged and skipped while the caller went on to clear the checkpoint, retiring users the job never even listed. `_get_users_for_daily_summary` now returns `(users, every_chunk_read)`; the chunks that did read are still served, the run just stops calling itself complete. **An oversized card would have killed the whole notification.** FCM rejects a message whose data payload exceeds 4KB, and it rejects it entirely, so several kilobytes of memory text would have silently dropped the recap. The encoded blocks are now bounded and dropped if they do not fit: losing the card costs a render, losing the message costs the recap. **Day attribution ignored most of the evidence.** `memory_item_to_memorydb` overwrites `MemoryDB.conversation_id` once per conversation-sourced evidence row, so a memory supported by two conversations keeps only the last one and a memory genuinely produced by one of today's conversations was rejected. `_from_day` now matches any conversation evidence, the way `MemoryService.retract_conversation_memories` already does. **The memory scan assumed created_at ordering.** `MemoryService.read` orders by updated_at, so a bulk touch can push more than one page of older rows in front of the summarised day and empty the card. The read now pages, capped at three pages and stopping at the first short page, so the common user still costs exactly one read. Resolving the reader is also fail-open now: the lazy MemoryService import used to propagate and cost the whole recap. Also: a nonpositive `DAILY_SUMMARY_MAX_HISTORY_CHARS` returned the entire day, removing the only bound protecting the prompt from the context overflow the bound exists for — it now falls back to the bound. A conversation that fails to render is dropped and counted rather than kept at zero cost, which only moved the failure into the summary render; if *every* render fails the fault is the renderer, not the day, so the material is handed over unchanged rather than turning a renderer bug into a silently missing recap. The ARCHITECTURE.md row claiming `daily_summary_budget.py` does no I/O is corrected: its cursor helpers do synchronous Redis I/O and require executor offloading. Verified: `BACKEND_UNIT_TEST_FILE_LIST=<8 files> bash test.sh` in backend/ — 1 + 2 + 21 + 6 + 3 + 16 + 29 + 6 passed, no failures; slowest test 0.11s CPU against the 0.30s guard. Co-Authored-By: Claude Opus 5 <[email protected]>
…e contract Three integration fixes after the review-fix agents landed. The memoryReviewCard was added to ChatFirstBlockSpec, which types both the journaling request and the materialization response, so it appeared as a new branch of a released response union: check_app_client_openapi_compatibility called it breaking, and it is. The server never emits this block — the desktop daily-summary card authors it and journals it back — so the request now takes a wider ChatFirstJournalBlockSpec and the response union is unchanged. The users router kept its own copy of the learned-memory selection while the scheduled job moved to the shared helper; it now delegates, so the two senders cannot drift into different definitions of "learned today". test_daily_summary_empty_overview drove the real scheduled send with no memory read stubbed, so once that path selected memories it issued a live Firestore query from a unit test and hung locally under api_core's retry. Co-Authored-By: Claude Opus 5 <[email protected]>
The `desktop-e2e-flow-coverage` gate is a text match on a flow's `covers:` list
and never looks at its steps, so an earlier commit satisfied it by naming the
review-card files in flows that do not exercise them. 2e231d678a removed those
entries, correctly. This adds the steps that make the claim true, the same way
15c1da877e did for the follow-up chip.
Nothing about the card was reachable from a flow before, for three reasons,
each fixed here:
- The rows render only from a daily summary's `memories_learned`, and the only
producer of that record is the nightly job — a day of conversations and a
model call. A hermetic bundle can never reach one, so the card, the row state
machine, both mutations, and the verdict read-back were all unreachable.
`POST /v1/dev-harness/daily-summary/seed` writes the record the job would have
written and nothing else. Local/offline only, by the same stage boundary as
the Chat-first E2E fixture: `main.py` does not register the router elsewhere
and the handler repeats the check.
- It deliberately does not mint memories. The flow creates those through the
production `POST /v3/memories`, so the ids the summary carries address rows
that `/v3/memories/{id}/review` really mutates. A fixture that minted its own
would prove the card can render and prove nothing about whether a vote lands.
- Nothing could reach a mounted card. `MemoryReviewSection` owns its store as a
`@StateObject` built at init, with no registry, so a flow could watch a card
appear and still not read which rows it bound. `MemoryReviewCardRegistry` is
that handle — weak, and gated to non-production, so on a shipped bundle
`register` does nothing and `mounted` is always nil. `memory_review_vote`
therefore calls the same `MemoryReviewCardStore.send` the ✓ / ✗ buttons call,
and is a second caller of the row machine rather than a second copy of it.
`memory-review.yaml` (tier 2) seeds four memories, asserts the wire carried four
and the card bound three — `MemoryReviewSection.maxRows`, made observable by a
count added to `daily_summary_snapshot`, still shape-only — then accepts row 0
and rejects row 1 and pins the settled verdict, the copy under it, the faded
state, and no inline error. S9 re-reads afterwards: each mutation ends in
`refreshLiveState`, the local memory mirror routinely lags the write it is asked
to confirm, and a row that flickered back to "unreviewed" reads as the vote not
landing. `edit` is deliberately not drivable: its draft lives in the row view's
own `@State`, and driving it from the bridge would be a second implementation of
`commitEdit` rather than a second call of it.
Restores `covers:` for MemoryReviewCard and MemoryReviewRowView, each behind a
step. `MemoryReviewRowView` also holds the section, whose bound S4/S6 assert;
the row *view* is asserted by S10's `ax.expect`, which runs on the ui lane only,
and the flow says so where the entry is.
Verified: `desktop-flow-lint.py` OK (75 flows, 191 actions); the coverage gate
drops from 5 uncovered to 3, with both review-card files COVERED and only the
knows-list pair and the deliberately-excluded ChatStreamingBuffer left; `swift
build -c debug` clean; 36 MemoryReviewCardTests pass including seven new ones
that pin the registry's identity check, the production no-op, the fixture wire
shape in both directions, and the exact row projection the flow asserts; 7 new
test_daily_summary_e2e_fixture.py pass plus 29 in the three neighbouring
daily-summary suites; swift-format, SwiftLint, the SwiftLint baseline,
check_desktop_test_quality, brand-ui, backend import-purity, module-isolation,
async-blockers and route-policy-baseline all clean. The endpoint is
`include_in_schema=False`, so no OpenAPI client regeneration.
The flow itself was NOT run: tier 2 needs `PROVIDER_MODE=offline make dev-up`
and the Docker daemon is not running on this machine.
Co-Authored-By: Claude Opus 5 <[email protected]>
The `desktop-e2e-flow-coverage` gate is a text match on a flow's `covers:` list and never looks at its steps, so an earlier commit satisfied it by naming the knows-list files in flows that do not exercise them. 2e231d678a removed those entries, correctly. This adds the steps that make the claim true, the same way 15c1da877e did for the follow-up chip and 1bdf0d0fff for the review card. Nothing about the rotation was reachable from a flow before, for three reasons, each fixed here: - The composed rows live in `DashboardPage`'s computed state and are published nowhere: the composition, the slots it held back, and the visit-start ledger all exist for one `body` evaluation and are gone. A flow could watch the hub render and still not read which rows it bound, or open one without the cursor. `HomeKnowsAutomationRegistry` is that handle, gated to non-production the same way `MemoryReviewCardRegistry` is, and every closure behind it is one of the page's own functions — `beginKnowsVisit`, `recordKnowsImpressions`, `openKnowsRow`, the dismiss handler the row's ✕ invokes. The bridge is a second caller of the rotation code and never a second rotation policy. - `AnalyticsManager+HomeKnows` had no capture seam at all: both emits went straight to PostHog, and `rotated_out_reason` — the rotation policy's only named verdict — is consumed inside the emit and unreadable afterwards. `homeKnowsTelemetryCaptureForTests` is that seam, in the style of `questionTelemetryCaptureForTests`. It is `static` on the extension rather than a stored property on `AnalyticsManager` because the manager is a 1,600-line file this event has nothing else to do with, and the isolation is identical. - The ledger is UserDefaults-backed and deliberately outlives the app, so a second run of any flow would open on rows the first run had already same-day-suppressed — and would read a correct suppression as a composer that had stopped producing rows. `home_knows_reset` gives it a known state through the same persistence the mutations use. `home-knows-rotation.yaml` (tier 2) seeds three tasks through `TasksStore`'s own create path, clears the ledger, and then proves what each visit does to the next one: S6 pins the first visit's two task rows and the `shows_before: 0` both slots emitted, S7 re-runs the reporting inside the same visit and asserts it emitted nothing (`reportedThisVisit`, and the reason the seven-second rotation timer does not burn the show cap), S9 and S10 drive `recordDismissed` and `recordOpened`, and S13-S15 take a fresh visit and re-read: the dismissed row is out and the row that was merely shown today is out with its count still at 1. Rows are addressed by their text, never by slot index. Which slot a row lands in depends on every other task, insight and suggestion the signed-in account carries; whether *this* row is on screen and what the ledger says about it are facts about that row alone. That is also why `trackHomeKnowsSlotEmpty` is not asserted and the flow says so where the `covers:` entry is: an empty slot needs the fixture to own the whole pool for that slot, and a flow that emptied the account to make that true would delete the reader's tasks on a dev bundle. `HomeKnowsRotationReason` is still covered — `dismissed` and `same_day` are asserted through their effect on the list rather than through the emit. Also found and not fixed: `HomeKnowsRotationPolicy.stalePastDueGrace` (14 days) cannot fire for a hub row. `TasksStore.loadDashboardTasks` builds `overdueTasks` with `dueDateAfter: sevenDaysAgo`, so a task more than a week past due never becomes a candidate and the 14-day rule never sees one. It stays unit-tested (`testTaskMoreThanFourteenDaysPastDueIsExcluded`) and is left alone here. `DashboardPage.swift` grows 4278 -> 4328; its `Line-Count-Exception` needs to become `4186 -> 4328`. Verified: `desktop-flow-lint.py` OK (76 flows, 200 actions); the coverage gate goes from 3 uncovered to 0 with both knows-list files COVERED; `swift build -c debug` clean; 7 new tests pass (registry gate, the token-checked unregister, `resetForAutomation`, and both emits read at the seam) alongside the 52 existing HomeKnows tests; swift-format lint-scope, SwiftLint (0 violations, 1536 files), the SwiftLint baseline, check_desktop_test_quality and check-main-actor-xctest-hooks all clean. The flow itself was NOT run: tier 2 needs `PROVIDER_MODE=offline make dev-up` and `docker info` fails on this machine. Co-Authored-By: Claude Opus 5 <[email protected]>
1311fa9472 wrote down that `ChatStreamingBuffer` was not coverable here, and it was right about the part it argued: the authoritative terminal answer overwrites the streamed text, so every assertion available after `wait_main_chat_idle` passes whether or not the chip's question was typed into the prose a token at a time on the way there. It gave up one step early. The property that matters is not a fact about the last frame — it is a fact about the run: no intermediate projection the reader ever saw contained the withheld tail. That is observable if the buffer records it as it emits. `ChatStreamingTailProbe` records exactly that, and is nil on any bundle the automation bridge is not enabled on, so the shipped projection and the shipped allocation are unchanged. It keeps its own raw stream — seeded once from the message, extended with the deltas the buffer is handed — and calls the shipped `ChatFollowUpTail.strippingPendingTail` on it. Keeping its own stream is the whole point rather than an implementation detail: the defect c164760b6b fixed was the buffer re-deriving each projection from its own withheld output, and a probe that read the buffer's accumulator would have agreed with the bug. Two projections of the same raw text differ only by the sentence-spacing normalizer, which inserts whitespace and never deletes a character, so the comparison is on non-whitespace content and is exact rather than a heuristic. `chat-hermetic.yaml` S8 already drives the one turn on this stack that carries a tail. It now asserts `streaming_tail_leaks: 0` beside the split it already pinned — and asserts `streaming_tail_delimiter_seen: true` and a non-zero projection count with it, because a turn that never produced a tail would otherwise report zero leaks and read as a pass. That is the difference between "the leak cannot be observed" and "the leak is asserted absent on every run". Restores `covers:` for ChatStreamingBuffer, behind those three expectations, and replaces the note that said it could not be done. Verified: `desktop-flow-lint.py` OK (76 flows, 200 actions); the coverage gate reports ChatStreamingBuffer COVERED by chat-hermetic; `swift build -c debug` clean; 3 new ChatStreamingTailProbeTests pass alongside the 3 existing projection tests — including a negative control that hands the probe the projection the pre-c164760b6b buffer emitted and asserts it is counted, so the zero above is falsifiable; swift-format lint-scope, SwiftLint, the SwiftLint baseline, check_desktop_test_quality and check-main-actor-xctest-hooks all clean. The flow itself was NOT run: tier 2 needs `PROVIDER_MODE=offline make dev-up` and `docker info` fails on this machine. Co-Authored-By: Claude Opus 5 <[email protected]>
… call Both files load the notifications job with fresh module imports, and the job now imports learned_today, which builds the pydantic models in models.daily_summary_payload. That build landed inside the call phase, which is the only phase the fast-unit CPU duration guard measures, and pushed test_daily_summary_db_failure_remains_fail_soft over the 0.30s limit. The same tests pass on origin/main, so this is a regression this branch introduced. Importing the module at collection time pays the build once, before the guard is measuring. Production code is untouched: moving the job's import into the function only relocated the cost into whichever test drove that path, and making learned_today's fallback reporter lazy broke a test that patches that symbol. Verified with four consecutive runs of the five neighbouring daily-summary files, including one at load average 61, with no duration-guard failures. Co-Authored-By: Claude Opus 5 <[email protected]>
The class this PR's streaming fix belongs to had no definition. A projection that may withhold part of its input must be applied to the accumulated raw input every pass; storing its output back into the only buffer and extending that buffer destroys the evidence the projection needs, so whatever it withheld once leaks on a later pass. The guard surface is the boundary-replay test: the same input broken at every possible flush boundary, asserting the withheld content appears in no intermediate output. That is what turned a reported split-marker edge case into the general defect it actually was. Co-Authored-By: Claude Opus 5 <[email protected]>
These fixes correct features that are still unreleased and already described by the 20260902 fragments. The promises there do not change; this PR makes them true. Co-Authored-By: Claude Opus 5 <[email protected]>
285df03 to
e39b291
Compare
Summary
Follow-up to #12635, which merged before this review round landed. Everything
here is a fix to what that PR shipped, found by adversarial review of it and
verified against the code path before being changed.
Three of these are defects that make shipped code wrong today on
main:daily-summary job called the summary generator without
memories_learned, sothe field was always empty, so the
memoryReviewCardblock was never attachedon the only path real users receive. Only the
/daily-summary-settings/testroute passed it. Both senders now select through one shared helper, and a test
fails without the fix.
empty-response copy while
FloatingBarVoicePlaybackService.shouldSpeakstillsuppressed one exact hardcoded string, which no longer exists in the tree. Copy
and guard now share one source, pinned by a test that drives the real playback
path rather than the string compare.
converts a
memoryReviewCardfor the chat-first journal, but the block was notin the server union, so every such request failed validation as
invalid_requestand the card was never journaled. Added to the requestunion only: the server never emits this block, and adding it to the
materialization response union is a breaking change to a released app-client
contract (
check_app_client_openapi_compatibilityconfirms both directions).Two more undercut claims #12635 itself made:
UTC hour, so the run that wrote the tail and the run that should have resumed it
never shared a key — which defeats the point of the Daily summaries silently stop for tail-of-batch users: notifications-job 600s timeout + one-user context overflow aborts whole hour groups #12530 fix. A failed
timezone chunk also let the run call itself complete and clear the cursor.
was not mirrored locally, so the row reverted to unreviewed on the next card
build. Now mirrored through existing storage, with the backend still the only
writer.
And one the review only half-saw:
ChatStreamingBufferwrote the normalized projection back into the message and appended the next
delta to it, so a projection that deliberately withholds the tail lost the
evidence it needed on the next flush. A replay of every flush boundary leaks at
every boundary from the delimiter onward, not only at a split marker, and the
question always spans several flushes. Display-only, since the authoritative
answer overwrites it, but the reader watched the chip's question get typed into
the answer and then snatched away.
Also fixed: multi-question chips, chips on guard-stopped turns, generic-prefix
rules that diverged between client and server, a permanent optimistic override on
mobile, a duplicated question when a follow-up block had no prose, per-item
decoding so one malformed row cannot drop the whole array, owner-scoped knows-list
visits, a content-change reset that skipped the show cap, and greeting counts that
disagreed with the rows they described.
Three findings were rejected with evidence rather than fixed: that the stream
filter persists its withheld suffix (the persisted answer is built by the
producer, and flushing would have pushed the fragment into the stream); that a
safety-guard stop should be reclassified as a provider failure (an explicit,
tested contract says a guard stop is a deliberate reply); and a pytest marker that
would have removed a file from CI entirely.
End-to-end coverage: made real
#12635 satisfied
desktop-e2e-flow-coverageby addingcovers:entries to twoflows that never exercise the code. The gate is a text match over the
covers:list and never inspects steps, so the claim cost nothing to write and gave false
confidence that these modules were end-to-end covered. Those entries are removed
here and the coverage is built instead:
automation snapshot exposes the chip question, and a bridge action taps the chip
and reports the origin the analytics emit actually carried. The flow asserts the
visible answer by exact equality, which is what catches a tail left in the prose.
memory-review.yaml). A local-only dev-harness routeseeds a summary, the flow creates the memories through the production endpoint,
renders the card, accepts one row and rejects another through the same store the
buttons call, then re-reads to prove both verdicts survive the refresh.
home-knows-rotation.yaml). Seeds tasks, clears theledger through the same persistence the mutations use, and pins the first visit's
rows, the within-visit de-duplication, and a later visit's view of a dismissed row
and a merely-shown row.
mid-stream and the terminal answer overwrites the streamed text before any
assertion runs. True of the final text only: a non-prod probe now keeps its own
raw stream, compares every emitted projection against the shipped tail-stripping
rule, and the flow asserts zero leaks alongside two liveness assertions so the
zero cannot be vacuous. A negative-control unit test feeds the probe the exact
projection the pre-fix buffer emitted and asserts it is counted.
Three things are deliberately not claimed, each stated next to its
covers:entry: the empty-slot telemetry, the three-show cap (it needs three calendar days
or an injected clock, and is unit-tested instead), and the 14-day stale-task rule,
which is unreachable from the hub because the dashboard query already cuts off at
seven days. That last one is a real finding and wants a follow-up.
Invariants
MemoryService; the local mirror carries no second copy of review state and the backend remains the only writer.Product invariants affected
Failure class
Failure-Class: new
This PR adds one definition,
FC-projection-fed-its-own-output:ChatStreamingBufferre-derived its output fromits own previous output, so a projection that withholds text destroyed the
evidence it needed on the next pass. The protocol allows one declaration per body;
the others are recorded here for the reader.
Line-count exceptions
Line-Count-Exception: backend/utils/retrieval/agentic.py | 1718 -> 1736 | outcome-text helper voids a pending marker at the five backend-authored sites
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarView.swift | 3107 -> 3112 | chord-aware push-to-talk hint
Line-Count-Exception: desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift | 5740 -> 5752 | failure copy moved to a shared constant the voice guard also reads
Line-Count-Exception: desktop/macos/Desktop/Sources/MainWindow/Pages/DashboardPage.swift | 4268 -> 4328 | per-branch open recording plus the non-prod knows automation registry
Line-Count-Exception: desktop/macos/Desktop/Sources/Providers/ChatProvider.swift | 7210 -> 7212 | the streaming buffer's raw accumulator is released when the terminal answer lands
Verification
make preflight: all 39 checks pass, includingdesktop-e2e-flow-coverageat 0 uncovered.test.sh(viaBACKEND_UNIT_TEST_FILE_LIST, since positional paths are ignored) green under the CPU duration guard, including four consecutive runs of the daily-summary files at load average 61.check_app_client_openapi_compatibilitypasses; all four generated clients are--checkclean.swift build -c debuggreen; the follow-up, review-card, knows-list, and streaming-probe suites pass; swift-format, SwiftLint, the baseline ratchet, test-quality, and the main-actor hook check are clean.app/test.shall passed;dart formatclean.Not done here
docker infofails on the authoring machine. Both sides of every string they assert are pinned by unit tests so drift fails in seconds, and the streaming probe has a falsifiable negative control, but someone with Docker must runchat-hermetic,memory-review, andhome-knows-rotationbefore they are trusted. Two knows-list expectations rest on a reading of the composer's slot ordering that only a real run can confirm.🤖 Generated with Claude Code