Skip to content

fix(cloud-task): recover queued messages after sandbox stops#3046

Merged
tatoalo merged 4 commits into
mainfrom
feat/agent-server-stop-exec
Jul 1, 2026
Merged

fix(cloud-task): recover queued messages after sandbox stops#3046
tatoalo merged 4 commits into
mainfrom
feat/agent-server-stop-exec

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Cloud task runs can remain in_progress after the backing sandbox has stopped. When the renderer is disconnected in that state, a follow-up message is queued behind the agent-ready guard, but no fresh run_started or turn_complete event arrives to drain it.

Changes

  • propagate task-run state.sandbox_alive through cloud task watcher status and snapshot updates
  • refetch run detail during retry for already-hydrated watchers so reconnects surface the current sandbox liveness
  • force-drain a stranded queued cloud message when the server reports the sandbox is stopped and the local session is disconnected or errored

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(cloud-task): recover queued messages..." | Re-trigger Greptile

@tatoalo tatoalo force-pushed the feat/agent-server-stop-exec branch from ccf9c40 to 11283ab Compare July 1, 2026 09:01
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 15e43ae.

@tatoalo tatoalo self-assigned this Jul 1, 2026
@tatoalo tatoalo marked this pull request as ready for review July 1, 2026 09:09
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 1, 2026
github-actions[bot]
github-actions Bot previously approved these changes Jul 1, 2026

@github-actions github-actions 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.

The bot comment about missing coverage for the "error" status was already addressed in the current diff — the new integration test uses it.each(["disconnected", "error"]) to cover both cases. The core logic is well-guarded: the force-flush path only fires when sandboxAlive === false AND the session is disconnected/error AND not prompt-pending, which is a safe, narrowly scoped recovery path. Interface additions are optional and backward-compatible, and the retry() return-type change to Promise<void> is non-breaking for existing callers.

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "test(cloud-task): cover error status san..." | Re-trigger Greptile

@github-actions github-actions Bot dismissed their stale review July 1, 2026 09:57

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes Jul 1, 2026

@github-actions github-actions 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.

No showstoppers. The sandbox-stopped recovery path is narrowly guarded (sandboxAlive===false AND disconnected/error AND not prompt-pending AND reentrancy lock), the interface additions are optional and backward-compatible, and the previously flagged missing coverage for the "error" status is addressed in the current diff via it.each.

@github-actions github-actions Bot dismissed their stale review July 1, 2026 10:09

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

@github-actions github-actions 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.

Narrowly scoped bug fix with solid guards: the force-flush path fires only when sandboxAlive === false AND the session is disconnected/error AND not prompt-pending, with the existing reentrancy lock preventing double-fires. Interface additions are optional and backward-compatible, the retry() async signature change is safe for void callers, and the previously flagged missing "error" status coverage is addressed via it.each.

@tatoalo tatoalo merged commit ddbce59 into main Jul 1, 2026
23 checks passed
@tatoalo tatoalo deleted the feat/agent-server-stop-exec branch July 1, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant