Skip to content

fix(desktop): Hide-for-2h keeps notifications; Maximum level nudges in ~10s with 30s repeats; unsilence suggestions from the buckets flag - #11553

Merged
kodjima33 merged 4 commits into
mainfrom
kodjima33/hide-bar-keep-notifications
Aug 14, 2026
Merged

kodjima33 merged 4 commits into
mainfrom
kodjima33/hide-bar-keep-notifications

Conversation

@kodjima33

@kodjima33 kodjima33 commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

What

Four verified fixes/features for proactive notifications, driven by tonight's live debugging with Nik:

  1. "Hide for 2 hours" hides the bar without muting notifications (was "Disable for 2 hours"). One right-click before a movie silently suppressed every proactive notification for two hours (root-caused from omi.log: 9 snoozed suppressions in one movie hour). The hide state is structurally removed from every delivery gate — sendNotification, showNotification, ContextDeliveryGateInput, TaskInterruptionEnvironment, SuggestionGatePolicy no longer accept a snoozed input (compiler-enforced). Cards present via the existing temp-show path over the hidden bar.
  2. Re-hide after temp-show: hide keeps isEnabled == true, so the re-hide in dismissNotificationAndAdvanceQueue must also arm on the hidden state — otherwise the first nudge brought the bar back for the rest of the window (peer-review finding).
  3. Maximum = fast demo mode: 10 s suggestion dwell + 10 s same-context frame cadence + 30 s between-nudge cooldown cap — all only at frequency level 5; Balanced and below keep 30 s dwell / 60 s cadence / configured cooldown. Assistant-side gates (grounding, daily budget) still bound spend.
  4. context_buckets flag no longer silences live suggestions — verbatim copy of the concurrent fix on kodjima33/buckets-starve-suggestions (credited in the commit): with the PostHog flag at 100%, SuggestionAssistant.isEnabled returned false on every fresh sign-in and focus nudges went silent fleet-wide; observed live on this account ("disabled" probe outcome at 02:24).

Product invariants

  • INV-CHAT-1 — path-matched (NotificationService.swift); transcript behavior unchanged, only the snooze suppression gate is removed.
  • INV-VOICE-1 — path-matched (FloatingControlBarWindow.swift, FloatingControlBarView.swift); voice-turn lifecycle untouched; bar-visibility policies still honor the hidden state for the bar itself.

Failure-Class: none

Line-Count-Exception: desktop/macos/Desktop/Sources/ProactiveAssistants/ProactiveAssistantsPlugin.swift | 1755 -> 1761 | the level-aware distribution fallback replaces a one-line constant with a documented computed property; the policy logic itself lives in ProactiveAssistantOrchestrationPolicy (tested there), only the 6-line accessor lands in the plugin

Verification (all live on named bundles, real signed-in account, Maximum level)

  • Hide keeps notifications: with floatingBar_snoozedUntil set 2 h ahead — the exact state that returned six consecutive snoozed probe outcomes on the previous build — probe_suggestion_nudge delivered AND spoke (01:24:18 log: Suggestion: delivering [90%]… → NotificationSpeech: speaking…).
  • ~10 s nudges at Maximum: gate re-checks observed every ~10–25 s on real app switches (previously ~60 s); organic delivery at 02:04:58 after settling in Warp.
  • 30 s cooldown: two real deliveries 76 s apart (02:25:02 organic → 02:26:18 probe) passed the gate where the old 180 s cooldown would have refused until 02:28; second pair 45 s apart on the next build (02:30:10 → 02:30:55). Policy test pins 30 s only at level 5.
  • Flag fix: before — probe outcome disabled on fresh sign-in with the flag at 100%; after — delivered.
  • Focused suites green across the branch: suggestion gate 14/14 (incl. new dwell + cooldown pins), orchestration policy (fallback-cadence pin), context delivery, task resurfacing, bar launch policy — 137+ tests, 0 failures.

Review in cubic

…ions

