Skip to content

fix(stovepipe): persist the terminal outcome reason on Request - #965

Open
sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/sp-oct-001-terminal-reason
Open

sbalabanov wants to merge 1 commit into
mainfrom
sergeyb/sp-oct-001-terminal-reason

Conversation

@sbalabanov

@sbalabanov sbalabanov commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

TLDR: Keep the original failure reason when request handling retries.

Why?

A request can be saved as failed before its first status log is written. A later build poll sees only "failed" and can report a build failure even when polling or another stage actually failed.

Repro:

  1. Let build polling exhaust its retries and save the request as failed.
  2. Make writing the first failure log fail.
  3. Deliver a late build poll: the log can say build_failed instead of build_polling_exhausted.

What?

Save the typed reason together with the terminal request state, then reuse it for status logs. Requests without a saved reason keep the existing fallback; existing logs are not changed.

Rollout

Existing MySQL deployments must add outcome_reason VARCHAR(64) NOT NULL DEFAULT '' to request before deploying these readers and writers. This PR does not apply or schedule the migration.

Test Plan

  • Passed all 34 Stovepipe/service unit tests and the existing MySQL storage integration test.
  • Passed formatting, lint, dependency, mock, and build-file checks.

Revert Plan

Revert the code; leave the additive column in place until all newer processes have stopped using it.

Issue Links

None — standalone failure-reason consistency fix.

@sbalabanov
sbalabanov marked this pull request as ready for review October 27, 2026 23:41
@sbalabanov
sbalabanov requested review from a team and behinddwalls as code owners October 27, 2026 23:41
@sbalabanov
sbalabanov marked this pull request as draft October 29, 2026 16:24
@sbalabanov
sbalabanov marked this pull request as ready for review October 29, 2026 22:37
@sbalabanov
sbalabanov force-pushed the sergeyb/sp-oct-001-terminal-reason branch from d42b7fd to 92b3604 Compare November 6, 2026 20:35
A DLQ can save a failed request before its first outcome log is retained.
A late build poll then infers build_failed from the state alone, losing
the polling or stage failure that actually ended the request.

Store the typed outcome reason in the same terminal compare-and-swap as
the state and reuse it when constructing state logs. Keep the existing
retained-log replay and terminal-build safeguards; legacy snapshots fall
back to the writer's reason. Add the MySQL column before deploying.
@sbalabanov
sbalabanov force-pushed the sergeyb/sp-oct-001-terminal-reason branch from 92b3604 to fdecb29 Compare November 14, 2026 01:48
@cla-assistant

cla-assistant Bot commented Nov 14, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant

cla-assistant Bot commented Nov 14, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants