Repository navigation
Keep pending approvals across app restarts (#349) - #1692
Conversation
Solenta-Message-Id: 00d9a10c-0062-45ce-80c1-46a3d951ee2b
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f2d6bac47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if (approved) { | ||
| patch.restartGrant = saved.grantKey || null; | ||
| line = `[restart] The app restarted while ${card.summary} waited for approval. The user approved it: make that exact ${card.toolName} call again now; it will run without asking.`; |
There was a problem hiding this comment.
Expire unused restart grants after the resumed turn
The approval hash is persisted without a run identifier or expiry and is only cleared by takeRestartGrant. If the resumed turn finishes, fails, or is stopped before reissuing the exact call, the hash remains on the thread; a later unrelated turn that requests the same operation will therefore execute it without a fresh permission prompt. Scope the grant to the immediate resume run and clear it on every terminal or superseding path.
Useful? React with 👍 / 👎.
| if (p && !p.inputRequest) { | ||
| if (saved && saved.id === p.id) return; |
There was a problem hiding this comment.
Include the run when identifying an already-saved prompt
When a machine-delivered turn runs over a restored card, a provider can reuse the previous process's connection-local request ID, especially numeric JSON-RPC IDs. This early return then leaves the old card and old runId persisted instead of recording the new live ask; after the live ask is answered, the cleanup at lines 186-188 refuses to clear that old card because its run differs, so the stale approval reappears and can start another resume turn. Treat the prompt as synchronized only when both its ID and run ID match.
Useful? React with 👍 / 👎.
Quitting or crashing Solenta while an agent waited on a permission prompt used to lose the prompt: the CLI died, the card vanished, and the thread kept a "waiting" badge with nothing to answer. Now the card comes back after restart with the same tool, command, and context, and answering it picks the work back up. Closes #349.
Changes
pendingApproval) every time it changes, so a crash or quit finds it on disk. A user Stop, an answer, or a new human message clears it. Machine turns (notices, auto-resume) keep it, as they already do for question and plan cards.[restart]turn telling the agent to make that exact call again. The re-issued call (same tool and input, by hash) runs without a second card. Deny closes the card and starts no turn.Verification
electron/test/claude.test.js: ask →stopAll→ fresh Store and runner loaded from disk → the restored card matches → Allow → the fake CLI's re-ask is auto-allowed and the run finishes with no second card. Deny on a restored card closes it without starting a run. Both pass, along with the existing permission tests.npm run test:electron: 4938 pass / 19 fail. I re-ran the 10 failing files one at a time on a cleanHEADworktree and on this branch. Both show the same 3 failures (pdfjs, PTY, serve-web QR, all from the local environment); the other 16 only fail under full-suite load.tsc --noEmit: no errors in the files touched here. The remaining errors come from xterm/highlight.js/mermaid, which aren't installed locally.Notes for reviewers
profile.askrule, but only for the exact call the user just approved.reason, so a reworded re-ask also shows a second card.🤖 Generated with Claude Code