The floating bar's right-click action (was 'Disable for 2 hours') silently
suppressed every proactive notification for two hours — one click to get the
bar out of the way for a movie muted an hour of nudges at maximum frequency,
with nothing anywhere saying so.

Hiding is now a statement about the bar only:
- The menu item says what it does: 'Hide for 2 hours'.
- snooze() just hides the window and keeps the queue; cards present via the
  existing temp-show path over the hidden bar and it re-hides afterwards.
- The snooze/hide state is structurally removed from every delivery gate —
  sendNotification, showNotification, the context-director gate
  (ContextDeliveryGateInput), contextual task interruptions
  (TaskInterruptionEnvironment) and the suggestion gate (SuggestionGatePolicy)
  no longer take a snoozed input, so no future gate can quietly consult it.
- Dead .snoozed telemetry reasons removed with their writers; the Codable
  TaskInterruptionGateReason.snoozed case stays so old persisted traces decode.

Verified live on omi-ankara (this branch): with floatingBar_snoozedUntil set
2h ahead — the exact state that muted the movie hour and returned six straight
'snoozed' probe outcomes on the previous build — probe_suggestion_nudge
delivered and spoke a real-task nudge ('Suggestion: delivering [90%] …' →
'NotificationSpeech: speaking delivered notification (79 chars)'), visible in
the chat transcript. Affected suites: 137 tests, 0 failures.
At Maximum (level 5) the suggestion dwell drops to 10 s and the same-context
frame re-flush cadence drops to 10 s, so opening TikTok produces an eligible
evaluation ~10-13 s after the switch. Balanced and below keep the 30 s dwell
and 60 s cadence — ordinary use unchanged. Assistant-side gates (cooldown,
daily budget, grounding) still bound model spend at every level.

Also: a temp-shown notification now re-hides the bar when the hide window is
active — 'Hide for 2 hours' keeps isEnabled true, so the re-hide must also arm
on the hidden (snoozed) state or the first nudge would bring the bar back for
the rest of the window (parent-session review finding).

Policy tests: dwell and fallback cadence are 10 s ONLY at level 5.
The 180 s between-nudge cooldown made repeat demos impossible at Maximum —
the gate re-checked every ~10 s and refused with skippedCooldown for three
minutes after each delivery. Maximum now caps the cooldown at 30 s
(SuggestionGatePolicy.cooldown(base:frequencyLevel:)); every other level
keeps the user's configured value untouched. Policy test pins 30 s only at
level 5.
…ets flag

The buckets rollout gated SuggestionAssistant.isEnabled on
!ContextBucketsFeature.isEnabled; with the PostHog flag now at 100% the
assistant reported 'disabled' on every fresh sign-in and focus nudges went
silent fleet-wide (observed live on this account 02:24). Same hunk as the
concurrent fix on kodjima33/buckets-starve-suggestions (verbatim, so the
branches merge cleanly); credit to that session's diagnosis.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

4 issues found across 21 files

Confidence score: 3/5

  • In SuggestionAssistant.swift, lastEvaluationAt is set before evaluate, so long Gemini calls can effectively bypass the intended cooldown and trigger back-to-back evaluations when the call returns, increasing suggestion churn and API load—record the cooldown timestamp when presenting (or after completion) so elapsed call time doesn’t open an immediate re-run window.
  • In FloatingControlBarWindow.swift, a pre-existing six-second dismissal timer is not canceled on snooze, so an old timer can dismiss a newly shown card and incorrectly advance that queue state—cancel/reset any active card timer on snooze and when swapping cards to keep dismissal ownership aligned with the visible card.
  • desktop/macos/changelog/unreleased/20260814-maximum-level-fast-nudges.json and ContextDeliveryAuthority.swift are low-severity cleanup items, but they can still cause avoidable friction (changelog rule failure and dead snoozed gate reason path)—update the fragment prefix to an allowed verb and remove or rewire the unreachable enum case.
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/changelog/unreleased/20260814-maximum-level-fast-nudges.json">

