Skip to content

fix: make stop agent button immediately kill running agent#177

Merged
joshjon merged 2 commits intomainfrom
verve/task-26
Mar 13, 2026
Merged

fix: make stop agent button immediately kill running agent#177
joshjon merged 2 commits intomainfrom
verve/task-26

Conversation

@joshjon
Copy link
Copy Markdown
Collaborator

@joshjon joshjon commented Mar 13, 2026

Summary

Stop agents button now integrated with a dedicated stop-poll channel so workers receive stop signals immediately with O(1) connection overhead. Additionally, epic planning agents had no stop mechanism — this adds one mirroring the task pattern.

Changes

  • Add poll-based stop delivery: workers long-poll GET /agent/poll?accept=stop via a dedicated stopPollLoop goroutine, receiving task and epic stop signals immediately
    • Replace WatchStop/UnwatchStop/notifyStop in task.Store with a stop queue (queueStop/WaitForStop/DrainStops)
    • Simplify TaskHeartbeat to a simple request/response ping (no long-polling); stopped field retained as
      safety net
    • Add StopEpic to epic.Store: validates planning+claimed state, appends session log, releases claim, sets draft status
    • Add POST /epics/:id/stop endpoint and wire through to UI with a "Stop Planning" button
    • Enhance EpicHeartbeat to return JSON with stopped field instead of 204
    • Add worker context tracking (runningCtxs) so stop signals cancel running containers immediately
    • Add tests for stop queue, poll-based stop delivery, epic stop, and simplified heartbeat

Verve Agent and others added 2 commits March 13, 2026 02:44
The heartbeat endpoint now uses long-polling: when a task is still
running, the server holds the connection for up to 4 seconds waiting
for a stop signal. When StopTask is called, it immediately notifies
the held heartbeat request via an in-process channel, causing the
worker to cancel the agent container within milliseconds instead of
waiting up to 5 seconds for the next polling cycle.

Changes:
- Add WatchStop/UnwatchStop/notifyStop to task.Store for in-process
  stop signal propagation
- Convert heartbeat handler from immediate-response to long-polling
  with configurable hold duration (4s default)
- StopTask now closes the stop channel to wake any waiting heartbeat

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joshjon joshjon merged commit 2d28d75 into main Mar 13, 2026
4 checks passed
@joshjon joshjon deleted the verve/task-26 branch March 13, 2026 06:10
@github-actions
Copy link
Copy Markdown

📸 UI Screenshots

Captured 64 screenshots from this PR.

Conversation

conversation detail

conversation detail

conversation detail (Mobile)

conversation detail (Mobile)

conversation list

conversation list

conversation list empty

conversation list empty

conversation list empty (Mobile)

conversation list empty (Mobile)

conversation list (Mobile)

conversation list (Mobile)

conversation pending

conversation pending

conversation pending (Mobile)

conversation pending (Mobile)

conversation rich markdown

conversation rich markdown

conversation rich markdown (Mobile)

conversation rich markdown (Mobile)

conversation with epic

conversation with epic

conversation with epic (Mobile)

conversation with epic (Mobile)

Create

create epic dialog

create epic dialog

create epic dialog (Mobile)

create epic dialog (Mobile)

create task dialog

create task dialog

create task dialog (Mobile)

create task dialog (Mobile)

Dashboard

dashboard

dashboard

dashboard (Mobile)

dashboard (Mobile)

Edit

edit task dialog

edit task dialog

edit task dialog (Mobile)

edit task dialog (Mobile)

Epic

epic active

epic active

epic active (Mobile)

epic active (Mobile)

epic draft

epic draft

epic draft (Mobile)

epic draft (Mobile)

epic planning claimed

epic planning claimed

epic planning claimed (Mobile)

epic planning claimed (Mobile)

epic planning

epic planning

epic planning (Mobile)

epic planning (Mobile)

epic ready

epic ready

epic ready (Mobile)

epic ready (Mobile)

epic redirect

epic redirect

epic redirect (Mobile)

epic redirect (Mobile)

Metrics

metrics dashboard

metrics dashboard

metrics dashboard (Mobile)

metrics dashboard (Mobile)

Mobile

mobile bottom bar epics

mobile bottom bar epics

mobile bottom bar epics (Mobile)

mobile bottom bar epics (Mobile)

mobile bottom bar tasks

mobile bottom bar tasks

mobile bottom bar tasks (Mobile)

mobile bottom bar tasks (Mobile)

Repo

repo settings dialog

repo settings dialog

repo settings dialog (Mobile)

repo settings dialog (Mobile)

repo setup configuring

repo setup configuring

repo setup configuring (Mobile)

repo setup configuring (Mobile)

repo setup needs setup

repo setup needs setup

repo setup needs setup (Mobile)

repo setup needs setup (Mobile)

repo setup pending

repo setup pending

repo setup pending (Mobile)

repo setup pending (Mobile)

repo setup scanning

repo setup scanning

repo setup scanning (Mobile)

repo setup scanning (Mobile)

repo setup wizard

repo setup wizard

repo setup wizard empty stack

repo setup wizard empty stack

repo setup wizard empty stack (Mobile)

repo setup wizard empty stack (Mobile)

repo setup wizard (Mobile)

repo setup wizard (Mobile)

Task

task detail

task detail

task detail (Mobile)

task detail (Mobile)

task not ready

task not ready

task not ready (Mobile)

task not ready (Mobile)

task pr view

task pr view

task pr view (Mobile)

task pr view (Mobile)

task retry pending

task retry pending

task retry pending (Mobile)

task retry pending (Mobile)

task retry running

task retry running

task retry running (Mobile)

task retry running (Mobile)

task running

task running

task running (Mobile)

task running (Mobile)


Workflow run

github-actions Bot added a commit that referenced this pull request Mar 13, 2026
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