Skip to content

fix(desktop): restore Gemini platform deadline - #9644

Merged
Git-on-my-level merged 1 commit into
mainfrom
codex/fix-issue-9524-gemini-deadline
Jul 13, 2026
Merged

Git-on-my-level merged 1 commit into
mainfrom
codex/fix-issue-9524-gemini-deadline

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • restore the non-streaming Gemini proxy deadline from the Cloud Run request contract: 300 seconds minus 60 seconds of response headroom
  • keep the newer single logical deadline, cancellation propagation, timeout classification, metering, and telemetry behavior intact
  • guard against again reducing the end-to-end budget below 180 seconds or consuming the platform-response margin

Fixes #9524.

Root cause and durable guard

A merge that preserved the newer proxy telemetry model also reintroduced a 75-second logical deadline and 70-second HTTP-client timeout. Cloud Run and the desktop client both allow 300 seconds, so the proxy was rejecting valid long-context Gemini calls around 70 seconds.

The timeout is now derived from the 300-second Cloud Run contract. The regression test asserts that it remains below the platform deadline with 60 seconds of response headroom and stays at least 180 seconds, while preserving the smaller per-attempt margin inside the total budget.

Verification

  • cd desktop/macos/Backend-Rust && cargo test --locked — 350 passed
  • cd desktop/macos/Backend-Rust && cargo check --locked — passed
  • cd desktop/macos/Backend-Rust && cargo clippy --locked -- -D warnings — passed
  • cd desktop/macos && bash test.sh — launcher, Rust, and isolated Swift suites passed
  • make preflight — passed; no locked product invariants apply
  • cd desktop/macos && OMI_APP_NAME="omi-issue-9524" OMI_SIGN_IDENTITY="-" OMI_ALLOW_ADHOC_SIGN=1 OMI_AUTOMATION_PORT=47996 ./run.sh --yolo — named bundle built, signed, installed, launched, and was inspected through its automation bridge

The machine had no Omi Dev auth session to seed, so an authenticated real Gemini request could not be exercised locally. The proxy’s real cancellation path and deadline contract are covered by the Rust suite; no production traffic was changed.

Review in cubic

@Git-on-my-level
Git-on-my-level merged commit f349c9b into main Jul 13, 2026
22 of 25 checks passed
@Git-on-my-level
Git-on-my-level deleted the codex/fix-issue-9524-gemini-deadline branch July 13, 2026 20:45
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 23, 2026
Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

Co-Authored-By: Claude Fable 5 <[email protected]>
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 23, 2026
Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

Co-Authored-By: Claude Fable 5 <[email protected]>
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 24, 2026
Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

Co-Authored-By: Claude Fable 5 <[email protected]>
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 24, 2026
Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

Co-Authored-By: Claude Fable 5 <[email protected]>
aryanorastar added a commit to aryanorastar/omi that referenced this pull request Jul 26, 2026
Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

Co-Authored-By: Claude Fable 5 <[email protected]>
kodjima33 pushed a commit that referenced this pull request Jul 28, 2026
…10054)

* fix(chat): consume one request deadline budget on the Anthropic path

