Skip to content

fix(actions): retry rejected action records - #7892

Open
1fanwang wants to merge 2 commits into
flyteorg:mainfrom
1fanwang:record-action-check-body-status
Open

fix(actions): retry rejected action records#7892
1fanwang wants to merge 2 commits into
flyteorg:mainfrom
1fanwang:record-action-check-body-status

Conversation

@1fanwang

@1fanwang 1fanwang commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Why are the changes needed?

An action can disappear from Flyte's run history. The run service rejects the record,
but the client treats the request as successful and never sends it again.

Before this change, rejected or incomplete responses enter the dedup filter. After
this change, only an explicit OK status is memoized, so every other response is retried.

What changes were proposed in this pull request?

Check the response status before updating the dedup filter. Log the returned code and
message for rejections. A nil response, message, or status is treated as a failed
record attempt.

How was this patch tested?

The tests were kept in place while only the implementation file was switched between
the base branch and this PR.

$ git checkout upstream/main -- actions/k8s/client.go
$ go test ./actions/k8s/... -run 'TestNotifyRunService_(RejectedRecordAllowsRetry|MissingResponseAllowsRetry)' -v
--- FAIL: TestNotifyRunService_RejectedRecordAllowsRetry
    Expected number of calls (2); actual number of calls (1)
panic: runtime error: invalid memory address or nil pointer dereference

$ git checkout origin/record-action-check-body-status -- actions/k8s/client.go
$ go test ./actions/k8s/... -run 'TestNotifyRunService_(RejectedRecordAllowsRetry|MissingResponseAllowsRetry)' -v
--- PASS: TestNotifyRunService_RejectedRecordAllowsRetry
--- PASS: TestNotifyRunService_MissingResponseAllowsRetry
PASS

Labels

fixed

Setup process

N/A

Screenshots

N/A

Check all the applicable boxes

  • I updated the documentation accordingly. Not applicable: no documented behavior changed.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

N/A

Stack

Docs link

N/A

Copilot AI lite review requested due to automatic review settings August 20, 2026 20:19
@github-actions

Copy link
Copy Markdown

This PR was flagged by our automated quality checks. If you're a genuine
contributor, please reply here and a maintainer will review your PR.

We appreciate your contribution and apologize if this is a false positive!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a reliability gap in the Actions k8s client where InternalRunService.RecordAction failures can be returned as a successful transport response with a non-OK google.rpc.Status in the response body—previously causing rejected actions to be incorrectly deduplicated and never retried.

Changes:

  • Capture RecordAction responses in notifyRunService and only memoize the action key when the response-body status is OK.
  • Log response-body rejection status details when the run service rejects an action.
  • Add unit tests covering both “rejected stays retryable” and “accepted deduplicates” behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
actions/k8s/client.go Checks RecordAction response-body status before adding to the dedup filter; logs rejections.
actions/k8s/client_test.go Adds tests ensuring rejected records are retried and accepted records are deduplicated.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/k8s/client.go Outdated
Copilot AI review requested due to automatic review settings August 20, 2026 23:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@1fanwang 1fanwang changed the title Don't mark an action recorded when the run service rejected it fix(actions): retry rejected action records Aug 20, 2026
RecordAction reports application rejections in its body while returning a nil transport error. Memoizing those keys drops all retries, leaving rejected actions unrecorded. Only an explicit OK response is safe to memoize.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Copilot AI review requested due to automatic review settings August 21, 2026 18:49
@1fanwang
1fanwang force-pushed the record-action-check-body-status branch from 215e037 to 3d0cb91 Compare August 21, 2026 18:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +59 to +63
func acceptedRecordActionResponse() *connect.Response[workflow.RecordActionResponse] {
return connect.NewResponse(&workflow.RecordActionResponse{
Status: &status.Status{Code: int32(code.Code_OK)},
})
}
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Copilot AI review requested due to automatic review settings August 26, 2026 07:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +59 to +67
func acceptedRecordActionResponse() *connect.Response[workflow.RecordActionResponse] {
return connect.NewResponse(&workflow.RecordActionResponse{
ActionId: &common.ActionIdentifier{
Run: &common.RunIdentifier{Org: "org", Project: "proj", Domain: "dev", Name: "run"},
Name: "action",
},
Status: &status.Status{Code: int32(code.Code_OK)},
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants