-
Notifications
You must be signed in to change notification settings - Fork 41
When rejected, stamp status comment to trtc #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -703,7 +703,7 @@ func (r *TaskRunToolCallReconciler) setStatusError(ctx context.Context, trtcStat | |
| return ctrl.Result{}, nil, true | ||
| } | ||
|
|
||
| func (r *TaskRunToolCallReconciler) updateTRTCStatus(ctx context.Context, trtc *kubechainv1alpha1.TaskRunToolCall, trtcStatusType kubechainv1alpha1.TaskRunToolCallStatusType, trtcStatusPhase kubechainv1alpha1.TaskRunToolCallPhase, statusDetail string) (ctrl.Result, error, bool) { | ||
| func (r *TaskRunToolCallReconciler) updateTRTCStatus(ctx context.Context, trtc *kubechainv1alpha1.TaskRunToolCall, trtcStatusType kubechainv1alpha1.TaskRunToolCallStatusType, trtcStatusPhase kubechainv1alpha1.TaskRunToolCallPhase, statusDetail string, result string) (ctrl.Result, error, bool) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the signature of this method is getting really big - 6 params, 5 of them strings coming through now...is this really better than passing in a struct or doing it inline?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a blocker just something to think about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I had that thought as I was rolling through, will peek at this on incoming updates.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was leaning |
||
| logger := log.FromContext(ctx) | ||
|
|
||
| trtcDeepCopy := trtc.DeepCopy() | ||
|
|
@@ -712,6 +712,10 @@ func (r *TaskRunToolCallReconciler) updateTRTCStatus(ctx context.Context, trtc * | |
| trtcDeepCopy.Status.StatusDetail = statusDetail | ||
| trtcDeepCopy.Status.Phase = trtcStatusPhase | ||
|
|
||
| if trtcStatusType == kubechainv1alpha1.TaskRunToolCallStatusTypeToolCallRejected { | ||
| trtcDeepCopy.Status.Result = result | ||
| } | ||
|
|
||
| if err := r.Status().Update(ctx, trtcDeepCopy); err != nil { | ||
| logger.Error(err, "Failed to update status") | ||
| return ctrl.Result{}, err, true | ||
|
|
@@ -789,12 +793,12 @@ func (r *TaskRunToolCallReconciler) handlePendingApproval(ctx context.Context, t | |
| return r.updateTRTCStatus(ctx, trtc, | ||
| kubechainv1alpha1.TaskRunToolCallStatusTypeReadyToExecuteApprovedTool, | ||
| kubechainv1alpha1.TaskRunToolCallPhasePending, | ||
| "Ready to execute approved tool") | ||
| "Ready to execute approved tool", "") | ||
| } else { | ||
| return r.updateTRTCStatus(ctx, trtc, | ||
| kubechainv1alpha1.TaskRunToolCallStatusTypeToolCallRejected, | ||
| kubechainv1alpha1.TaskRunToolCallPhaseFailed, | ||
| "Tool execution rejected") | ||
| "Tool execution rejected", status.GetComment()) | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document the new
resultparameter inupdateTRTCStatus. Update function comment to note thatresultis used only whentrtcStatusTypeindicates rejection.