Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preserve background work when thread settings change #24446

Openjuliusmarmingewants to merge 5 commits intomain fromrefs/pull/24446/headopened View on GitHub

Showing 4 changed files with 121 additions and 24 deletions (loading 2).

x
0 of 4 viewed, 4 left
4 additions and 1 deletionapps/mobile/src/state/use-thread-outbox-drain.tsModified
View file
@@ -183,8 +183,11 @@
​
+// A refused settings change stays refused under its command id, so each retry
+// needs its own, even after a remount: the server can refuse one while
+// background work runs.
function settingsCommandId(message: QueuedThreadMessage, setting: string): CommandId {
- return CommandId.make(`${message.commandId}:${setting}`);
+ return CommandId.make(`${message.commandId}:${setting}:${randomHex(8)}`);
​
export async function prepareQueuedMessageAttachments(
117 additions and 23 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -917,6 +917,9 @@
​
+const BACKGROUND_WORK_REFUSAL =
+ "Background work is still running in this thread, and this change would end it. Try again once it finishes, or stop the thread first.";
+​
const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(function* () {
const checkpointService = yield* CheckpointServiceV2;
const commandPolicy = yield* CommandPolicyV2;
@@ -1332,8 +1335,14 @@
: cause;