Skip to content

fix(windows): route an empty complete JIT watchlist to the ambient lane - #13277

Merged
Git-on-my-level merged 2 commits into
mainfrom
jit/windows-empty-watchlist
Sep 9, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
jit/windows-empty-watchlist

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

What changed and why

Parity register item 5. Since #12549 (owner decision 2026-09-01) macOS hands a complete empty watchlist to the bounded ambient lane — an account with no standing trigger must not go silent, and no Beta user has ever created a standing trigger. Windows still evaluated an empty complete watchlist to none and suppressed empty_watchlist, so on the Windows client every JIT-admitted account without a trigger produced no ambient candidate at all (the Aug 13–14 "went silent fleet-wide" class, one layer up).

  • evaluateJitWatchlist (desktop/windows/src/shared/jitTriggerRuntime.ts): an empty complete watchlist now returns ambient_fallback, exactly like a non-empty watchlist with no match. Inactive / unauthorized authority still returns none.
  • JitRuntime.admit (desktop/windows/src/main/jit/jitRuntime.ts): the empty_watchlist reason is retired; the empty case surfaces as no_eligible_planned_trigger, the one planned outcome WindowsJitAssistant already hands to admitAmbient — so ambient spend stays behind the same local gate, context cooldown, server nano reservation, and daily caps as today.
  • contracts/parity/README.md: item 5 is recorded as routing converged; ambient pacing missing on Windows — see "What this PR does not claim" below.

