Skip to content

fix(cloud-task): recover pending permission prompts from the run log on reconnect#2471

Merged
tatoalo merged 1 commit into
mainfrom
fix/restore-pending-permission-on-reconnect
Jun 4, 2026
Merged

fix(cloud-task): recover pending permission prompts from the run log on reconnect#2471
tatoalo merged 1 commit into
mainfrom
fix/restore-pending-permission-on-reconnect

Conversation

@tatoalo
Copy link
Copy Markdown
Contributor

@tatoalo tatoalo commented Jun 3, 2026

Problem

when a cloud task is awaiting a permission or plan approval and the app restarts or the renderer reloads, the pending approve/deny prompt disappears and never comes back which affects the next message which hangs. closes #1833

pending_permission_render_failure_fix.mp4

Changes

unanswered permission requests are now surviving reconnects attempts and app reboots

@tatoalo tatoalo force-pushed the fix/restore-pending-permission-on-reconnect branch 2 times, most recently from d2a20e4 to f874d69 Compare June 3, 2026 11:10
@tatoalo tatoalo marked this pull request as ready for review June 3, 2026 11:30
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 3, 2026

Reviews (1): Last reviewed commit: "fix(cloud-task): restore pending permiss..." | Re-trigger Greptile

@tatoalo tatoalo requested a review from a team June 3, 2026 11:35
@tatoalo tatoalo force-pushed the fix/restore-pending-permission-on-reconnect branch from f874d69 to 09a9ec4 Compare June 3, 2026 13:54
@tatoalo tatoalo changed the title fix(cloud-task): restore pending permission request on renderer reload fix(cloud-task): recover pending permission prompts from the run log on reconnect Jun 3, 2026
@tatoalo tatoalo marked this pull request as draft June 3, 2026 13:58
@tatoalo tatoalo force-pushed the fix/restore-pending-permission-on-reconnect branch 2 times, most recently from 488df06 to 5699d3e Compare June 3, 2026 14:37
@tatoalo tatoalo force-pushed the fix/restore-pending-permission-on-reconnect branch from 5699d3e to 0ba0a99 Compare June 3, 2026 14:38
@tatoalo tatoalo self-assigned this Jun 3, 2026
@tatoalo tatoalo marked this pull request as ready for review June 3, 2026 14:38
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 3, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/features/sessions/service/service.ts:1523-1529
When a permission is recovered from the snapshot log on reconnect, `receivedAt` is set to `Date.now()` (the reconnect moment) rather than the time the permission was originally issued. `resolvePermission` uses `receivedAt` to accumulate `pausedDurationMs`, so for recovered permissions the metric only captures the post-reconnect wait time and silently drops however long the task was already paused before the restart. The log entry's `timestamp` field carries the original issue time and could be threaded through `derivePendingPermissionRequests` and `DerivedPermissionRequest` to preserve accuracy.

```suggestion
    const newPermissions = new Map(session.pendingPermissions);
    newPermissions.set(update.toolCall.toolCallId, {
      toolCall: update.toolCall as PermissionRequest["toolCall"],
      options: update.options as PermissionRequest["options"],
      taskRunId,
      receivedAt: update.receivedAt ?? Date.now(),
    });
```

Reviews (2): Last reviewed commit: "fix(cloud-task): recover pending permiss..." | Re-trigger Greptile

@tatoalo tatoalo merged commit af00a58 into main Jun 4, 2026
21 checks passed
@tatoalo tatoalo deleted the fix/restore-pending-permission-on-reconnect branch June 4, 2026 11:46
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.

Reloading the renderer on pending plan approval/permission, bricks the agent on the next response

2 participants