Skip to content

fix(app): honor recording-scoped upload retry windows - #26396

Merged
aryanorastar merged 1 commit into
mainfrom
codex/recording-retry-window
Nov 27, 2026
Merged

aryanorastar merged 1 commit into
mainfrom
codex/recording-retry-window

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

The backend can send a 1,800-second record_capture_pending wait after a cached negative audio-coverage check (#26333). The mobile upload gate capped all recording waits at 300 seconds, so affected recordings could retry early even after an app restart.

Honor typed recording waits up to 30 minutes. Preserve the five-minute cap for header fallback and local backoff. Each wait remains scoped to the recording session. The existing receipt path still controls when a local recording can be released.

Related: #21216, #25770, #26333.

Product invariants affected

  • INV-CAP-1 — the wait changes retry timing only. The affected file remains readable and pending throughout the deferral, with the existing server receipt still required for release.

How it was verified

  • The restart regression failed before the patch. The queue issued another request at six minutes despite a 30-minute response.
  • 81 focused Flutter tests passed. The updated loopback HTTP test separately passed with the full 1,800-second response.
  • The backend coverage-wait suite passed 27 tests, including the 1,800-second response.
  • Analyzer ratchet and all 27 local preflight checks passed.
  • Independent review checked the bounds, persisted values, and unchanged custody logic.
  • Production coverage and historical recording recovery require separate verification.

Tests

  • recording_wait_deferrals_test.dart checks typed and header limits, default waits, and short backoff.
  • wal_upload_resilience_test.dart checks a restarted queue, a sibling session uploading independently, retained audio, and exact expiry.
  • wal_retry_manifest_transport_test.dart verifies the typed 503 over loopback HTTP, no request during the restored wait, and a queued receipt after expiry.

UI evidence

UI-Evidence: none -- Upload retry timing only.

Failure class

Failure-Class: none

View guided diff Turn on auto-fix

@Git-on-my-level

Copy link
Copy Markdown
Member

Verdict: the production change is correct and tightly scoped. Nothing blocking.

Correctness

  • app/lib/services/wals/recording_wait_deferrals.dart: defer now picks the cap by source: 1,800s for the typed body hint (recordingWaitSeconds), 300s for the Retry-After header fallback and local backoff. I checked the arithmetic. Jitter stays non-negative for every hint (above 300s base == hint, so jitter is 0). _validDeadline widens with the stored base, so a persisted 1,800s wait survives a restart. The load guard drops persisted bases above 1,800. Header-only and no-hint callers keep the old 300s behavior.
  • app/lib/services/wals/sync_upload_gate.dart: the sole call site passes both fields separately. The account-wide limiter and the record_capture_pending exclusion from the unscoped 5xx pause are unchanged.
  • app/lib/services/wals/CUSTODY.md: the 30-minute / five-minute split matches the code. The backend side backs the number: coverage_wait_retry_after_seconds() in backend/config/batch_pipeline_coverage_wait.py is bounded to 30*60.
  • Tests: app/test/unit/recording_wait_deferrals_test.dart proves the two caps are independent. app/test/unit/wal_upload_resilience_test.dart proves the 30-minute wait survives a restart, still blocks a single-file retry at 29:59, clears at 30:00, and leaves the sibling session uploading. app/test/unit/wal_retry_manifest_transport_test.dart covers the typed 503 over loopback HTTP. I ran these three files on this head: 50 passed.
  • app/changelog/unreleased/20261126-offline-sync-retry-pacing.json: present and accurate.

UX: a manual single-recording retry during a server coverage wait is now refused for up to 30 minutes (was 5). It is the same SyncRecordingWaitException path with no new UI.

Blast radius: only recordings that receive record_capture_pending with a body hint above 300s.

USER IMPACT: Recordings the server is still checking stay local for up to 30 minutes before the app retries, instead of being re-sent after 5 minutes regardless of what the server asked. Other recordings keep uploading as before.

What I would still want (optional, non-blocking): a one-line unit assertion that a persisted base above 1,800 is dropped on load. The new base <= _maxServerWaitSeconds guard in _loadOwner has no direct test.

Since this is still a draft, I am leaving this as a signal rather than a review state. No maintainer decision is needed beyond the normal merge call.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Nov 26, 2026
@aryanorastar
aryanorastar marked this pull request as ready for review November 27, 2026 06:28
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-27T06:28:56.220114Z
We couldn’t complete this review. Comment @codex review to try again.
8535b5f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@aryanorastar
aryanorastar merged commit d622644 into main Nov 27, 2026
64 of 65 checks passed
@aryanorastar
aryanorastar deleted the codex/recording-retry-window branch November 27, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants