Skip to content

Wait for Live output before starting interviews - #295

Closed
HellHBBD wants to merge 1 commit into
sysprog21:mainfrom
HellHBBD:fix/gemini-live-readiness
Closed

HellHBBD wants to merge 1 commit into
sysprog21:mainfrom
HellHBBD:fix/gemini-live-readiness

Conversation

@HellHBBD

@HellHBBD HellHBBD commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Live setup can complete without model output. Use the normal opening generation as one bounded readiness attempt, preserve its events for delivery, and start the interview clock only after the first model output. Startup failures do not retry.

Carry outcomes on the existing interviewer_state message and degraded-start banner. Name provider-specific errors only when the provider identifies them.

Validation

  • ./scripts/test.sh passed after rebasing onto 546f559, with Chromium, commentflow, and actionlint enabled. Startup tests cover setup without output, timeout, a single generation attempt, event preservation, and timer ordering.
  • The offline Rust-server interview check passed with the existing web/audio/test-voice.wav capture fixture.
  • The contributor ran release build and tests successfully at df170a8; the release binary reports that revision.

Browser tests used a temporary Liberation Sans alias; the default-font lobby failure also reproduces on base a3f3e80. Live provider integration was not run.

Closes #159


Summary by cubic

Live setup can finish without model output, so the interview clock can run against a silent provider. This change starts the interview timer and hard deadline only after the first model output—nonempty audio, model text, output transcription, or a tool call—using the opening greeting as a single bounded readiness attempt that never retries. A failed check ends the interview; practice mode that continues stays untimed, and Practice End during the startup wait closes without requesting a report.

Failure reporting

  • Readiness outcomes publish on the existing interviewer_state control topic with startup: "ready" or startup: "failed" plus a classified reason (quota, billing, credentials, refused, or unavailable), shown in the degraded-start banner.
  • An exhausted key rotation or a cooldown that cannot fit the first-open budget keeps its quota or billing cause instead of degrading into a generic transport timeout.
  • The page sends a bounded startup_received receipt for failed readiness, hashed and published under the same bound as report receipts, and keeps the diagnosis through room teardown.

Socket and client behavior

  • Socket setup keeps its bounded key-failover and restart budget; only readiness generation is a single attempt.
  • Keepalives keep a responsive socket alive while waiting, and a GoAway advisory sent before output replays with its original timestamp and no further generation.
  • Queued opening events are preserved in order for the normal room loop, and the reply-wait clock starts at readiness so replay cannot expire an already answered greeting.
  • Observed usage is accounted once even when readiness publication fails; strict mode stays gated until readiness.
  • Editable work before the clock starts and after a failed opening warns on unload until its report persists; early interviewer departure, recording delays, and premature report requests are handled without blocking cleanup or losing context.

Written for commit e77c235. Summary will update on new commits.

View guided diff

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

jserv

This comment was marked as outdated.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from 69ca930 to 16e2bce Compare October 14, 2026 02:50
@HellHBBD
HellHBBD requested a review from jserv October 14, 2026 03:07
@jserv
jserv requested review from ColtenOuO and alanhc October 14, 2026 03:08
jserv

This comment was marked as outdated.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from 16e2bce to 7792ace Compare October 18, 2026 03:53
@HellHBBD
HellHBBD requested a review from jserv October 18, 2026 05:04
jserv

This comment was marked as outdated.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch 2 times, most recently from 5fb22be to 763f8e5 Compare October 18, 2026 07:50
@HellHBBD
HellHBBD requested a review from jserv October 18, 2026 08:29
jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as resolved.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from 763f8e5 to 4365539 Compare October 21, 2026 11:46

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Changes look good to me, before merge this PR, please squash your commit.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from 4365539 to 63e6cab Compare October 22, 2026 09:50
@HellHBBD
HellHBBD requested review from ColtenOuO and jserv October 22, 2026 10:31
@HellHBBD

Copy link
Copy Markdown
Contributor Author

