Skip to content

fix(coding-agent): separate active commands from queued input - #565

Open
snimu wants to merge 4 commits into
mainfrom
fix/session-input-active-state
Open

fix(coding-agent): separate active commands from queued input#565
snimu wants to merge 4 commits into
mainfrom
fix/session-input-active-state

Conversation

@snimu

@snimu snimu commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stop exposing executing /compact, /refine, /goal, and /autonomous commands as queued steering or follow-up input
  • separate pending queue state from active session-input work for admission, cron, heartbeats, agent messaging, daemon activity, and Agents View
  • prevent queued /compact from treating itself as successor work and unnecessarily deferring compaction-triggered refinement
  • make headless completion wait for the full session scheduler, not only model idleness
  • expose optional active-input state to connection and RPC clients while preserving legacy daemon busy counts for mixed-version shutdown and update safety

Validation

  • 736 tests passed across 22 headless, session scheduling, print, JSON, RPC, connection, daemon, restart, and Agents View suites
  • 19 real daemon-worker client-mode process tests passed, covering print, JSON, RPC EOF draining, and worker ownership
  • 14 credential-gated live RPC tests were skipped; equivalent faux-provider and real local daemon-worker paths passed
  • npm run check

Note

Medium Risk
Touches session input scheduling, headless exit timing, and daemon peer summaries; wrong busy/queue classification could affect admission, heartbeats, and multi-client views, but changes are narrowly scoped to separating active commands from the durable queue.

Overview
Executing slash commands (e.g. /compact) no longer show up in user-visible queued steering or follow-up previews or empty session_action_update queue projections while they run; tests assert queuedActionCount stays 0 and unfinishedActionCount tracks the in-flight command until it finishes.

The daemon supervisor now triggers refreshWorkerSummaries on session_action_update session events (alongside turn start/end), so remote Agents View peers pick up active vs queued input changes without waiting for a turn boundary. Headless completion is covered by tests to block until an executing session command completes, not only model idleness.

Changelog records the queued-input display fix.

Reviewed by Cursor Bugbot for commit 7ec7438. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Separate executing slash commands from queued input in coding agent

  • Ensures executing slash commands (e.g. /compact) are tracked via unfinishedActionCount rather than appearing as queued steering or follow-up messages (queuedActionCount).
  • Extends DaemonSupervisor.handleWorkerFrame to call refreshWorkerSummaries on session_action_update events, so remote agent peers stay in sync with input activity.
  • waitForHeadlessCompletion now waits for an executing session command to finish before settling.
  • Adds tests in agent-session-queue.test.ts and daemon-supervisor-monitor.test.ts covering the new counts and headless-completion behavior.

Macroscope summarized 7ec7438.

@snimu
snimu marked this pull request as ready for review July 30, 2026 17:33
Comment thread packages/coding-agent/src/modes/daemon/daemon-session-list.ts Outdated
@snimu
snimu marked this pull request as draft July 30, 2026 17:55
Comment thread packages/coding-agent/src/modes/daemon/daemon-mode.ts Outdated
@snimu
snimu marked this pull request as ready for review July 30, 2026 20:25
Comment thread packages/coding-agent/src/core/agent-session.ts
… into local-session-input-active-state

# Conflicts:
#	packages/coding-agent/CHANGELOG.md
#	packages/coding-agent/src/core/agent-messages.ts
#	packages/coding-agent/src/core/agent-session.ts
#	packages/coding-agent/src/core/cron-jobs.ts
#	packages/coding-agent/src/modes/agent-connection/snapshot.ts
#	packages/coding-agent/src/modes/agent-connection/types.ts
#	packages/coding-agent/src/modes/agents-view/agents-view-state.ts
#	packages/coding-agent/src/modes/daemon/daemon-mode.ts
#	packages/coding-agent/src/modes/daemon/daemon-session-list.ts
#	packages/coding-agent/src/modes/daemon/daemon-session-summarizer.ts
#	packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
#	packages/coding-agent/src/modes/headless-completion.ts
#	packages/coding-agent/src/modes/rpc/rpc-mode.ts
#	packages/coding-agent/src/modes/rpc/rpc-types.ts
#	packages/coding-agent/test/agent-session-recursion.test.ts
#	packages/coding-agent/test/agent-session-services.test.ts
#	packages/coding-agent/test/agents-view-state.test.ts
#	packages/coding-agent/test/cron-jobs.test.ts
#	packages/coding-agent/test/daemon-mode.test.ts
#	packages/coding-agent/test/daemon-session-list.test.ts
#	packages/coding-agent/test/print-mode.test.ts
#	packages/coding-agent/test/suite/agent-session-queue.test.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7ec7438. Configure here.

} else if (
sessionEventType === "turn_start" ||
sessionEventType === "turn_end" ||
sessionEventType === "session_action_update" ||

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overlapping refreshes can stale peer state

Medium Severity

session_action_update now kicks off refreshWorkerSummaries on every queue snapshot change, but those list RPCs are not serialized or coalesced. A slower earlier refresh can overwrite a later one, so remote peer summaries can keep a finished command as unfinished work.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7ec7438. Configure here.

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