fix(actions): retry rejected action records - #7892
Conversation
|
This PR was flagged by our automated quality checks. If you're a genuine We appreciate your contribution and apologize if this is a false positive! |
There was a problem hiding this comment.
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
RecordActionresponses innotifyRunServiceand 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.
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>
215e037 to
3d0cb91
Compare
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, addresses the stated failure mode directly, and is covered by targeted new/updated tests for both rejection and missing-response scenarios.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
| resp, err := c.runClient.RecordAction(ctx, connect.NewRequest(recordReq)) | ||
| if err != nil { | ||
| logger.Warnf(ctx, "Failed to record action in run service for %s: %v", update.ActionID.Name, err) | ||
| } else if resp == nil || resp.Msg == nil || resp.Msg.GetStatus() == nil { |
There was a problem hiding this comment.
Is it that - buf does not always return errors
There was a problem hiding this comment.
Not a general Buf/Connect behavior. This handler returns application failures in resp.Msg.Status with err == nil; err only covers RPC-level failures. We therefore memoize only Status.Code == OK.
Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change is targeted and well-covered by tests, and the only remaining feedback is a minor readability concern (identifier shadowing) rather than correctness.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new SQL-building test helper is likely to be flagged by gosec without an explicit suppression/justification, which can block CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
…ode import Alias the googleapis rpc code package so it no longer shadows the local code variables in this file, and correct the comment to say a rejected action is memoized as recorded rather than never recorded. Document why the test table rename concatenates its identifiers. Signed-off-by: 1fanwang <1fannnw@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
The change directly addresses the described retry/dedup bug, matches RunService’s in-body status behavior, and is covered by focused new/updated tests for the failure and success paths.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
Tracking issue
N/A
Why are the changes needed?
An action can disappear from Flyte's run history after a repository failure.
RecordActionputs application failures inresp.Msg.Statuswhile returningerr == nil. The old client adds the failed action torecordedFilter, so it is never retried.It surfaced while checking whether #7852 applied to v2. V2 handles duplicates idempotently; its failure path was broken instead.
What changes were proposed in this pull request?
Only memoize an action after a non-nil response reports
Status.Code == OK. Keep every other result retryable and log rejected statuses.How was this patch tested?
A real
RunService, Connect handler, migrations, and embedded PostgreSQL returnedStatus=INTERNALwith no Connect error. The merge-base client stopped after one RPC; the PR retried until OK.Commands and raw output
Labels
fixed
Setup process
N/A
Screenshots
N/A
Check all the applicable boxes
Related PRs
#7852
Stack
Docs link
N/A