authorgravatar for 76637177+SunkenInTime@users.noreply.github.comDara Adedeji <76637177+SunkenInTime@users.noreply.github.com> 2026-10-02 17:07:18-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-02 14:07:18-07:00
log8bc40b4e07bb7b4b0f71876d59520360c9bf958c
treebad1abc23a92d0cfbb83684d3c4a7b6c14561122
parentcc1e634bfa62edd56ff792eea666e436fdef788f
signature Signed by PGP key B5690EEEBB952194

fix(server): idle shells stop reloading every project once a minute (#14893)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

1 files changed, 28 insertions(+), 9 deletions(-)

apps/server/src/ws.ts+28-9
...@@ -948,16 +948,35 @@ export const subscribeOrchestrationV2Shell = Effect.fn("ws.orchestrationV2.subsc...@@ -948,16 +948,35 @@ export const subscribeOrchestrationV2Shell = Effect.fn("ws.orchestrationV2.subsc
948 const enrichmentRefreshes = Stream.fromSubscription(enrichmentChanges).pipe(948 const enrichmentRefreshes = Stream.fromSubscription(enrichmentChanges).pipe(
949 Stream.filter((change) => change.repositoryIdentityResolved),949 Stream.filter((change) => change.repositoryIdentityResolved),
950 Stream.groupedWithin(64, Duration.millis(25)),950 Stream.groupedWithin(64, Duration.millis(25)),
951 // Build the refresh from the identities the changes carry. Re-enriching
952 // every project here re-requested each expired root, whose resolution
953 // published again, so one expiry kept every subscriber reloading every
954 // project's metadata once a minute.
951 Stream.mapEffect((changes) =>955 Stream.mapEffect((changes) =>
952 applicationEvents.latestApplicationSequence.pipe(956 Effect.gen(function* () {
953 Effect.flatMap(loadProjectMetadataSnapshot),957 const identities = new Map(
954 Effect.map(({ snapshot }) =>958 Array.from(changes, (change) => [
955 shellStreamItemFromEnrichmentRefresh({959 change.workspaceRoot,
956 snapshot,960 change.enrichment.repositoryIdentity,
957 changes: Array.from(changes),961 ]),
958 }),962 );
959 ),963 const snapshotSequence = yield* applicationEvents.latestApplicationSequence;
960 ),964 const changedProjects = (yield* projects.listShells()).flatMap((project) =>
965 identities.has(project.workspaceRoot)
966 ? [{ ...project, repositoryIdentity: identities.get(project.workspaceRoot) ?? null }]
967 : [],
968 );
969 return shellStreamItemFromEnrichmentRefresh({
970 snapshot: {
971 schemaVersion: ORCHESTRATION_V2_PROJECTION_SCHEMA_VERSION,
972 snapshotSequence,
973 projects: changedProjects,
974 threads: [],
975 archivedThreads: [],
976 } as OrchestrationV2ShellSnapshot,
977 changes: Array.from(changes),
978 });
979 }),
961 ),980 ),
962 );981 );
963982