Skip to content

fix(session): clear bg jobs/wakes on delete; persist remote binding in checkpoint - #26

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-db6b
Draft

fix(session): clear bg jobs/wakes on delete; persist remote binding in checkpoint#26
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-db6b

Conversation

@cursor

@cursor cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Bugs fixed

1. Ghost injects after session delete/expire

Impact: Deleting or expiring a session left bash-job tracking and agent-wake registries in memory. When a background job finished or a wake fired, inject_turn could resurrect a removed session and push unsolicited turns.

Root cause: delete_session / expire_session evicted the core and registry but never cleared bash_job_notify or agent_wake per-session state.

Fix: _dispose_session_scheduled_work() clears job tracking and cancels pending wakes before evict.

2. Remote workspace lost on daemon restart

Impact: After /remote-use, a daemon restart dropped in-memory remote binding while chat history still indicated remote mode. Subsequent bash/file tools silently executed on the daemon host.

Root cause: RemoteWorkspaceState lived only in process memory; checkpoints did not persist it.

Fix: Persist remote_workspace in CoreCheckpoint and rehydrate via restore_remote_workspace_from_checkpoint() during restore_from_checkpoint().

Validation

  • tests/test_bash_job_notify.py::test_clear_session_job_tracking_drops_tracked_and_pending
  • tests/test_agent_wake.py::test_clear_session_agent_wakes_removes_scheduled_and_pending
  • tests/test_automation_core_gateway.py::test_gateway_delete_session_clears_background_tracking
  • tests/test_remote_workspace.py::test_remote_workspace_checkpoint_roundtrip
Open in Web View Automation 

…n checkpoint

- delete_session/expire_session now drop bash-job tracking and agent wakes
  so completed jobs or scheduled wakes cannot inject into removed sessions
- persist active remote workspace state in CoreCheckpoint and rehydrate on
  restore_from_checkpoint so daemon restart does not silently fall back to
  local bash/file execution while history still shows remote mode

Co-authored-by: Yuxuan Liu <Osc-7@users.noreply.github.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