Repository navigation
chore(app): log the server reason on sync upload HTTP failures - #26506
Conversation
A shared debug log showed hundreds of identical "Local upload HTTP failure: SyncUploadHttpException(status=503): Server is temporarily unavailable" lines and nothing else. The app already parses the response's reason code, Retry-After and recording-scoped wait into SyncUploadHttpException, but the failure line only wrote the status and batch fields. Support could not tell an Omi refusal (for example record_capture_pending) from platform shedding without server logs. Write reasonCode, retryAfterSeconds and recordingWaitSeconds into the existing failure line when the server supplied them. They are server-defined tokens and numbers, no user content. An absent reasonCode now means a platform 5xx. Verification: - New test in wal_upload_resilience_test.dart drives the production drain with a 503 carrying reasonCode + Retry-After and reads the shared debug log file. It fails without the change (Expected 'sync_dispatch_busy', Actual null) and passes with it. - flutter test test/unit/wal_upload_resilience_test.dart test/unit/local_wal_sync_test.dart test/unit/sync_upload_gate_test.dart: 245 passed. - flutter analyze on both files: no issues. make preflight: passed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The production change is correct and tightly scoped; nothing blocking, a few small suggestions below.
Notes (non-blocking):
Security: nothing new leaves the device beyond closed tokens and integers that the shared debug log already accompanies. Performance: three extra map entries on an existing log write, no new I/O. USER IMPACT: nothing visible in the app; support engineers reading a shared debug log will now see why a sync upload was refused (a recording-side wait versus a platform outage) without needing server-side logs. Still want as a reviewer: an assertion for by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Review asked for a recordingWaitSeconds assertion. The test now uses the realistic recording-scoped refusal (record_capture_pending with Retry-After and a 30-minute recording wait) and asserts all three fields. A second case, a plain platform 503, asserts that none of them appear, so an absent reasonCode keeps meaning "no Omi reason". Verification: removing the recordingWaitSeconds line from local_wal_sync.dart fails the test (Expected 1800, Actual null). With it restored, the wal_upload_resilience, local_wal_sync and sync_upload_gate suites pass (245). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Pushed 7e24fde: test-only change.
|
|
Since my last review: addressed (the test now asserts This is ready from my side once it leaves draft; the production change is unchanged and the test now covers every field it adds.
Checks on this head are green (Dart Analyze & Tests, Formatting, Hygiene, CodeQL among 48 runs, none failed). Security: unchanged; only closed tokens and integers are added to the shared debug log. Performance: no change from the prior head. USER IMPACT: none — internal change; support reading a shared debug log will see why a sync upload was refused without server-side logs. Nothing further from me. Leaving for human maintainer review before merge given the draft state. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
What changed and why
A customer's shared debug log had hundreds of identical
Local upload HTTP failure: SyncUploadHttpException(status=503): Server is temporarily unavailablelines and nothing else. The app already parses the response's reason code,Retry-Afterand recording-scoped wait intoSyncUploadHttpException, but the failure line wrote only the status and batch fields. Support could not tell an Omi refusal (for examplerecord_capture_pending) from platform shedding without server logs, and per-account server logs aren't joinable today.This writes
reasonCode,retryAfterSecondsandrecordingWaitSecondsinto that existing line when the server supplied them. They are server-defined tokens and numbers, not user content. An absentreasonCodeon a 5xx now means a platform response with no Omi reason.Refs #21943.
Product invariants affected
app/lib/services/wals/local_wal_sync.dart). This is a log-field change; frame delivery, retention, retry and upload decisions are unchanged.How it was verified
flutter test --no-pub test/unit/wal_upload_resilience_test.dart --plain-name 'server reason and pacing'passes. With thelocal_wal_sync.dartchange reverted, the same test fails:Expected: 'sync_dispatch_busy',Actual: <null>.flutter test --no-pub test/unit/wal_upload_resilience_test.dart test/unit/local_wal_sync_test.dart test/unit/sync_upload_gate_test.dart: 245 passed.flutter analyze --no-pubon both changed Dart files: no issues.dart format --line-length 120: no changes.make preflight: 27 checks passed.Tests
New
a 503 failure line in the shared debug log carries the server reason and pacinginapp/test/unit/wal_upload_resilience_test.dart. It drives the productionLocalWalSyncImpldrain throughSyncUploadGatewith an injected uploader that returns a 503 with a reason code andRetry-After, then reads the shared debug log file. It also asserts that an absent server field stays absent.Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 3362 -> 3366 | three optional fields on the existing failure log line plus one comment; splitting the drain is out of scope for a log-only change
UI evidence
UI-Evidence: none -- debug-log fields only, no UI change
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code