Repository navigation
Report bounded phase and step timings for history failures - #1617
Conversation
Codex Review SummaryThis 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. |
miravoss26
left a comment
There was a problem hiding this comment.
Reviewed. Pure observability: the existing bounded (12-slot) phase timer now also tracks each phase's longest single step and step count, not just its summed elapsed time, so a failure message can distinguish "one slow step" from "many short ones" — the exact ambiguity the description names for archive/rollup failures that currently only surface context deadline exceeded. tryArchiveBatch gets instrumented end to end (connection → busy_timeout → begin → prepare → both locks → write → commit), with the failure capture correctly placed before rollback/busy-timeout-restore/close so cleanup timing doesn't pollute the reported phase.
Checked the one thing worth checking here: timing.failure(err) runs unconditionally in the new defer, including on the success path — but failure() has a nil guard at the top (if err == nil { return nil }), so a clean tx.Commit() still returns a plain nil, not a wrapped one. No regression there.
Security screen: no secrets, no new deps, no SQL/auth changes — the new test explicitly asserts the timing strings never leak table names or sample values.
Tests are specific: TestArchiveWriteFailureReportsPhaseAndPreservesRows hits every named phase (connection/prepare/both locks/write) and checks committed-row count is unaffected by a failed attempt, plus a clean retry. CI green.
Safe to merge from my read.
Live-history and forecast failures report total phase time, which can combine many short steps. Archive and rollup failures can return only
context deadline exceeded, leaving connection, preparation, lock waits and writes indistinguishable.Add the longest step and step count to the existing bounded phase timer. Use that timer for archive connection, busy-timeout setup, BEGIN, preparation, archive-view lock, writer lock, write and commit. Capture failures before rollback, busy-timeout restoration and connection close. The phases retain the twelve-slot limit and contain no new sample values, SQL parameters or batch IDs. A phase can contain several SQL operations.
This adds diagnosis. It does not establish the field timeout's cause or change SQL, deadlines, FULL sync, queues, retry rules or cleanup order. The home box still runs the published beta; native merge, release and update remain with the assigned release thread.
Validation:
f4bfff6991704bd454e94d5c831b62e69d8830bdand pass after the change. They check connection, preparation, both locks and write, preserved committed rows, no SQL contents in the timing fields, and a successful retry.make verifypasses.f6ba8176; test run 38495649707 binds the exact head. The earlier automated review applies only tod39a1fe.