Skip to content

fix(cursor): deliver retained Task results after Steer - #487

Open
haohaomin wants to merge 1 commit into
leookun:mainfrom
haohaomin:codex/upstream-task-result-delivery
Open

haohaomin wants to merge 1 commit into
leookun:mainfrom
haohaomin:codex/upstream-task-result-delivery

Conversation

@haohaomin

Copy link
Copy Markdown

When a user sends a Steer message while a foreground Task is running, the Task can continue executing but its result is lost to the parent conversation. This change retains the original execution, appends its completion exactly once, and delivers the follow-up to Cursor even if the parent Run has already finished.

Behavior

  • Keep Task execs running across Steer while ordinary tools retain their interrupt behavior.
  • Settle the foreground wait with a non-error “still running” result; append the actual completion as a separate runtime event without rewriting provider history.
  • Own pending Task results at the conversation transport level. Deliver into an active parent Run, or continue the parent after its Run closes, preserving the original Task and checkpoint.
  • Publish the original tool completion and retain the Cursor interaction until pending results are delivered, so the reply is visible and the Task card reaches Completed.
  • Keep explicit cancellation, replacement, failure, and disconnect scoped to the original execution owner.

Related to #424: this includes the same narrow correction that keeps retained Tasks out of the interrupted set, and additionally handles foreground settlement, late-result delivery, and Cursor presentation. It is standalone against current main; it does not depend on merging #424.

Validation

  • 232 tests passed: lib (157), checkpoint_recovery (4), compaction (6), conversation_delivery (4), cursor_transport_lifecycle (2), error_lifecycle (7), interrupt (21), prefix_stability (13), tool_round (18).
  • cargo clippy --locked -p cursor-server --all-targets -- -D warnings passed.
  • cargo fmt --all -- --check and git diff --check passed.
  • Regression assertions cover completion before/after foreground detach, completion after the parent Run ends beyond the idle timeout, mixed Task/Read interruption, duplicate results, reused call IDs across rounds, explicit cancellation, append-only provider prefixes, checkpoint hydration, and exactly one visible Task completion/final turnEnded.
  • Local Rust commands used a command-scoped macOS 26.5 SDK and LLVM linker to avoid a host linker issue; no repository toolchain settings changed.

The same server implementation was also tested in real Cursor on macOS: one foreground Task ran a gated script, a Steer message produced “Acknowledged” while the original process remained alive, then releasing the gate produced the original random marker in the parent conversation and a Completed Task card. Trace inspection confirmed one Task, one Shell execution, one completion event, and one final turnEnded. That UI test preceded rebasing onto current upstream; the tests below were rerun on this PR branch.

Only server implementation and regression tests are included. No desktop UI, version, release workflow, updater, signing, fork customization, database schema, or local verification-report changes.

Pending execution ownership is transport-scoped and in memory; this does not add recovery of still-running Tasks across process restarts or transport replacement.

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