Skip to content
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

feat: add ability to gracefully stop runs #950

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thedadams
Copy link
Contributor

Various parts of a tool execution cannot be stopped gracefully. For example,
non-streamed HTTP request can't be stopped gracefully. However, commands and
chat completions can be gracefully stopped by a user and the result returned.
An "ABORTED BY USER" message is added to such messages. Additionally, aborted
chat completion responses are not stored in the cache.

Signed-off-by: Donnie Adams [email protected]

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Comments suppressed due to low confidence (4)

pkg/sdkserver/routes.go:96

  • Breaking out of the event loop on receiving a run-finish event may leave subsequent events unprocessed. Consider ensuring that remaining events are either drained or that the behavior is properly documented.
if e.Type == runner.EventTypeRunFinish { break }

pkg/openai/client.go:606

  • [nitpick] Cancellation errors are being suppressed by setting err to nil when context.Canceled is detected. Verify that this behavior is intended so that genuine errors are not inadvertently hidden.
if errors.Is(err, context.Canceled) { err = nil }

pkg/engine/openapi.go:148

  • The update from using the ptr helper (i.e. ptr(result)) to directly taking the address of result should be reviewed to ensure it remains consistent with other parts of the code and preserves the intended behavior.
Result: &result,

pkg/runner/runner.go:674

  • [nitpick] The removal of the explicit copy of subCall.State (previously done via subState := *subCall.State) in favor of directly using WithResumeInput may introduce side effects related to state mutability. Confirm that this change correctly propagates the resume input without unintended modifications.
result, err := r.subCallResume(callCtx.Ctx, callCtx, monitor, env, subCall.ToolID, subCall.CallID, subCall.State.WithResumeInput(state.ResumeInput), toolCategory)

Various parts of a tool execution cannot be stopped gracefully. For example,
non-streamed HTTP request can't be stopped gracefully. However, commands and
chat completions can be gracefully stopped by a user and the result returned.
An "ABORTED BY USER" message is added to such messages. Additionally, aborted
chat completion responses are not stored in the cache.

Signed-off-by: Donnie Adams [email protected]
Signed-off-by: Donnie Adams <[email protected]>
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.

1 participant