fix(conclude): publish request log on terminal reconcile + make idempotent#198
Merged
Conversation
…otent The conclude controller reconciles request state to the batch's terminal outcome but did not emit a corresponding RequestLog entry, leaving the request lifecycle log without a terminal record (landed/error/cancelled). This change publishes the terminal RequestLog after the state CAS, and makes the per-request loop idempotent under at-least-once redelivery: - If the request is already in the target terminal state, skip the CAS but still publish the log (the log queue dedupes on (request_id, status), so re-delivery after a prior partial success still records the terminal entry exactly once). - If the request is in a different terminal state (a racing writer reached terminal first), skip both the CAS and the log publish; the other writer owns the terminal log entry for the state it wrote. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|
behinddwalls
approved these changes
Jun 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The conclude controller reconciles each request in a concluded batch to the batch's terminal state (Landed / Error / Cancelled) but did not emit a corresponding
RequestLogentry, leaving the request lifecycle log without a terminal record. Peer controllers (start,score,cancel) already publish to the log topic on their transitions; this bringsconcludein line.The per-request loop is also made idempotent under at-least-once redelivery:
(request_id, status), so a prior delivery that completed the state update but failed before publishing the log gets its log emitted on retry, recorded exactly once.terminal_state_divergencemetric and a warning log.Test plan
bazel test //submitqueue/orchestrator/controller/conclude:conclude_testpassesLanded, noUpdateStatemocked (gomock would fail if called), publisher still expectedCancelledfor aSucceededbatch; neitherUpdateStatenor publish allowedmake gazelleclean (picks up newsubmitqueue/core/requestdep)make fmtclean🤖 Generated with Claude Code