Repository navigation
Bound JIT proactive provider usage across agent tool rounds - #12817
Merged
Merged
Conversation
Adds a main-only development workflow with immutable API, desktop companion, drain, and sweep images; Cloud Run readback rejects inherited credentials, cache or queue bindings and keeps migration gates closed. Pins Firebase token verification to the auth project while jobs use the dev Firestore ADC data plane.\n\nVerification: actionlint .github/workflows/jit_qa_cloud_run.yml; 30 focused backend tests; python3 backend/scripts/runtime_image_contracts.py check; make preflight; no GCP mutation performed.
…nded-20260905 # Conflicts: # desktop/macos/agent/src/adapters/pi-mono.ts
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Git-on-my-level
added a commit
that referenced
this pull request
Sep 5, 2026
The crash-rate date series could omit today's counts when its second clock read was even one millisecond later than its first. Derive the start from the same captured instant as the end so the final UTC bucket is always included. A deterministic advancing-clock regression fails on the old code and passes with the fix. All 10 focused tests and the admin TypeScript check pass. This was exposed by web CI for #12817. Failure-Class: new
There was a problem hiding this comment.
All reported issues were addressed across 39 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
# Conflicts: # .github/workflows/jit_qa_cloud_run.yml # backend/docs/runbooks/jit-qa-cloud-run.md # backend/scripts/jit_qa_cloud_run_contract.py # backend/tests/fixtures/jit_qa/cloud_run_v1_service.json # backend/tests/unit/test_jit_qa_cloud_run_contract.py
Failure-Class: none
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and behavior
JIT proactivity could cross provider retries and agent tool rounds without one durable budget, and its cost evidence was incomplete. This adds a server-advertised
jit-cloud-qa-v1contract carried through Swift, Pi, the desktop relay, and the gateway. The named QA bundle rejects a missing capability before paid admission; ordinary chat retains its existing behavior.The QA contract reserves a shared owner/run budget in Firestore before each provider call: at most three attempts, 2,048 output tokens per attempt, a conservative 32,768-byte UTF-8 input envelope, and $0.05 estimated spend per run. Unknown usage, interruptions, failed settlement, and concurrent ownership cannot reopen the budget. Qualification requests cannot bypass the gateway through BYOK or a direct route. Null output limits receive the cap; malformed limits are rejected before dispatch. Unsupported image/audio inputs fail before a provider call. Existing daily notification, nano-triage, and full-turn caps remain unchanged.
JIT service turns expose exactly four read-only retrieval tools through the manifest, stdio/Pi transport, and durable run capability. Receipts retain every observed attempt ID, normalized usage, reasoning tokens, rate-card estimate, and explicit unknown cost through SSE and Swift provenance. Streaming remains incremental and preserves provider bytes; a validated receipt is durable before the terminal frame reaches Pi, while early cancellation blocks later rounds. Legacy/nano responses, including errors, retain the backend request ID for exact durable accounting joins without dropping quota or retry headers. The shared full-turn prompt preserves ambient feedback behavior and distinct capture/evaluation timestamps with the authoritative profile timezone.
The named QA backend, desktop backend, and gateway advertise the same capability. QA operation fixes load the existing development encryption secret before seed imports and post-drain verification, check Redis API state without a truncating result limit, and reconcile only the two registered retrieval indexes in
based-hardware-dev/jit-qa. Index progress is separated from JSON receipts. Resource validation accepts Cloud Run's omitted protobuf scalar only for an explicitly empty literal, while retaining checks for missing entries, null values, unexpected values, and secret substitutions.This PR supplies qualification machinery. It does not establish completed live notifications, measured cost reduction, or production rollout readiness.
Validation
Failure-Class: none
Invariants
INV-CUTOVER-1: rollout and account generation remain the admission authority; a QA capability cannot enroll an account.INV-CHAT-1: receipts use the existing shared transport and do not add a transcript writer.INV-AGENT-*: Omi retains run/attempt lifecycle authority. Provider receipt IDs are accounting provenance, not tool authority.Line-Count-Exception: backend/routers/desktop_chat.py | 1883 -> 1952 | Validate and forward the explicit JIT contract at the existing authenticated relay boundary; budget authority remains in its own module.
Line-Count-Exception: desktop/macos/Desktop/Sources/Chat/AgentBridge.swift | 2206 -> 2211 | Forward five optional receipt fields through the existing bridge response without introducing another transport.
Line-Count-Exception: desktop/macos/Desktop/Sources/Chat/AgentRuntimeProcess.swift | 4386 -> 4390 | Decode four optional usage receipt fields alongside the existing terminal event fields.