Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): keep Claude background work alive past idle pin limit #29354

Openvoltcrash(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/29354/headopened View on GitHub

Showing 2 changed files with 66 additions and 11 deletions.

x
0 of 2 viewed, 2 left
42 additions and 0 deletionsapps/server/src/orchestration-v2/ProviderSessionManager.test.tsModified
View file
@@ -3820,6 +3820,48 @@
+it.effect.each([true, false])(
+ "ProviderSessionManagerV2 only expires background work's idle pin when it can survive process exit (process-bound: %s)",
+ (backgroundTasksEndWithProcess) =>
+ Effect.gen(function* () {
+ const state = yield* Ref.make(emptyState);
+ const pending = yield* Ref.make(true);
+ const effect = Effect.gen(function* () {
+ const manager = yield* ProviderSessionManager.ProviderSessionManagerV2;
+ const { providerSessionId, rosters } = yield* openSessionWithBackgroundCommand(
+ "provider-session-manager-background-pin",
+ );
+​
+ yield* TestClock.adjust("5 hours");
+​
+ assert.equal(yield* manager.isLive(providerSessionId), backgroundTasksEndWithProcess);
+ assert.equal((yield* Ref.get(state)).closeCount, backgroundTasksEndWithProcess ? 0 : 1);
+ assert.deepStrictEqual(yield* rosters, [["dev-server"], ["dev-server"]]);
+​
+ yield* Ref.set(pending, false);
+ yield* TestClock.adjust("30 minutes");
+​
+ assert.isFalse(yield* manager.isLive(providerSessionId));
+ assert.equal((yield* Ref.get(state)).closeCount, 1);
+ assert.deepStrictEqual(yield* rosters, [
+ backgroundTasksEndWithProcess ? [] : ["dev-server"],
+ ["dev-server"],