Skip to content

Fix WS agent termination after graceful stop#492

Draft
Zakaria-Kofiro wants to merge 3 commits into
masterfrom
ws-terminate-agent-fix
Draft

Fix WS agent termination after graceful stop#492
Zakaria-Kofiro wants to merge 3 commits into
masterfrom
ws-terminate-agent-fix

Conversation

@Zakaria-Kofiro

@Zakaria-Kofiro Zakaria-Kofiro commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Route terminal WebSocket agent status through an application-scoped lifecycle handler so STOP completion schedules VM termination.
  • Preserve non-terminal WS status fallback to VMTracker while preventing terminal statuses from silently bypassing termination.
  • Add regression coverage for terminal WS status handling and lifecycle termination behavior.

Notes

  • HTTP status behavior is unchanged.
  • KILL behavior is unchanged.
  • WS status handling enforces the session-bound instanceId.
  • jobId remains sourced from the agent status payload, matching the existing HTTP path; binding it to the WS session can be handled as a follow-up hardening task.

Please make sure these check boxes are checked before submitting

  • ** Squashed Commits **
  • ** All Tests Passed ** - mvn clean test -P default

** PR review process **

  • Requires one +1 from a reviewer
  • Repository owners will merge your PR once it is approved.

@Zakaria-Kofiro Zakaria-Kofiro force-pushed the ws-terminate-agent-fix branch from 2d00aea to 4e3a179 Compare July 1, 2026 16:55
@Zakaria-Kofiro Zakaria-Kofiro changed the title Ws terminate agent fix Fix WS agent termination after graceful stop Jul 1, 2026
zkofiro and others added 2 commits July 2, 2026 12:23
…d lifecycle handler so STOP completion schedules VM termination without requiring a request-scoped controller bean
Schedule VM termination when the controller-initiated WebSocket path receives terminal agent status so STOP drains still clean up EC2 instances. Wire the existing VMTerminator into the WS client and cover terminal, duplicate, and reconnect status handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
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