fix(cloud-task): recover pending permission prompts from the run log on reconnect#2471
Merged
Merged
Conversation
d2a20e4 to
f874d69
Compare
Contributor
|
Reviews (1): Last reviewed commit: "fix(cloud-task): restore pending permiss..." | Re-trigger Greptile |
f874d69 to
09a9ec4
Compare
488df06 to
5699d3e
Compare
5699d3e to
0ba0a99
Compare
Contributor
Prompt To Fix All With AIFix 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 |
jonathanlab
approved these changes
Jun 4, 2026
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
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