No backend, wire, flag, or macOS change. The Windows client floor for a Windows cohort remains unmet (#12381/#12391/#12397, the budget-day gap, and the ambient pacing gap below); this PR converges one behaviour, it does not activate anything.

What this PR does not claim

Adversarial review of the first revision caught the parity register claiming full convergence for item 5 when only the routing converged. What the two platforms then spend in the ambient lane still differs, and the register now says so:

  • No ambient pacing on Windows. macOS gates every ambient nano spend on JITAmbientPacingPolicy (burst 2, then one per activeDaySeconds / budget — two hours at the default eight — with 2 triages reserved for derived-intent matches), reached from JITProactivityRuntime.swift:640-670. Windows admitAmbient calls claimJitWakeup with budget: null and has no pacing at all, so the whole daily allowance can burn in the first minutes after local midnight — the exact failure measured on the owner account 2026-08-30/31 that produced the macOS policy.
  • No ambient_server_denied backoff, and no local per-day nano usage read before spend (macOS readAmbientNanoUsage).
  • The ambient context cooldown keys on an OCR-derived semantic fingerprint (WindowsJitAssistant.analyze hashes app + window title + OCR text), so a context whose text keeps changing mints a new fingerprint each frame and reserveProactivity RPCs are unbounded per settled context — they continue after the server answers reserved: false. Pre-existing, not introduced here; it is what makes the missing pacing cost real money.

All four are listed in contracts/parity/README.md item 5 under the JIT client floor (decision 19), next to the existing budget-day gap, and are in the cut list below. They gate a Windows cohort, not this routing change: with no Windows cohort admitted, the unpaced lane is not reachable in production today.

empty_watchlist is also no longer produced on either platform. The macOS PostHog reason allowlist (ProactiveLaneClient.swift:782) still lists it; that entry is now dead and stays until the next macOS PR — a Swift-only edit costs hours of macOS CI for a dead string and is deliberately not bundled here.

Product invariants affected

none

How it was verified

  • desktop/windows: pnpm@10 exec vitest run src/shared/jitTriggerRuntime.test.ts src/main/jit/jitRuntime.test.ts src/main/jit/jitAssistantDelivery.test.ts src/main/jit/jitAssistant.test.ts → 38 passed (node 22.23.2, pnpm 10.34.5, frozen lockfile).
  • prettier --check, eslint (0 errors), tsc --noEmit -p tsconfig.node.json --composite false clean.
  • Negative check on the new end-to-end case: restoring the old triggers.length === 0 → 'none' line in jitTriggerRuntime.ts fails reaches the ambient lane and buys exactly the nano reservation and leaves the other 11 delivery cases passing.
  • Not verified: a delivered ambient notification on a Windows build (no Windows release build newer than 2026-08-20 exists; the client floor is separately unmet).

Tests

  • jitTriggerRuntime.test.ts › hands a complete empty watchlist to the ambient fallback instead of going silent — drives the real evaluator for empty-complete, non-empty-miss, and inactive authority.
  • jitRuntime.test.ts › routes a complete empty watchlist to the ambient fallback like any planned miss — the runtime admission surface (no_eligible_planned_trigger, legacy Insight still suppressed).
  • jitAssistantDelivery.test.ts › empty complete watchlist, real runtime through analyze — the seam the other cases fake. Builds the REAL WindowsJitRuntime (only the authority client and an in-memory sqlite db supplied) and calls WindowsJitAssistant.analyze: an empty complete snapshot reaches the ambient lane and buys exactly one nano_triage reservation; an incomplete snapshot buys nothing.
  • jitAssistantDelivery.test.ts › does not admit ambient on a suppression reason it does not own — keeps the guard that only no_eligible_planned_trigger reaches admitAmbient.

Automatic-or-dead check

The evaluator, runtime, and end-to-end tests each fail if the platform-specific suppression returns; the end-to-end one fails even if the regression is inside WindowsJitRuntime.admit rather than the evaluator. grep -rn "reason: 'empty_watchlist'" desktop/windows/src is empty (the string survives only in one explanatory test comment), and the parity register entry names both the converged routing and the still-divergent pacing.

Cut list

  • Windows ambient pacing parity (JITAmbientPacingPolicy analogue), the ambient_server_denied backoff, and the local per-day nano usage read: separate PR, they change admitAmbient's spend decision.
  • The OCR-keyed ambient context cooldown (unbounded reserveProactivity per settled context): separate PR, it changes the fingerprint contract in WindowsJitAssistant.analyze.
  • Windows local budget day → server budget_timezone (the fix(jit): align desktop pacing with the server budget timezone #12798 analogue): separate PR, it touches the reservation client and JitAssistant.localBudgetDay.
  • The dead empty_watchlist entry in the macOS PostHog reason allowlist: next macOS PR.

Failure-Class: none

🤖 Generated with Claude Code

Parity register item 5: since #12549 macOS hands a complete *empty* watchlist to
the bounded ambient lane (owner decision 2026-09-01: an account with no standing
trigger must not go silent). Windows still evaluated it to `none` and suppressed
`empty_watchlist`, so on the Windows client every JIT-admitted account without a
trigger produced no ambient candidate at all.

`evaluateJitWatchlist` now returns `ambient_fallback` for an empty complete
watchlist exactly like a non-empty watchlist with no match, `JitRuntime.admit`
surfaces it as `no_eligible_planned_trigger` (the one planned outcome
`WindowsJitAssistant` hands to `admitAmbient`), and the `empty_watchlist`
reason is retired. Inactive/unauthorized authority still evaluates to `none`.
The register entry is marked converged; the Windows local-budget-day gap
(macOS #12798) stays listed under the JIT client floor.

Failure-Class: none

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@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.

No issues found across 7 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

…e ambient pacing gap

Adversarial review of this PR found that the routing change is correct but the
parity claim was not. Two changes, no behaviour change:

- `contracts/parity/README.md`: item 5 is no longer marked converged. macOS
  bounds its ambient lane with `JITAmbientPacingPolicy` (burst 2, then one per
  two hours, 2 triages reserved for derived intent), an `ambient_server_denied`
  backoff, and a local per-day nano usage read before spend; Windows
  `admitAmbient` has none of these (`claimJitWakeup` is called with
  `budget: null`). The entry now reads "routing converged; ambient pacing
  missing on Windows" and lists the four remaining gaps — pacing, denial
  backoff, local usage read, and the OCR-keyed ambient context cooldown that
  makes `reserveProactivity` unbounded per settled context — next to the
  existing budget-day gap under the JIT client floor (decision 19).
- `jitAssistantDelivery.test.ts`: the four existing ambient cases all fake the
  runtime, so a regression inside `WindowsJitRuntime.admit` would pass them.
  Adds two cases that drive the REAL runtime (only the authority client and an
  in-memory sqlite db are supplied) through `WindowsJitAssistant.analyze` over
  a complete empty snapshot: one asserts the ambient lane is reached and buys
  exactly the single `nano_triage` reservation, one asserts an INCOMPLETE
  snapshot still buys nothing. Reverting the `jitTriggerRuntime.ts` routing
  line fails the first and leaves the second passing.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit e0308b6 into main Sep 9, 2026
32 checks passed
@Git-on-my-level
Git-on-my-level deleted the jit/windows-empty-watchlist branch September 9, 2026 08:36
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