fix(cloud-task): resume terminal cloud runs with the selected question answer#3215
Merged
Merged
Conversation
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "fix(cloud-task): resume a terminal cloud..." | Re-trigger Greptile |
b15cdd4 to
8f04d50
Compare
…on answer When a terminal cloud run has a pending AskUserQuestion request, clicking the recovered card cannot proxy a permission_response to the dead sandbox. Route selected question answers through the terminal resume path as the next user message, refresh stale run status before responding, and recover pending question cards from persisted session logs after app restart. Keep resumed single-answer prompts user-facing by sending only the selected answer, while still dropping plain approvals on dead runs instead of spinning a pointless resume. Generated-By: PostHog Code
8f04d50 to
d882085
Compare
There was a problem hiding this comment.
The PR exceeds the size gate ceiling (712 lines vs 500L limit), requiring human review. The logic itself looks sound — focused fix for terminal cloud run permission handling with good test coverage — but this threshold requires a human sign-off before auto-approval can proceed.
Contributor
|
Reviews (2): Last reviewed commit: "fix(cloud-task): resume a terminal cloud..." | Re-trigger Greptile |
jonathanlab
approved these changes
Jul 7, 2026
tatoalo
added a commit
that referenced
this pull request
Jul 7, 2026
…tches and restarts Since questions relay over the durable event stream (#3199, #3215), users report that switching chats resets answered questions. Two gaps cause it: 1. The question card held its in-progress step answers in component state. Switching chats unmounts the card, so every answer selected so far was wiped and the card restarted at question 1 on return. The answers now live in a view store keyed by toolCallId, and the card restores them (including free-text input, via a new ActionSelector initialCustomInput seed) on remount. Submit and cancel clear the draft. 2. A question answered after its run terminalized (the resume-as-prompt path) never got a `_posthog/permission_resolved` record: the sandbox that would write one is gone, so the request stays pending in the persisted log forever and any log derivation that escapes the in-memory guards (app restart, another device, a session rebuild) re-surfaces the answered question as a fresh card. The client now appends the resolved marker to the owning run's log itself, tracks responded requestIds so stale snapshots (a marker not yet flushed to storage) cannot re-add them, and the watcher dedups replayed permission_request frames by stream id — they previously bypassed the seenEventIds guard entirely. Generated-By: PostHog Code Task-Id: 9c723d92-b8ef-4c9f-9317-2f53b4644f33
tatoalo
added a commit
that referenced
this pull request
Jul 7, 2026
…tches and restarts Since questions relay over the durable event stream (#3199, #3215), users report that switching chats resets answered questions. Two gaps cause it: 1. The question card held its in-progress step answers in component state. Switching chats unmounts the card, so every answer selected so far was wiped and the card restarted at question 1 on return. The answers now live in a view store keyed by toolCallId, and the card restores them (including free-text input, via a new ActionSelector initialCustomInput seed) on remount. Submit and cancel clear the draft. 2. A question answered after its run terminalized (the resume-as-prompt path) never got a `_posthog/permission_resolved` record: the sandbox that would write one is gone, so the request stays pending in the persisted log forever and any log derivation that escapes the in-memory guards (app restart, another device, a session rebuild) re-surfaces the answered question as a fresh card. The client now appends the resolved marker to the owning run's log itself, tracks responded requestIds so stale snapshots (a marker not yet flushed to storage) cannot re-add them, and the watcher dedups replayed permission_request frames by stream id — they previously bypassed the seenEventIds guard entirely. Generated-By: PostHog Code Task-Id: 9c723d92-b8ef-4c9f-9317-2f53b4644f33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Answering a question on a completed cloud run went nowhere. When a cloud run terminalizes with an unanswered
AskUserQuestion, its log carries a_posthog/permission_requestwith no resolution, so the desktop recovers and renders the question card.Follow-up to #3199, which made questions on cloud runs relay and park instead of auto-resolving — this completes the loop so the user's late answer actually reaches the agent.
Changes
respondToPermissioninsessionServicenow branches on terminal cloud runs: instead of proxying apermission_response, it formats the selected answer and routes it throughsendCloudPromptformatPermissionAnswerPromptbuilds the resume prompt: each question quoted above its answer, with fallbacks for free-text input and bare option picks. Plain approvals returnnull— approving a tool call that no longer exists shouldn't spin a run — so those responses are dropped with a log line.cancelPermissionon a terminal cloud run resolves the card locally without proxying a command that can't succeed.