Skip to content

fix(jit): align desktop pacing with the server budget timezone - #12798

Merged
Git-on-my-level merged 2 commits into
mainfrom
codex/jit-beta-proactivity-20260905
Sep 5, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
codex/jit-beta-proactivity-20260905

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Desktop JIT pacing used the Mac's timezone while the server charged reservations against the account profile's timezone. Around midnight, the client could read the wrong day's usage and repeatedly request work the server would deny.

Return the server's budget timezone/day in the trigger snapshot and use that timezone for local pacing. Refresh budget authority even when the ledger revision stays the same. Invalid timezones fail closed; older servers retain the existing fallback. Hard notification and model-call caps are unchanged, and this adds no model calls.

Validation: focused backend, Swift and OpenAPI tests; midnight/DST, malformed-timezone and same-revision refresh cases; generated-client checks; full Swift build; exact-head repository pre-push gate. Runtime proof will use a named app against dev.

Product invariants affected: INV-MEM-1, INV-MEM-4.

Failure-Class: FC-day-bucket-key-recomputed

@mintlify

mintlify Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Sep 5, 2026, 6:38 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

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

1 issue found across 14 files

Confidence score: 3/5

  • In backend/utils/memory/jit_trigger_snapshot.py, _budget_authority collapses missing and malformed timezones to None, so invalid profile data can continue through the router instead of failing closed; distinguish invalid from missing timezones and stop or reject the affected routing path.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="backend/utils/memory/jit_trigger_snapshot.py">

<violation number="1" location="backend/utils/memory/jit_trigger_snapshot.py:199">
P2: A malformed profile timezone does not actually fail closed end-to-end. `_budget_authority` returns `None` for both a missing and an invalid timezone (`except Exception: return None`), so the router sends `budget_timezone: null` and the Swift client falls back to `TimeZone.current` (host timezone) instead of the `budget_authority_unavailable` branch, which requires a non-nil invalid string the backend never produces. The reservation server still fails closed, so these users hit the exact wrong-day pacing bug this PR removes. Distinguish "absent" from "malformed": only return `None` for a genuinely absent/empty field, and propagate a distinct signal (or an incomplete snapshot) for a value that fails `ZoneInfo` so the client can fail closed.</violation>
</file>

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

Re-trigger cubic

return None
zone = ZoneInfo(timezone_name)
return at.astimezone(zone).date().isoformat(), timezone_name
except Exception:

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: A malformed profile timezone does not actually fail closed end-to-end. _budget_authority returns None for both a missing and an invalid timezone (except Exception: return None), so the router sends budget_timezone: null and the Swift client falls back to TimeZone.current (host timezone) instead of the budget_authority_unavailable branch, which requires a non-nil invalid string the backend never produces. The reservation server still fails closed, so these users hit the exact wrong-day pacing bug this PR removes. Distinguish "absent" from "malformed": only return None for a genuinely absent/empty field, and propagate a distinct signal (or an incomplete snapshot) for a value that fails ZoneInfo so the client can fail closed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/utils/memory/jit_trigger_snapshot.py, line 199:

<comment>A malformed profile timezone does not actually fail closed end-to-end. `_budget_authority` returns `None` for both a missing and an invalid timezone (`except Exception: return None`), so the router sends `budget_timezone: null` and the Swift client falls back to `TimeZone.current` (host timezone) instead of the `budget_authority_unavailable` branch, which requires a non-nil invalid string the backend never produces. The reservation server still fails closed, so these users hit the exact wrong-day pacing bug this PR removes. Distinguish "absent" from "malformed": only return `None` for a genuinely absent/empty field, and propagate a distinct signal (or an incomplete snapshot) for a value that fails `ZoneInfo` so the client can fail closed.</comment>

<file context>
@@ -170,6 +176,30 @@ def _empty_watchlist_revision(uid: str, account_generation: int) -> str:
+            return None
+        zone = ZoneInfo(timezone_name)
+        return at.astimezone(zone).date().isoformat(), timezone_name
+    except Exception:
+        return None
+
</file context>

@Git-on-my-level
Git-on-my-level merged commit 49de4c4 into main Sep 5, 2026
48 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/jit-beta-proactivity-20260905 branch September 5, 2026 19:18
Git-on-my-level added a commit that referenced this pull request Sep 9, 2026
…ne (#13277)

* fix(windows): route an empty complete JIT watchlist to the ambient lane

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]>

* test(windows): pin the empty-watchlist route end to end and record the 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]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
summersmile1984 added a commit to summersmile1984/omi that referenced this pull request Sep 15, 2026
A trigger is the only thing that makes a lane rebuild a projection, and 35 of the 52
modules the Cloudflare stagers read matched no `fork-cloudflare-*` trigger -- including
`backend/utils/memory/jit_trigger_snapshot.py`, the owner whose upstream edit (upstream
BasedHardware#12798, 2026-09-05) produced the broken kernel. The breakage sat in `main` for ten days and
was first attributed to an unrelated PR that happened to select the lane.

`deploy/cloudflare/scripts/check_staged_owner_coverage.py` reads every path passed to
`source(...)` or `selected_nodes(...)` under `deploy/cloudflare/scripts/` and requires a
`fork-cloudflare-*` trigger to match it, reusing the CI runner's own `load_manifest` and
`trigger_matches` so there is one matcher rather than a second copy that can drift. It is
declared with the backend-venv-or-`python3` fallback the other checks use, because
`.github/scripts/git_bash.py` needs 3.10 syntax.

The new `fork-cloudflare-staged-owners` check keeps the list complete from here, and
`fork-cloudflare-routes` gains the 35 missing owners. Registering the owners is the
substantive half: it makes an upstream edit to any projected module run the lane that
builds it, instead of the next PR that happens to touch the Cloudflare tree.

This is the Cloudflare staging instance of FC-fork-stage-stops-at-first-stale-owner, so the
registry records this checker as a prevention artifact for that class. Extending the class's
own prose is a registry-only lifecycle change, deliberately not folded in here.

Evidence:
  check_staged_owner_coverage.py before -> "35 of 52 staged Cloudflare sources match no
    fork-cloudflare-* trigger", exit 1
  check_staged_owner_coverage.py after  -> "All 52 staged Cloudflare sources are covered",
    exit 0
  scripts/fork/run_checks.py --lane local --check-id fork-cloudflare-staged-owners
    -> <== PASS fork-cloudflare-staged-owners (0.06s)

This branch was successfully deployed

1 active deployment
staging - docs — 074346bf Deployed Sep 5, 2026 by mintlify[bot]
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