feat(kbagent): implement request-level timeout override and retry for action execution#10158
Merged
leon-ape merged 2 commits intoapecloud:mainfrom Apr 24, 2026
Merged
Conversation
… action execution The ActionRequest proto already defined TimeoutSeconds and RetryPolicy fields, and the controller-side lifecycle code already populated them, but the kbagent service-side handler ignored both fields entirely (marked with TODO comments). This commit: - Adds resolveTimeout() to let request-level TimeoutSeconds override the action-level default, giving callers per-request timeout control - Adds callActionWithRetry() to honor RetryPolicy with configurable max retries and interval, respecting context cancellation - Passes the resolved timeout through to non-blocking calls as well - Removes the 'TODO: not implemented' comments from proto.go
Collaborator
|
Auto Cherry-pick Instructions |
Contributor
Author
|
/nopick |
leon-ape
reviewed
Apr 24, 2026
| } | ||
|
|
||
| interval := retryPolicy.RetryInterval | ||
| if interval <= 0 { |
Contributor
There was a problem hiding this comment.
This should stay consistent with the API definition: when RetryInterval is 0, retries should happen without waiting.
When RetryInterval is 0, retries should happen without waiting per the API definition. Previously the code fell back to 1s for any interval<=0, which silently overrode an explicit zero-interval setting. Now only positive intervals trigger a sleep; zero means retry immediately.
leon-ape
approved these changes
Apr 24, 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
ActionRequestproto already definedTimeoutSecondsandRetryPolicyfields, and the controller-side lifecycle code (pkg/controller/lifecycle/kbagent.go) already populated them when calling kbagent. However, the kbagent service handler completely ignored both fields (marked with// TODO: not implementedcomments), always using the action-definition-level timeout and never retrying.What Changed
Request-level timeout override:
resolveTimeout()that prefersActionRequest.TimeoutSecondsoverAction.TimeoutSecondsRetry support:
callActionWithRetry()that honorsActionRequest.RetryPolicyMaxRetriestimes with configurableRetryInterval(defaults to 1s)Cleanup:
// TODO: not implementedcomments fromproto.goFiles Changed (2)
pkg/kbagent/proto/proto.go— removed TODO commentspkg/kbagent/service/action.go— added timeout resolution, retry logic, updated call paths