You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9ed7eb9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(desktop): stop every terminal operation, answer only from granted folders, and bound the outbox in bytes
- Stop reaches `input`, `kill` and pane `close`, not just `run` and `handoff`.
A Stop that lands while the session resolves means none of them starts.
A batch of keys or lines stops between keystrokes and says some input may
already have arrived.
- A terminal call stopped while it waited for the chat's previous operation
never reaches the terminal.
- Sign-out stops running actions before it waits on a reconcile in flight.
- The outbox budgets result data in UTF-8 bytes, so a journal of non-ASCII
results still reads back after a restart.
- A local read, grep, glob, list or stat answers only while its folder is
still granted when it finishes. This covers the chat view's path as well.
- Grep says when its results are truncated, as glob does.
- A doorbell stream that keeps closing as soon as it opens backs off instead
of reconnecting every second.
- The not-started results follow #8666's wording: what happened, that nothing
ran, and what the model should do instead of retrying.
'Not run: the Sim desktop app restarted before this action started, so nothing happened on the user’s computer.'
29
+
'Not run: this action never started, because the Sim desktop app restarted before it began. Nothing happened on the user’s computer. Do not retry it in this turn; tell the user, who can ask again.'
30
30
constOUTCOME_UNKNOWN_AFTER_RESTART=
31
31
'The Sim desktop app restarted while this action was running, so its result was lost. It may already have taken effect: inspect the current state before repeating it, and do not retry it automatically.'
32
32
constSTOPPED_BEFORE_START='Stopped before the Sim desktop app started this action.'
33
33
constSTOPPED_WHILE_RUNNING='Stopped while the Sim desktop app was running this action.'
34
34
constNOT_RECORDED=
35
-
'Not run: the Sim desktop app could not record this action on the user’s computer before starting it, so it did not start it.'
35
+
'Not run: this action never started, because the Sim desktop app could not record it on the user’s computer first. Nothing happened on the user’s computer. Do not retry it in this turn; tell the user, who can ask again later.'
36
36
constRESULT_TOO_LARGE=
37
37
'The action finished, but its result was too large to send back. Do not repeat a side-effecting action; inspect the current state instead.'
38
38
@@ -161,8 +161,16 @@ export class DesktopExecutor {
161
161
/** Sign-out: stops every action and forgets every call; the session that owned them is gone. */
162
162
asyncdispose(): Promise<void>{
163
163
this.disposed=true
164
-
// An inbox read in flight may still be claiming; let it see `disposed` before clearing.
164
+
conststopping=this.dropHeld()
165
+
// A claim still in flight sees `disposed` once Sim answers and is never held; the journal is
166
+
// cleared only after it, so its `claiming` record does not outlive the session.
165
167
awaitthis.reconciling?.catch(()=>{})
168
+
awaitPromise.all([stopping,this.dropHeld()])
169
+
awaitthis.options.journal.clear()
170
+
}
171
+
172
+
/** Releases every held call and stops the actions already running. */
173
+
privateasyncdropHeld(): Promise<void>{
166
174
constheld=[...this.held.values()]
167
175
for(constentryofheld)this.release(entry)
168
176
awaitPromise.allSettled(
@@ -173,7 +181,6 @@ export class DesktopExecutor {
173
181
returnthis.options.runner.cancel(entry.call)
174
182
})
175
183
)
176
-
awaitthis.options.journal.clear()
177
184
}
178
185
179
186
privateasyncreconcileOnce(): Promise<void>{
@@ -234,6 +241,7 @@ export class DesktopExecutor {
234
241
this.noteRequestFailure('Desktop call was not claimed',error,{ toolCallId })
235
242
return
236
243
}
244
+
if(this.disposed)return
237
245
// Best effort: an unrecorded token leaves `claiming`, which recovery treats conservatively.
Copy file name to clipboardExpand all lines: apps/desktop/src/main/desktop-executor/journal.ts
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -29,10 +29,10 @@ const JOURNAL_VERSION = 1
29
29
/** Results can carry a screenshot, so the bound is the size of a few of them. */
30
30
constMAX_JOURNAL_BYTES=64*1024*1024
31
31
/**
32
-
* Result data kept on disk across all entries. Encryption and base64 grow it by about a third,
33
-
* so a journal within this budget always reads back under {@link MAX_JOURNAL_BYTES}.
32
+
* Result data kept on disk across all entries, in UTF-8 bytes. Encryption and base64 grow it by
33
+
* about a third, so a journal within this budget always reads back under {@link MAX_JOURNAL_BYTES}.
34
34
*/
35
-
constMAX_PERSISTED_RESULT_CHARS=32*1024*1024
35
+
constMAX_PERSISTED_RESULT_BYTES=32*1024*1024
36
36
constRESULT_NOT_KEPT=
37
37
'The action finished, but its result was too large to keep on this computer. Do not repeat a side-effecting action; inspect the current state instead.'
38
38
@@ -41,10 +41,10 @@ const RESULT_NOT_KEPT =
41
41
* kept as finished without its data, so the file never grows past what a restart can read.
constmessage=`Not run: ${surface} is switched off in the Sim desktop app's settings, so nothing happened on the user's computer. Continue without it, or ask the user to switch it on.`
49
+
constmessage=`Not run: this action never started, because ${surface} is switched off in the Sim desktop app’s settings. Nothing happened on the user’s computer. Do not retry it in this turn; continue without it, or ask the user to switch it on.`
constmessage=`Not run: this version of the Sim desktop app cannot run ${toolName} in the background, so nothing happened on the user's computer.`
54
+
constmessage=`Not run: this action never started, because this version of the Sim desktop app cannot run ${toolName} in the background. Nothing happened on the user’s computer. Do not retry it in this turn; tell the user to update the Sim desktop app.`
0 commit comments