GeezerVison is showing github.com — fix(server): scheduled-task runs no longer un-snooze the thread they … · patroza/t3code@4fd2486
File treeExpand file treeCollapse file tree Open diff view settings apps/server/src/orchestration-v2
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Orchestrator.ts +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7535,10 +7535,12 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio | 7535 | 7535 | }); | 7536 | 7536 | projection = applyToProjection(projection, event); | 7537 | 7537 | } | 7538 | | - // Background wakes and delegated completions continue work the user already snoozed, so | 7539 | | - // only a message someone actually sent ends the snooze. | | 7538 | + // Background wakes, delegated completions and scheduled-task runs continue work the user | | 7539 | + // already snoozed, so only a message someone actually sent ends the snooze. | 7540 | 7540 | const automaticWake = | 7541 | | - command.notification !== undefined || command.delegatedCompletion !== undefined; | | 7541 | + command.notification !== undefined || | | 7542 | + command.delegatedCompletion !== undefined || | | 7543 | + command.scheduledTaskId !== undefined; | 7542 | 7544 | if (projection.thread.snoozedUntil != null && !automaticWake) { | 7543 | 7545 | const now = yield* DateTime.now; | 7544 | 7546 | const thread: OrchestrationV2AppThread = { | |
Collapse file Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/runtimeLayer.test.ts +7-3Lines changed: 7 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12895,7 +12895,7 @@ it.layer(layerTest)("snooze queued runs", (it) => { | 12895 | 12895 | }), | 12896 | 12896 | ); | 12897 | 12897 |
| 12898 | | - it.effect.each(["notification", "user"] as const)( | | 12898 | + it.effect.each(["notification", "scheduled-task", "user"] as const)( | 12899 | 12899 | "a %s message on a snoozed thread keeps the snooze only when automatic", | 12900 | 12900 | (kind) => | 12901 | 12901 | Effect.gen(function* () { | @@ -12931,8 +12931,8 @@ it.layer(layerTest)("snooze queued runs", (it) => { | 12931 | 12931 | attachments: [], | 12932 | 12932 | modelSelection, | 12933 | 12933 | dispatchMode: { type: "queue_after_active" }, | 12934 | | - createdBy: kind === "user" ? "user" : "agent", | 12935 | | - creationSource: kind === "user" ? "web" : "provider", | | 12934 | + createdBy: kind === "notification" ? "agent" : "user", | | 12935 | + creationSource: kind === "notification" ? "provider" : "web", | 12936 | 12936 | ...(kind === "notification" | 12937 | 12937 | ? { | 12938 | 12938 | notification: { | @@ -12942,11 +12942,15 @@ it.layer(layerTest)("snooze queued runs", (it) => { | 12942 | 12942 | }, | 12943 | 12943 | } | 12944 | 12944 | : {}), | | 12945 | + ...(kind === "scheduled-task" | | 12946 | + ? { scheduledTaskId: ScheduledTaskId.make(`scheduled-task:${threadId}`) } | | 12947 | + : {}), | 12945 | 12948 | }); | 12946 | 12949 | const thread = (yield* orchestrator.getThreadProjection(threadId)).thread; | 12947 | 12950 | if (kind === "user") { | 12948 | 12951 | assert.isNull(thread.snoozedUntil); | 12949 | 12952 | } else { | | 12953 | + assert.isNotNull(thread.snoozedUntil); | 12950 | 12954 | assert.equal(DateTime.formatIso(thread.snoozedUntil!), snoozedUntil); | 12951 | 12955 | } | 12952 | 12956 | }), | |
|