Report old requests discarded only after saving that state

RO
8h ago
+36-1

Summary

Keep the narrow correctness fix from the retired restart-testing work: log that an old request was discarded only after the ledger write succeeds. A failed write previously left a success message in the log.

No new harness, timing knob, or change to the handoff age limit.

Verification

  • Added a focused test to the existing handoff tests. Its failed-save case fails before the fix and passes afterward; the successful-save control still records the discard and logs it.
  • Targeted handoff tests pass over 20 race-enabled runs.
  • Full local bin/ci passes.

Summary by cubic

PR Description

Fixes the handoff discard logging so a completion message is only emitted after the ledger write succeeds.

Previously, a request from before the run started was logged as "not handed off" before its discarded state was saved, so a failed save left a misleading success message in the log. Now the state is written first and the log line appears only if the write succeeds. Adds a test covering both save success and save failure.

Summary

Changes the handoff discard path so the discarded state is saved before the "not handed off" log line is written. A failed save now returns the error without logging a success message, and a new test verifies both the success and failure cases.