mirror of
https://github.com/cline/cline.git
synced 2026-09-01 15:11:04 +08:00
eef7958cad
* fix(core): keep hub session status truthful across queue-drained turns Queue-drained turns settle only through the event stream, but the hub runtime host mistranslated their lifecycle in two ways: - session.updated events carrying only a snapshot (persistence updates) defaulted the projected status to "running". When one trailed the final idle update after a turn, clients that track busy state from status events (the desktop sidecar's workspace restore gate) stayed busy forever. Use the snapshot's real status and emit nothing when neither source reports one. - the per-run agent.done dedup was only reset by run.started, which the daemon-side queue drain never publishes, so a drained turn's done was swallowed as a duplicate of the previous turn's. Reset the dedup on session.pending_prompt_submitted, and suppress stale run.completed events that land inside a drained turn's window so they can neither emit a phantom done nor consume the drained turn's dedup slot. Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com> * test(desktop): cover restore unlock after an event-settled queued turn Exports the sidecar's core-session event handler so the queued-turn lifecycle (busy via status events, cleared by the done agent event, restore allowed afterwards) is testable end-to-end. Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com> * fix(core): start interactive sessions without a prompt as idle The runtime host reported every new session as "running" until its first turn ended. Interactive hosts (the desktop app) start sessions with no prompt and dispatch turns through separate send calls, so a created-but-never-prompted session stayed "running" forever — wedging clients that gate workspace operations (checkpoint restore, message edit) on active turns. Interactive no-prompt starts now begin idle, start emits the session's actual status (resumed sessions no longer masquerade as running), and markTurn* transitions keep tracking in-memory status for lazily persisted sessions so the first turn still reports running -> idle. Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com> * style: format hub-runtime-host test filter Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com> * refactor: drop the drained-turn done bookkeeping, keep the minimal fix The stuck restore is fully explained by the two status defects (fabricated "running" from snapshot-only session.updated events, and never-prompted interactive sessions reporting "running"). The done-dedup machinery for queue-drained turns addressed a separate cosmetic gap (queued turns emit no chat_done, pre-existing) and required fragile run-window heuristics, so it is removed to keep this change reviewable. Sidecar test now settles the queued turn through the status event, matching the shipped mechanism. Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com> * docs(sdk): document the truthful session-status contract --------- Co-authored-by: Saoud Rizwan <saoudrizwan@users.noreply.github.com>