fix(goal): stop daemon crash on goal pause; add graceful pause - #2802
Open
LoG1331 wants to merge 2 commits into
Open
fix(goal): stop daemon crash on goal pause; add graceful pause#2802LoG1331 wants to merge 2 commits into
LoG1331 wants to merge 2 commits into
Conversation
… continuation Aborting a pending goal continuation rejects the bookkeeping promise chain with an AbortError; with no catch attached, the rejection reached the telemetry unhandledRejection handler, which rethrows when it is the sole listener (print/server modes) — killing the kimi web process. Swallow the rejection in the bookkeeping chain (turn failures surface via turn.ended events) and never rethrow AbortError-shaped rejections from the telemetry handler.
Pausing a goal interrupts the in-flight goal turn. The engine already has the preserveLiveContinuation flag (used for blocked/complete transitions); expose it through pauseGoal and the session profile API as goal_control: "pause_graceful" so API clients (e.g. the web UI) can pause without cutting the running turn off mid-tool.
🦋 Changeset detectedLatest commit: ef0da5c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
You have reached your Codex rate limits. Please try again later. |
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.
Related Issue
Resolve #2801
Problem
Pausing a goal from the web UI (
kimi web/ kap-server) on a session with a queued or in-flight goal continuation killed the whole server process with an uncaughtAbortError: Goal continuation cancelled. Two layers combined:launchContinuationTurnhad nocatch, so aborting a pending continuation produced an unhandledAbortErrorrejection.unhandledRejectionhandler rethrows when it is the sole listener (print/server modes) — includingAbortError, which is expected cancellation noise. The TUI survives the same action because it registers its own rejection handling; the daemon does not.Additionally, pausing always interrupted the live goal turn mid-tool. The engine already had the
preserveLiveContinuationflag (used for blocked/complete transitions) but no API surface exposed it.What changed
turn.endedevents), and the telemetry rejection handler returns early forAbortErrorinstead of rethrowing it. Non-abort rejections still crash as before.pauseGoalaccepts apreserveLiveContinuationoption, exposed over the session profile API asgoal_control: "pause_graceful". Pausing this way lets the in-flight turn run to completion and simply stops further goal continuations.paused.Verification
unhandledRejectionlistener plus an unhandledAbortErrorrejection: original code exits with the reported stack shape; patched code survives. Non-abort rejections still exit.test/agent/goalsuite: 161/161 passing, including the new regression test.goal_control: "pause_graceful"mid-turn → 200 OK, the running turn completed normally (no tool interruption), goal transitioned topaused, no further continuations, daemon stayed alive.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.