The browser CI failure also occurs on upstream main at fd7c23c, before the Gemini changes in this PR:
tests/browser/lobby.test.js:6457
problem cards span desktop panels and return home on narrow screens

AssertionError: 57 !== 4

The same test passed at the preceding main commit, 0116b9b, then failed after merging #401 at fd7c23c. This PR's browser job reports the same assertion failure.

Code inspection points to an interaction between #410's layout test and #401's new .problem-entry wrapper. The test temporarily changes .problem-card.hidden and later clears it, but #401's filtering also hides the enclosing .problem-entry. Clearing the button's hidden property therefore does not necessarily make it visible. The subsequent .problem-card:not([hidden]) query still includes buttons inside hidden wrappers; their zero bounding rectangles cause them to be counted as sharing one row.

The layout test needs to account for the wrapper when changing visibility and count cards that are actually rendered. This analysis is based on the CI logs and source comparison; I have not rerun a corrected test yet.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from d89b4a2 to 3fe5839 Compare October 28, 2026 12:33
@jserv
jserv dismissed stale reviews from themself October 28, 2026 12:46

No merge conflicts at the current head.

jserv

This comment was marked as outdated.

jserv

This comment was marked as resolved.

jserv

This comment was marked as outdated.

jserv

This comment was marked as outdated.

A successful setup does not prove the Live model can answer. Start
the interview clock only after its bounded opening produces output,
so a silent startup does not consume interview time. Preserve candidate
work on failure and let Practice users leave without waiting for a
report, while keeping Strict interviews gated on readiness.

Close sysprog21#159
@HellHBBD
HellHBBD force-pushed the fix/gemini-live-readiness branch from 3fe5839 to e77c235 Compare October 30, 2026 05:54
@jserv
jserv dismissed their stale review October 30, 2026 06:04

No merge conflicts at the current head.

Comment thread src/livekit.rs
let (reason, until) = match opened {
Ok(session) => return Ok(session),

// A known cooldown that cannot fit the first-open budget cannot

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With two or more keys that Gemini rejects as invalid or refuses, retry_live_open moves to the next key after each rejection, and the attempt after the last one gets only the bare Exhausted error from GeminiKeys::select. That error carries no cooldown and no billing flag, so neither this arm nor startup_failure_reason classifies it, and the candidate is told Gemini did not answer the startup check when Gemini in fact rejected every configured key. Keep the last attempt's ApiFailure in this loop and return it when the rotation runs dry with no cooldown, so the reason comes out as credentials or refused, and add a two-key case beside the single-key reason test.

jserv

This comment was marked as outdated.

@jserv
jserv requested a review from Patriciaath999 October 30, 2026 09:20
jserv

This comment was marked as outdated.

jserv

This comment was marked as outdated.

jserv

This comment was marked as outdated.

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rebase the current branch onto the upstream default branch and resolve any conflicts. Run /codetrial-review in AI agents (use $codetrial-review in Codex) and resolve all identified issues. Rework the series into minimal, logically coherent commits, squash closely related commits, and ensure all commit messages follow the project’s rules.

Comment thread web/interview.js
if (joined === "reporting" || state.phase !== "live") return false;
state.connected = true;
if (strict) updateRunAvailability();
if (strict && !whiteboard) nodes.editor.disabled = false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The preflight overlay is already hidden here, but the readiness wait below has not finished and the countdown is not started until it returns. In Strict mode a candidate can edit and run tests while Gemini stays silent, gaining untimed work during the startup wait. Keep the editor and Run disabled until readiness starts the interview clock.

jserv

This comment was marked as outdated.

jserv

This comment was marked as outdated.

@jserv

jserv commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open.

Not addressed at the current head:

Checked at e77c235.

@ColtenOuO

Copy link
Copy Markdown
Collaborator

Converting this PR to a draft for now due to inactivity. Feel free to mark it as ready for review whenever you're ready.

@jserv

jserv commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Close in favor of #709

@jserv jserv closed this Nov 14, 2026
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.

Check Gemini API readiness before starting an interview and show quota/billing errors

3 participants