<violation number="1" location="desktop/macos/changelog/unreleased/20260814-maximum-level-fast-nudges.json:2">
P3: The changelog fragment must start with "Fixed", "Added", "Improved", or "Changed", per the changelog fragment rules in AGENTS.md, but it currently begins with "At Maximum notification level". Change it to start with one of those verbs, e.g. "Changed: At Maximum notification level, nudges arrive within ~10 seconds ...".</violation>
</file>

<file name="desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/Suggestions/SuggestionAssistant.swift">

<violation number="1" location="desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/Suggestions/SuggestionAssistant.swift:152">
P2: When a Gemini call lasts more than 30 seconds, this permits the next evaluation immediately after the first returns because `lastEvaluationAt` was recorded before `evaluate`. Record the cooldown at presentation or enforce it in delivery; Maximum mode is otherwise unthrottled.</violation>
</file>

<file name="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift">

<violation number="1" location="desktop/macos/Desktop/Sources/FloatingControlBar/FloatingControlBarWindow.swift:2843">
P2: When the user snoozes while a card is visible, the card's existing six-second timer keeps running. If another card arrives before that timer fires, the old timer dismisses the new card and may advance its queue; cancel and replace the old timer, then flush the retained queue explicitly.</violation>
</file>

<file name="desktop/macos/Desktop/Sources/ProactiveAssistants/Core/ContextDeliveryAuthority.swift">

<violation number="1" location="desktop/macos/Desktop/Sources/ProactiveAssistants/Core/ContextDeliveryAuthority.swift:125">
P3: Removing the snooze branch from `freeGate` leaves the `ContextDeliveryGateReason.snoozed` case with no producer and no consumer; it is now unreachable. Since this enum is not persisted (unlike `TaskInterruptionGateReason`, which must retain `snoozed` for decoding historical gate traces), the orphaned case can be removed.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

now: now,
lastEvaluationAt: lastEvaluationAt,
cooldown: cooldown,
cooldown: SuggestionGatePolicy.cooldown(base: cooldown, frequencyLevel: frequencyLevel),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: When a Gemini call lasts more than 30 seconds, this permits the next evaluation immediately after the first returns because lastEvaluationAt was recorded before evaluate. Record the cooldown at presentation or enforce it in delivery; Maximum mode is otherwise unthrottled.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/ProactiveAssistants/Assistants/Suggestions/SuggestionAssistant.swift, line 152:

<comment>When a Gemini call lasts more than 30 seconds, this permits the next evaluation immediately after the first returns because `lastEvaluationAt` was recorded before `evaluate`. Record the cooldown at presentation or enforce it in delivery; Maximum mode is otherwise unthrottled.</comment>

<file context>
@@ -141,12 +147,11 @@ actor SuggestionAssistant: ProactiveAssistant {
       now: now,
       lastEvaluationAt: lastEvaluationAt,
-      cooldown: cooldown,
+      cooldown: SuggestionGatePolicy.cooldown(base: cooldown, frequencyLevel: frequencyLevel),
       dwell: dwell,
-      requiredDwell: Self.requiredDwell,
</file context>

}

/// Hide the bar and suppress notifications for the given duration.
/// Hide the bar for the given duration. This is a statement about the BAR only:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: When the user snoozes while a card is visible, the card's existing six-second timer keeps running. If another card arrives before that timer fires, the old timer dismisses the new card and may advance its queue; cancel and replace the old timer, then flush the retained queue explicitly.

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/FloatingControlBarWindow.swift, line 2843:

<comment>When the user snoozes while a card is visible, the card's existing six-second timer keeps running. If another card arrives before that timer fires, the old timer dismisses the new card and may advance its queue; cancel and replace the old timer, then flush the retained queue explicitly.</comment>

<file context>
@@ -2840,21 +2840,14 @@ class FloatingControlBarManager {
   }
 
