Repository navigation
Keep CLI harness sessions in progress while background work is pending - #16367
Merged
Merged
Conversation
Contributor
Author
|
This PR was generated with Warp. Comment |
harryalbert
reviewed
Oct 8, 2026
Claude Code fires Stop at the end of every assistant turn, including turns that end while background tasks or session crons will wake the agent again. Treating each of those as task success made third-party harness runs flap between SUCCEEDED and IN_PROGRESS on every wake, notifying integrations and arming the idle-exit timer each time. The warp plugin (2.4.0) now reports pending background work on the stop event. A Stop that carries any is a pause rather than a completion: the session keeps its status, so no task state is reported and the idle timer is not armed, until a Stop with nothing pending arrives. finish-task and the exit-time fallback are unchanged. Replaces the debounce approach and requires warp plugin 2.4.0. Co-Authored-By: Warp <agent@warp.dev>
Contributor
|
@harryalbert, your Warp account is not a member of any team with access to this repository. |
|
@harryalbert, your GitHub account is not connected to Warp. Connect your GitHub account. |
Co-Authored-By: Warp <agent@warp.dev>
harryalbert
marked this pull request as ready for review
October 8, 2026 21:55
harryalbert
approved these changes
Oct 8, 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.


Description
Third-party harness runs (Claude Code) reported
SUCCEEDEDon every assistant turn andIN_PROGRESSon the next one, because thewarpplugin'sStophook was mapped 1:1 to task success. Claude Code starts turns on its own whenever background work completes (run_in_backgroundBash,Monitorwatches, subagents, session crons), so a run babysitting a build flapped between the two states on every wake — eachSUCCEEDEDfanning out to GitHub/Slack/Linear notifiers ("Warp has completed this task." per heartbeat), the lifecycle notifier, usage charging, and the idle-exit timer. The idle timer side also meant a run waiting on a long subagent could be/exited at--idle-on-completewhile the subagent was still running.Claude Code's
Stophook input includesbackground_tasksandsession_crons, which exist precisely to distinguish "session is done" from "session is paused waiting for background work to wake it back up". Thewarpplugin (2.4.0, warpdotdev/claude-code-warp#92) now forwards both counts on thestopevent. On the client, aStopthat carries pending work updates the session's context but leaves its status untouched: noStatusChangedis emitted, soLocalAgentTaskSyncModelreports nothing and the driver does not arm the idle timer, until aStopwith nothing pending arrives.finish-task, the/exitpath, and the exit-timeSUCCEEDEDfallback inAgentDriver::flush_task_status_before_exitare unchanged.MINIMUM_PLUGIN_VERSIONfor Claude moves to 2.4.0 per the plugin repo's versioning policy, so the driver updates older installs. The plugin PR must land first; until the marketplace serves 2.4.0, the (non-fatal) notification-plugin update step logs a failure on each run.This replaces the earlier debounce approach on this branch, which is fully reverted.
Known tradeoff: a background task that never finishes (or whose completion notification Claude Code drops) now keeps the run
IN_PROGRESSwith no idle timer until the sandbox deadline, instead of exiting at idle-on-complete.Linked Issue
Ad hoc intake; no tracked issue.
ready-to-specorready-to-implement. — No tracked issue.Testing
cargo nextest run -p warp cli_agent_sessions— 180 passed. Two new tests: astopwithbackground_task_count: 1leaves the sessionInProgresswhile still recording the response; astopwith zero counts still yieldsSuccess.cargo nextest run -p warp local_agent_task_sync_model plugin_manager— 135 passed (sync model is back tomaster).cargo clippy -p warp_core -p warp --all-targets --tests -- -D warnings— clean;./script/formatrun last.Confirmed Claude Code 2.1.252 populates
background_tasksfor an in-flight background shell task (Stop Search history by more than just command #1) and reports it empty on the post-notification turn (Stop Real-time collaboration #2).End-to-end on the local Oz stack (
script/oz-local, direct backend, this branch's bundle, local plugin checkout): a Claude run that startssleep 60; echo finishedin the background, replies, and is woken by the task-notification now produces exactly oneagent_startedand oneoz_run_done(at the final turn), versus two pairs before this change.I have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-BUG-FIX: Claude Code harness runs no longer report completion and re-open on every assistant turn while background tasks, subagents, or scheduled wakeups are still running; completion is reported once the session is actually idle, or immediately on finish-task.