The provider-timeout class (FC-per-hop-timeout: #8640, #8911, #9135,
chat path now owns one admission budget instead:

- RequestDeadline (240s inside the 300s platform bound, mirroring the
  Gemini proxy) is created in route middleware before extractors and
  body extraction; auth, BYOK, and paywall waits are bounded by it and
  budget exhaustion returns a typed 504 instead of a 401.
- All provider sends go through send_with_deadline; the retry loop is a
  budget-aware policy: attempts never start on an expired budget, a
  retry or pause_turn continuation starts only above a 10s floor, and
  backoff sleeps truncate at the budget edge. A transient status on the
  final available attempt still passes through unchanged.
- The budget governs everything before the first client-visible semantic
  SSE event. The stream idle timer now measures SEMANTIC progress:
  raw bytes and Anthropic ping events no longer reset it, closing the
  live gap where a ping-only upstream could hold a client forever with
  nothing visible. Streaming still has no total response timeout by
  design (#9135): a visible-delta stream survives budget expiry.
- The detached Firestore usage write runs through a spawn seam that
  never inherits the request deadline.

Behavioral tests drive the policy and the real stream translator with
tokio::time::pause: budget-floor retry stop, backoff truncation at the
edge, long visible streams surviving expiry, ping-only turns ending in a
typed terminal SSE error, semantic-idle stalls independent of budget,
and detached-write completion after expiry.

Fixes #9835.

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

* harden(ci): reject chat provider sends that bypass send_with_deadline

Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: #8640/#8911/#9135/#9644 (#9835).

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

* fix(chat): count reasoning deltas as semantic progress

ThinkingDelta chunks reach the client as `reasoning_content`, but they did not
refresh the semantic idle timer — only text deltas did. So after the initial
role chunk, a Claude reasoning phase that kept emitting visible reasoning for
longer than STREAM_IDLE_TIMEOUT was ended as "no semantic progress" while the
client was actively receiving output, regressing the "a long visible stream is
not an error" contract (#9135) for reasoning streams.

Refresh the timer when a reasoning chunk is yielded, matching the text-delta
path. Regression test drives a reasoning-only stream 200s past the 60s idle
bound on the paused clock: it fails on the old code (1 of 4 reasoning deltas
delivered, turn killed at the bound) and passes with the fix.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(chat): register deadline guard artifact

Failure-Class: FC-per-hop-timeout

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Max Carter 祁明思 <[email protected]>
undivisible added a commit to Archit-lal/omi that referenced this pull request Jul 29, 2026
…asedHardware#10054)

* fix(chat): consume one request deadline budget on the Anthropic path

The provider-timeout class (FC-per-hop-timeout: BasedHardware#8640, BasedHardware#8911, BasedHardware#9135,
chat path now owns one admission budget instead:

- RequestDeadline (240s inside the 300s platform bound, mirroring the
  Gemini proxy) is created in route middleware before extractors and
  body extraction; auth, BYOK, and paywall waits are bounded by it and
  budget exhaustion returns a typed 504 instead of a 401.
- All provider sends go through send_with_deadline; the retry loop is a
  budget-aware policy: attempts never start on an expired budget, a
  retry or pause_turn continuation starts only above a 10s floor, and
  backoff sleeps truncate at the budget edge. A transient status on the
  final available attempt still passes through unchanged.
- The budget governs everything before the first client-visible semantic
  SSE event. The stream idle timer now measures SEMANTIC progress:
  raw bytes and Anthropic ping events no longer reset it, closing the
  live gap where a ping-only upstream could hold a client forever with
  nothing visible. Streaming still has no total response timeout by
  design (BasedHardware#9135): a visible-delta stream survives budget expiry.
- The detached Firestore usage write runs through a spawn seam that
  never inherits the request deadline.

Behavioral tests drive the policy and the real stream translator with
tokio::time::pause: budget-floor retry stop, backoff truncation at the
edge, long visible streams surviving expiry, ping-only turns ending in a
typed terminal SSE error, semantic-idle stalls independent of budget,
and detached-write completion after expiry.

Fixes BasedHardware#9835.

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

* harden(ci): reject chat provider sends that bypass send_with_deadline

Static tripwire (labeled as such): raw reqwest builders are not covered
by signatures alone, so new direct .send() calls in routes/chat/ fail
the manifest lanes. Behavioral coverage lives in the paused-time
deadline tests. Caught class: BasedHardware#8640/BasedHardware#8911/BasedHardware#9135/BasedHardware#9644 (BasedHardware#9835).

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

* fix(chat): count reasoning deltas as semantic progress

ThinkingDelta chunks reach the client as `reasoning_content`, but they did not
refresh the semantic idle timer — only text deltas did. So after the initial
role chunk, a Claude reasoning phase that kept emitting visible reasoning for
longer than STREAM_IDLE_TIMEOUT was ended as "no semantic progress" while the
client was actively receiving output, regressing the "a long visible stream is
not an error" contract (BasedHardware#9135) for reasoning streams.

Refresh the timer when a reasoning chunk is yielded, matching the text-delta
path. Regression test drives a reasoning-only stream 200s past the 60s idle
bound on the paused clock: it fails on the old code (1 of 4 reasoning deltas
delivered, turn killed at the bound) and passes with the fix.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(chat): register deadline guard artifact

Failure-Class: FC-per-hop-timeout

---------

Co-authored-by: Claude Fable 5 <[email protected]>
Co-authored-by: Max Carter 祁明思 <[email protected]>
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.

Desktop backend: recover stale Redis connections and isolate Gemini timeout failures from release health

1 participant