-  /// Hide the bar and suppress notifications for the given duration.
+  /// Hide the bar for the given duration. This is a statement about the BAR only:
+  /// notifications keep flowing and present via the temp-show path (card pops over the
+  /// hidden bar, then the bar re-hides). It used to also drop the queue and gate all
</file context>

@@ -0,0 +1,3 @@
{
"change": "At Maximum notification level, nudges arrive within ~10 seconds of switching into an app and can repeat every 30 seconds; Balanced and below keep the usual pace"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The changelog fragment must start with "Fixed", "Added", "Improved", or "Changed", per the changelog fragment rules in AGENTS.md, but it currently begins with "At Maximum notification level". Change it to start with one of those verbs, e.g. "Changed: At Maximum notification level, nudges arrive within ~10 seconds ...".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/changelog/unreleased/20260814-maximum-level-fast-nudges.json, line 2:

<comment>The changelog fragment must start with "Fixed", "Added", "Improved", or "Changed", per the changelog fragment rules in AGENTS.md, but it currently begins with "At Maximum notification level". Change it to start with one of those verbs, e.g. "Changed: At Maximum notification level, nudges arrive within ~10 seconds ...".</comment>

<file context>
@@ -0,0 +1,3 @@
+{
+  "change": "At Maximum notification level, nudges arrive within ~10 seconds of switching into an app and can repeat every 30 seconds; Balanced and below keep the usual pace"
+}
</file context>

static func freeGate(input: ContextDeliveryGateInput) -> ContextDeliveryGateReason {
if !input.masterEnabled { return .masterDisabled }
if input.frequencyLevel == 0 { return .frequencyDisabled }
if input.snoozed { return .snoozed }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: Removing the snooze branch from freeGate leaves the ContextDeliveryGateReason.snoozed case with no producer and no consumer; it is now unreachable. Since this enum is not persisted (unlike TaskInterruptionGateReason, which must retain snoozed for decoding historical gate traces), the orphaned case can be removed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At desktop/macos/Desktop/Sources/ProactiveAssistants/Core/ContextDeliveryAuthority.swift, line 125:

<comment>Removing the snooze branch from `freeGate` leaves the `ContextDeliveryGateReason.snoozed` case with no producer and no consumer; it is now unreachable. Since this enum is not persisted (unlike `TaskInterruptionGateReason`, which must retain `snoozed` for decoding historical gate traces), the orphaned case can be removed.</comment>

<file context>
@@ -4,7 +4,6 @@ import Foundation
 struct ContextDeliveryGateInput: Equatable, Sendable {
   let masterEnabled: Bool
   let frequencyLevel: Int
-  let snoozed: Bool
   let paywalled: Bool
   let cooldownSeconds: TimeInterval
   let dailyLimit: Int
@@ -13,15 +12,13 @@ struct ContextDeliveryGateInput: Equatable, Sendable {
   init(
</file context>

@kodjima33
kodjima33 merged commit 2e1ad11 into main Aug 14, 2026
29 of 30 checks passed
@kodjima33
kodjima33 deleted the kodjima33/hide-bar-keep-notifications branch August 14, 2026 07:00
kodjima33 added a commit that referenced this pull request Aug 14, 2026
…cus-nudge cadence (+ context-buckets starvation fix) (#11562)

## What

Nik's demo spec for the **Maximum** notification level: open TikTok/X →
focus nudge in **<10 seconds**; keep the feed open → another nudge
**under every half minute**, indefinitely. This PR makes level 5 deliver
that, verified with 10 consecutive live trials on a real TikTok feed,
while every calmer level stays byte-identical (test-pinned).

Stacked on the context-buckets starvation fix (supersedes #11554 — same
commits included; that PR will be closed on merge).

`SuggestionPacing` is the single surface where Maximum may differ:
- dwell 4s (30s elsewhere), settle 2s (6s), cooldown capped 20s (180s),
confidence bar capped 0.65, dedup memory 0 (10 — the user asked to be
nagged repeatedly), daily evaluation budget 600 (40)
- context re-arms after an eligible evaluation (calm levels stay
one-shot per arrival)
- fresh context waives leftover cooldown (same-context repeats stay
paced; anchor-vs-lastEvaluation ordering makes this safe)
- capture: full frame every base heartbeat (no preview-similarity
skip/backoff), and the idle window extends to 300s — including inside
`ProactiveCaptureTrigger`'s own idle check (reviewer-caught bypass, now
with a behavioral test at idleSeconds=120)

Merged #11553's 10s-dwell/30s-cooldown values are superseded by this
newer spec; its hide/re-hide and no-snooze-gate behavior is preserved.
`SuggestionGatePolicy.requiredDwell/cooldown` now delegate to
`SuggestionPacing`.

## Product invariants

None matched (`scripts/pr-preflight --suggest`).

Failure-Class: none

## Verification

- Pinned-value tests: `SuggestionPacingTests` (Maximum values + every
calm level's 30/6/180/0.85/10/40 asserted level-by-level; caps never
raise user-configured values; idle-override behavioral test;
heartbeat/re-arm/waiver policy tests). Focused suites green; changed
#11553 expectations (10s→4s, 30s→20s) cite Nik's explicit spec: "receive
a notification almost immediately in <10 seconds… every <30 seconds".
- **Live 10-trial marathon** (omi-ankara from this branch, real
signed-in account, real TikTok feed window frontmost, Maximum): first
delivery per trial = 1.1, 7.2, 7.2, 2.1, 2.0, 1.0, 3.2, 7.3, 6.1, 1.1 s
— **10/10 under 10s**. Inter-delivery gaps while the feed stayed open:
27/28 under 30s (5–26s), one 49s gap from a single below-bar evaluation.
Up to 4 deliveries per 65s hold.
- `.cross-review-verify.png`: live floating-bar nudge card ("Suggested
by Omi …") captured seconds after delivery on this build.
- Earlier iterations' failures that shaped the design are in the commit
messages (one-shot context consume, preview-similarity starvation,
cooldown carry-over, trigger idle bypass).

Line-Count-Exception:
desktop/macos/Desktop/Sources/ProactiveAssistants/ProactiveAssistantsPlugin.swift
| 1761 -> 1773 | 12 lines wiring the level-aware idle threshold and
forced-heartbeat flag into the two capture-gate call sites; the policy
itself lives in SuggestionPacing (SuggestionModels.swift), splitting
these call sites out would separate a gate check from the loop that owns
it


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11562?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. -->
kodjima33 added a commit that referenced this pull request Aug 14, 2026
…etector (unblocks beta train) (#11565)

## What

Unblocks the desktop beta train. Every `desktop_auto_release` run since
06:38Z fails because Release Eligibility re-runs the line-count ratchet
on main commits **without** the merged PR's body exception (filed as
#11564) — so #11553's and #11556's legitimate, PR-lane-approved
exceptions poison eligibility on their merge commits and no candidate
can cut.

This folds #11556's 18 gate-site lines out of
`ProactiveAssistantsPlugin.swift` (1779 → 1767) into
`MediaPlaybackDetector`, where the exemption policy and cache already
live. A shrinking commit passes the ratchet statelessly, so eligibility
on this commit (and descendants) goes green and the hourly train cuts
again.

Behavior is identical: `effectiveIdleSeconds(hidIdleSeconds:threshold:)`
on the detector wraps the same pure policy and keeps the
once-per-episode log.

## Product invariants

None matched (path-based check: none).

## Verification

- Re-verified live on the rebuilt omi-notch bundle from this branch:
`05:01:29 CaptureGate: HID-idle but media playback active — capture
continues` with the user genuinely HID-idle 45 min and a real
`PreventUserIdleDisplaySleep` assertion held (screenshot in worktree).
- `MediaPlaybackIdleExemptionTests` 4/4 — adds
`testDetectorEffectiveIdleMatchesPolicy` proving the gate-facing wrapper
mirrors the pure policy.
- Debug build clean; pinned swift-format applied.


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11565?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. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant