Open History to see the last commit
1import {
2 EnvironmentId,
3 EventId,
4 MessageId,
5 ORCHESTRATION_V2_WS_METHODS,
6 TurnItemId,
7 type OrchestrationV2ThreadHistoryPage,
8 type OrchestrationV2ThreadProjection,
9 type OrchestrationV2ThreadDetailSnapshot,
10 type OrchestrationV2ThreadStreamItem,
11} from "@t3tools/contracts";
12import { afterEach, describe, expect, it, vi } from "@effect/vitest";
13import * as Deferred from "effect/Deferred";
14import * as Effect from "effect/Effect";
15import * as Fiber from "effect/Fiber";
16import { HttpClient, HttpClientResponse } from "effect/unstable/http";
17import * as Layer from "effect/Layer";
18import * as Option from "effect/Option";
19import * as Queue from "effect/Queue";
20import * as Stream from "effect/Stream";
21import * as SubscriptionRef from "effect/SubscriptionRef";
22import { Atom, AtomRegistry } from "effect/unstable/reactivity";
23
24import type { ConnectionCatalogEntry } from "../connection/catalog.ts";
25import { EnvironmentRegistry } from "../connection/registry.ts";
26import {
27 AVAILABLE_CONNECTION_STATE,
28 PrimaryConnectionTarget,
29 type NetworkStatus,
30 type PreparedConnection,
31} from "../connection/model.ts";
32import { EnvironmentSupervisor } from "../connection/supervisor.ts";
33import { EnvironmentCacheStore } from "../platform/persistence.ts";
34import type { WsRpcProtocolClient } from "../rpc/protocol.ts";
35import type { RpcSession } from "../rpc/session.ts";
36import { createEnvironmentThreadDetailAtoms } from "./threadDetail.ts";
37import { THREAD_SNAPSHOT_IDLE_TTL_MS } from "./threadRetention.ts";
38import { v2Projection, v2ThreadId } from "./orchestrationV2TestFixtures.ts";
39import {
40 ThreadHistoryController,
41 threadHistoryControllerLayer,
42} from "./threadHistoryController.ts";
43import {
44 createEnvironmentThreadStateAtoms,
45 ThreadSnapshotLoader,
46 type EnvironmentThreadState,
47} from "./threads.ts";
48
49const TARGET = new PrimaryConnectionTarget({
50 environmentId: EnvironmentId.make("environment-1"),
51 label: "Test environment",
52 httpBaseUrl: "https://environment.example.test",
53 wsBaseUrl: "wss://environment.example.test",
54});
55const THREAD_ID = v2ThreadId;
56const THREAD: OrchestrationV2ThreadProjection = {
57 ...v2Projection,
58 thread: { ...v2Projection.thread, title: "Cached thread" },
59};
60const SNAPSHOT: OrchestrationV2ThreadDetailSnapshot = { snapshotSequence: 7, projection: THREAD };
61
62const makeHarness = Effect.fn("TestThreadAtoms.makeHarness")(function* (options?: {
63 readonly snapshot?: OrchestrationV2ThreadDetailSnapshot;
64 readonly snapshotUnavailable?: boolean;
65}) {
66 const subscriptions = yield* Queue.unbounded<{
67 readonly afterSequence: number | undefined;
68 readonly events: Queue.Queue<OrchestrationV2ThreadStreamItem>;
69 readonly closed: Deferred.Deferred<void>;
70 }>();
71 const olderLoads = yield* Queue.unbounded<{
72 readonly cursor: string | null;
73 readonly response: Deferred.Deferred<OrchestrationV2ThreadHistoryPage>;
74 readonly closed: Deferred.Deferred<void>;
75 }>();
76 const snapshot = options?.snapshot ?? SNAPSHOT;
77 let httpLoads = 0;
78 let diskLoads = 0;
79 let opened = 0;
80 let active = 0;
81 const client = {
82 [ORCHESTRATION_V2_WS_METHODS.subscribeThread]: (input: { readonly afterSequence?: number }) =>
83 Stream.unwrap(
84 Effect.gen(function* () {
85 const events = yield* Queue.unbounded<OrchestrationV2ThreadStreamItem>();
86 const closed = yield* Deferred.make<void>();
87 yield* Effect.acquireRelease(
88 Effect.sync(() => {
89 opened += 1;
90 active += 1;
91 }),
92 () =>
93 Effect.sync(() => {
94 active -= 1;
95 }).pipe(Effect.andThen(Deferred.succeed(closed, undefined))),
96 );
97 yield* Queue.offer(subscriptions, { afterSequence: input.afterSequence, events, closed });
98 return Stream.fromQueue(events);
99 }),
100 ),
101 } as unknown as WsRpcProtocolClient;
102 const session: RpcSession = {
103 client,
104 initialConfig: Effect.succeed({
105 threadResumeCompletionMarker: true,
106 threadSnapshotPagination: true,
107 } as never),
108 subscribeServerConfig: (input) => client.subscribeServerConfig(input),
109 ready: Effect.void,
110 probe: Effect.void,
111 closed: Effect.never,
112 };
113 const supervisor = EnvironmentSupervisor.of({
114 target: TARGET,
115 state: yield* SubscriptionRef.make(AVAILABLE_CONNECTION_STATE),
116 session: yield* SubscriptionRef.make(Option.some(session)),
117 prepared: yield* SubscriptionRef.make<Option.Option<PreparedConnection>>(
118 Option.some({
119 environmentId: TARGET.environmentId,
120 label: TARGET.label,
121 httpBaseUrl: TARGET.httpBaseUrl,
122 socketUrl: TARGET.wsBaseUrl,
123 httpAuthorization: null,
124 target: TARGET,
125 }),
126 ),
127 connect: Effect.void,
128 disconnect: Effect.void,
129 retryNow: Effect.void,
130 });
131 const environmentRegistry = EnvironmentRegistry.of({
132 entries: yield* SubscriptionRef.make<ReadonlyMap<EnvironmentId, ConnectionCatalogEntry>>(
133 new Map(),
134 ),
135 networkStatus: yield* SubscriptionRef.make<NetworkStatus>("online"),
136 start: Effect.void,
137 register: () => Effect.die("Unexpected environment registration"),
138 registerPlatform: () => Effect.die("Unexpected environment registration"),
139 reconcilePlatform: () => Effect.die("Unexpected environment reconciliation"),
140 remove: () => Effect.die("Unexpected environment removal"),
141 removeRelayEnvironments: () => Effect.die("Unexpected environment removal"),
142 retryNow: () => Effect.void,
143 setEnabled: () => Effect.die("Unexpected environment toggle"),
144 state: () => SubscriptionRef.get(supervisor.state),
145 stateChanges: () => SubscriptionRef.changes(supervisor.state),
146 run: (_environmentId, effect) =>
147 Effect.provideService(effect, EnvironmentSupervisor, supervisor),
148 runStream: (_environmentId, stream) =>
149 Stream.provideService(stream, EnvironmentSupervisor, supervisor),
150 followStream: (_environmentId, stream) =>
151 Stream.provideService(stream, EnvironmentSupervisor, supervisor),
152 });
153 const historyController = yield* Effect.service(ThreadHistoryController).pipe(
154 Effect.provide(threadHistoryControllerLayer),
155 );
156 const historyHttpClient = HttpClient.make((request, url) =>
157 Effect.gen(function* () {
158 const response = yield* Deferred.make<OrchestrationV2ThreadHistoryPage>();
159 const closed = yield* Deferred.make<void>();
160 yield* Effect.addFinalizer(() => Deferred.succeed(closed, undefined));
161 yield* Queue.offer(olderLoads, { cursor: url.searchParams.get("cursor"), response, closed });
162 const page = yield* Deferred.await(response);
163 return HttpClientResponse.fromWeb(request, Response.json(page));
164 }).pipe(Effect.scoped),
165 );
166 const runtime = Atom.runtime(
167 Layer.mergeAll(
168 Layer.succeed(ThreadHistoryController, historyController),
169 Layer.succeed(HttpClient.HttpClient, historyHttpClient),
170 Layer.succeed(EnvironmentRegistry, environmentRegistry),
171 Layer.succeed(
172 EnvironmentCacheStore,
173 EnvironmentCacheStore.of({
174 loadShell: () => Effect.succeed(Option.none()),
175 saveShell: () => Effect.void,
176 loadThread: () =>
177 Effect.sync(() => {
178 diskLoads += 1;
179 return Option.none();
180 }),
181 saveThread: () => Effect.void,
182 removeThread: () => Effect.void,
183 loadServerConfig: () => Effect.succeed(Option.none()),
184 saveServerConfig: () => Effect.void,
185 loadVcsRefs: () => Effect.succeed(Option.none()),
186 saveVcsRefs: () => Effect.void,
187 removeVcsRefs: () => Effect.void,
188 clearVcsRefs: () => Effect.void,
189 clear: () => Effect.void,
190 }),
191 ),
192 Layer.succeed(
193 ThreadSnapshotLoader,
194 ThreadSnapshotLoader.of({
195 load: () =>
196 Effect.sync(() => {
197 httpLoads += 1;
198 if (options?.snapshotUnavailable === true) {
199 return { _tag: "unavailable" as const };
200 }
201 return {
202 _tag: "present" as const,
203 snapshot,
204 ...(snapshot.historyCursor === undefined
205 ? {}
206 : {
207 history: {
208 historyCursor: snapshot.historyCursor,
209 hasMoreHistory: snapshot.hasMoreHistory ?? false,
210 latestLocalTurnOrdinal: snapshot.latestLocalTurnOrdinal ?? null,
211 },
212 }),
213 };
214 }),
215 }),
216 ),
217 ),
218 );
219 const raw = createEnvironmentThreadStateAtoms(runtime);
220 const details = createEnvironmentThreadDetailAtoms(raw.stateAtom);
221 const ref = { environmentId: TARGET.environmentId, threadId: THREAD_ID };
222 const stateAtom = details.stateAtom(ref);
223 const makeRegistry = Effect.acquireRelease(
224 Effect.sync(() => AtomRegistry.make({ defaultIdleTTL: 60_000, timeoutResolution: 1 })),
225 (registry) => Effect.sync(() => registry.dispose()),
226 );
227 const registry = yield* makeRegistry;
228
229 return {
230 registry,
231 makeRegistry,
232 rawAtoms: raw,
233 stateAtom,
234 details,
235 ref,
236 subscriptions,
237 olderLoads,
238 loadEarlier: () => historyController.loadEarlier(TARGET.environmentId, THREAD_ID),
239 counts: () => ({ httpLoads, diskLoads, opened, active }),
240 };
241});
242
243function observeState(
244 registry: AtomRegistry.AtomRegistry,
245 atom: Atom.Atom<EnvironmentThreadState>,
246 predicate: (state: EnvironmentThreadState) => boolean,
247) {
248 return AtomRegistry.toStream(registry, atom).pipe(
249 Stream.filter(predicate),
250 Stream.runHead,
251 Effect.map(Option.getOrThrow),
252 );
253}
254
255function currentThread(
256 registry: AtomRegistry.AtomRegistry,
257 atom: Atom.Atom<EnvironmentThreadState>,
258) {
259 return Option.getOrThrow(registry.get(atom).data);
260}
261
262describe("createEnvironmentThreadStateAtoms", () => {
263 afterEach(() => {
264 vi.useRealTimers();
265 vi.restoreAllMocks();
266 });
267
268 it.effect("shares one live stream and closes it after the last detail consumer leaves", () =>
269 Effect.gen(function* () {
270 const h = yield* makeHarness();
271 const unmountMessages = h.registry.mount(h.details.visibleTurnItemsAtom(h.ref));
272 const first = yield* Queue.take(h.subscriptions);
273 const unmountStatus = h.registry.mount(h.details.statusAtom(h.ref));
274 expect(h.counts()).toEqual({ httpLoads: 1, diskLoads: 1, opened: 1, active: 1 });
275 unmountMessages();
276 yield* Queue.offer(first.events, { kind: "synchronized" });
277 yield* observeState(h.registry, h.stateAtom, (state) => state.status === "live");
278 expect(h.counts().active).toBe(1);
279 unmountStatus();
280 yield* Deferred.await(first.closed);
281 expect(h.counts().active).toBe(0);
282 }),
283 );
284
285 it.effect("keeps warm data and resumes a completed cursor without loading another snapshot", () =>
286 Effect.gen(function* () {
287 const h = yield* makeHarness();
288 const unmount = h.registry.mount(h.stateAtom);
289 const first = yield* Queue.take(h.subscriptions);
290 yield* Queue.offer(first.events, {
291 kind: "event",
292 sequence: 8,
293 event: {
294 id: EventId.make("metadata-1"),
295 type: "thread.metadata-updated",
296 threadId: THREAD_ID,
297 occurredAt: THREAD.thread.updatedAt,
298 payload: { ...THREAD.thread, title: "Retained title" },
299 },
300 });
301 yield* Queue.offer(first.events, { kind: "synchronized" });
302 yield* observeState(h.registry, h.stateAtom, (state) => state.status === "live");
303 const before = currentThread(h.registry, h.stateAtom);
304 unmount();
305 yield* Deferred.await(first.closed);
306 const remount = h.registry.mount(h.stateAtom);
307 expect(currentThread(h.registry, h.stateAtom)).toBe(before);
308 const next = yield* Queue.take(h.subscriptions);
309 expect(next.afterSequence).toBe(8);
310 expect(h.counts()).toEqual({ httpLoads: 1, diskLoads: 1, opened: 2, active: 1 });
311 remount();
312 yield* Deferred.await(next.closed);
313 }),
314 );
315
316 it.effect("keeps warm data when the raw atom family's weak entry is collected", () =>
317 Effect.gen(function* () {
318 const h = yield* makeHarness();
319 const oldRaw = h.rawAtoms.stateAtom(TARGET.environmentId, THREAD_ID);
320 const unmount = h.registry.mount(h.stateAtom);
321 const first = yield* Queue.take(h.subscriptions);
322 const latest = { ...THREAD, thread: { ...THREAD.thread, title: "Newer cached thread" } };
323 yield* Queue.offer(first.events, {
324 kind: "snapshot",
325 snapshotSequence: 8,
326 projection: latest,
327 });
328 yield* Queue.offer(first.events, { kind: "synchronized" });
329 yield* observeState(h.registry, h.stateAtom, (value) => value.status === "live");
330 unmount();
331 yield* Deferred.await(first.closed);
332
333 // Force the weak-family miss without depending on host GC timing.
334 const deref = WeakRef.prototype.deref;
335 vi.spyOn(WeakRef.prototype, "deref").mockImplementation(function (this: WeakRef<object>) {
336 const value = deref.call(this);
337 return value === oldRaw ? undefined : value;
338 });
339 const remount = h.registry.mount(h.stateAtom);
340 expect(currentThread(h.registry, h.stateAtom)).toBe(latest);
341 const next = yield* Queue.take(h.subscriptions);
342 expect(next.afterSequence).toBe(8);
343 expect(h.counts()).toEqual({ httpLoads: 1, diskLoads: 1, opened: 2, active: 1 });
344 remount();
345 yield* Deferred.await(next.closed);
346 }),
347 );
348
349 it.effect("keeps cached snapshots local to each registry", () =>
350 Effect.gen(function* () {
351 const h = yield* makeHarness();
352 const unmount = h.registry.mount(h.stateAtom);
353 const first = yield* Queue.take(h.subscriptions);
354 unmount();
355 yield* Deferred.await(first.closed);
356 const otherRegistry = yield* h.makeRegistry;
357 const unmountOther = otherRegistry.mount(h.stateAtom);
358 const other = yield* Queue.take(h.subscriptions);
359 expect(h.counts()).toEqual({ httpLoads: 2, diskLoads: 2, opened: 2, active: 1 });
360 unmountOther();
361 yield* Deferred.await(other.closed);
362 }),
363 );
364
365 it.effect("expires the plain snapshot after five idle minutes", () =>
366 Effect.gen(function* () {
367 vi.useFakeTimers({ toFake: ["Date", "setTimeout", "clearTimeout"] });
368 const h = yield* makeHarness();
369 const unmount = h.registry.mount(h.stateAtom);
370 const first = yield* Queue.take(h.subscriptions);
371 unmount();
372 yield* Deferred.await(first.closed);
373 yield* Effect.yieldNow;
374 yield* Effect.promise(() => vi.advanceTimersByTimeAsync(THREAD_SNAPSHOT_IDLE_TTL_MS + 1));
375 const remount = h.registry.mount(h.stateAtom);
376 const next = yield* Queue.take(h.subscriptions);
377 expect(h.counts()).toEqual({ httpLoads: 2, diskLoads: 2, opened: 2, active: 1 });
378 remount();
379 yield* Deferred.await(next.closed);
380 }),
381 );
382
383 it.effect("cancels older-page work on unmount and permits it again on a warm return", () =>
384 Effect.gen(function* () {
385 const h = yield* makeHarness({
386 snapshot: {
387 ...SNAPSHOT,
388 historyCursor: "older-1",
389 hasMoreHistory: true,
390 },
391 });
392 const unmount = h.registry.mount(h.stateAtom);
393 const first = yield* Queue.take(h.subscriptions);
394 const loading = yield* h.loadEarlier().pipe(Effect.forkScoped);
395 const older = yield* Queue.take(h.olderLoads);
396 expect(h.registry.get(h.stateAtom).history.loading).toBe(true);
397 unmount();
398 yield* Deferred.await(first.closed);
399 yield* Deferred.await(older.closed);
400 yield* Fiber.await(loading);
401 const remount = h.registry.mount(h.stateAtom);
402 const next = yield* Queue.take(h.subscriptions);
403 expect(h.registry.get(h.stateAtom).history.loading).toBe(false);
404 const retrying = yield* h.loadEarlier().pipe(Effect.forkScoped);
405 const retried = yield* Queue.take(h.olderLoads);
406 expect(retried.cursor).toBe("older-1");
407 expect(h.counts().httpLoads).toBe(1);
408 remount();
409 yield* Deferred.await(next.closed);
410 yield* Deferred.await(retried.closed);
411 yield* Fiber.await(retrying);
412 }),
413 );
414
415 it.effect(
416 "merges older history after an HTTP failure falls back to a bounded socket snapshot",
417 () =>
418 Effect.gen(function* () {
419 const h = yield* makeHarness({ snapshotUnavailable: true });
420 const unmount = h.registry.mount(h.stateAtom);
421 const subscription = yield* Queue.take(h.subscriptions);
422 expect(subscription.afterSequence).toBeUndefined();
423
424 yield* Queue.offer(subscription.events, {
425 kind: "snapshot",
426 snapshotSequence: 12,
427 projection: THREAD,
428 historyCursor: "socket-older-1",
429 hasMoreHistory: true,
430 latestLocalTurnOrdinal: 4,
431 payloadBudgetExceeded: false,
432 });
433 yield* Queue.offer(subscription.events, { kind: "synchronized" });
434 yield* observeState(
435 h.registry,
436 h.stateAtom,
437 (state) => state.status === "live" && state.history.historyCursor === "socket-older-1",
438 );
439
440 const loading = yield* h.loadEarlier().pipe(Effect.forkScoped);
441 const request = yield* Queue.take(h.olderLoads);
442 expect(request.cursor).toBe("socket-older-1");
443 const olderItem = {
444 id: TurnItemId.make("socket-fallback-older-item"),
445 type: "command_execution" as const,
446 threadId: THREAD_ID,
447 runId: null,
448 nodeId: null,
449 providerThreadId: null,
450 providerTurnId: null,
451 nativeItemRef: null,
452 parentItemId: null,
453 ordinal: 1,
454 status: "completed" as const,
455 title: "Earlier command",
456 input: "pwd",
457 output: "/workspace",
458 exitCode: 0,
459 startedAt: THREAD.thread.createdAt,
460 completedAt: THREAD.thread.createdAt,
461 updatedAt: THREAD.thread.createdAt,
462 };
463 yield* Deferred.succeed(request.response, {
464 snapshotSequence: 12,
465 items: [
466 {
467 position: 0,
468 visibility: "local",
469 sourceThreadId: THREAD_ID,
470 sourceItemId: olderItem.id,
471 item: olderItem,
472 },
473 ],
474 nextCursor: null,
475 hasMoreHistory: false,
476 });
477 expect(yield* Fiber.join(loading)).toEqual({ _tag: "loaded" });
478
479 const state = h.registry.get(h.stateAtom);
480 expect(
481 Option.getOrThrow(state.data).visibleTurnItems.map((row) => row.sourceItemId),
482 ).toEqual([olderItem.id]);
483 expect(state.history).toMatchObject({
484 historyCursor: null,
485 hasMoreHistory: false,
486 loading: false,
487 error: null,
488 expanded: true,
489 latestLocalTurnOrdinal: 4,
490 });
491 expect(h.counts().httpLoads).toBe(1);
492
493 unmount();
494 yield* Deferred.await(subscription.closed);
495 }),
496 );
497});
498
499it.effect.each([1, 16, 500])("publishes V2 message replay once per batch of %i", (batchSize) =>
500 Effect.gen(function* () {
501 const h = yield* makeHarness();
502 const unmount = h.registry.mount(h.stateAtom);
503 const first = yield* Queue.take(h.subscriptions);
504 let updates = 0;
505 const stop = h.registry.subscribe(
506 Atom.map(h.stateAtom, (state) => Option.getOrNull(state.data)?.messages),
507 () => updates++,
508 {
509 immediate: true,
510 },
511 );
512 updates = 0;
513 const events: OrchestrationV2ThreadStreamItem[] = Array.from({ length: 500 }, (_, index) => ({
514 kind: "event",
515 sequence: 8 + index,
516 event: {
517 id: EventId.make(`replay-${index}`),
518 type: "message.updated",
519 threadId: THREAD_ID,
520 occurredAt: THREAD.thread.createdAt,
521 payload: {
522 id: MessageId.make("replayed-message"),
523 threadId: THREAD_ID,
524 runId: null,
525 nodeId: null,
526 role: "assistant",
527 text: `${index},`,
528 streaming: true,
529 attachments: [],
530 createdBy: "agent",
531 creationSource: "provider",
532 createdAt: THREAD.thread.createdAt,
533 updatedAt: THREAD.thread.createdAt,
534 },
535 },
536 }));
537 for (let offset = 0; offset < events.length; offset += batchSize) {
538 yield* Queue.offerAll(first.events, events.slice(offset, offset + batchSize));
539 const last = Math.min(offset + batchSize, events.length) - 1;
540 yield* observeState(
541 h.registry,
542 h.stateAtom,
543 (state) => Option.getOrNull(state.data)?.messages[0]?.text === `${last},`,
544 );
545 }
546 yield* Queue.offerAll(first.events, [events[499]!, events[0]!, { kind: "synchronized" }]);
547 yield* observeState(h.registry, h.stateAtom, (state) => state.status === "live");
548 expect(currentThread(h.registry, h.stateAtom).messages[0]?.text).toBe("499,");
549 expect(updates).toBe(Math.ceil(500 / batchSize));
550 stop();
551 unmount();
552 yield* Deferred.await(first.closed);
553 const remount = h.registry.mount(h.stateAtom);
554 const next = yield* Queue.take(h.subscriptions);
555 expect(next.afterSequence).toBe(507);
556 remount();
557 yield* Deferred.await(next.closed);
558 }),
559);
560
561it.effect("keeps snapshot boundaries and completion markers ordered inside a replay batch", () =>
562 Effect.gen(function* () {
563 const h = yield* makeHarness();
564 const unmount = h.registry.mount(h.stateAtom);
565 const first = yield* Queue.take(h.subscriptions);
566 const title = (sequence: number, value: string): OrchestrationV2ThreadStreamItem => ({
567 kind: "event",
568 sequence,
569 event: {
570 id: EventId.make(`batch-title-${sequence}`),
571 type: "thread.metadata-updated",
572 threadId: THREAD_ID,
573 occurredAt: THREAD.thread.updatedAt,
574 payload: { ...THREAD.thread, title: value },
575 },
576 });
577 yield* Queue.offerAll(first.events, [
578 title(8, "Before snapshot"),
579 {
580 kind: "snapshot",
581 snapshotSequence: 20,
582 projection: THREAD,
583 historyCursor: "older-batch",
584 hasMoreHistory: true,
585 latestLocalTurnOrdinal: 10,
586 },
587 title(21, "After snapshot"),
588 title(19, "Stale replay"),
589 { kind: "synchronized" },
590 ]);
591 const state = yield* observeState(h.registry, h.stateAtom, (value) => value.status === "live");
592 expect(Option.getOrThrow(state.data).thread.title).toBe("After snapshot");
593 expect(state.history.historyCursor).toBe("older-batch");
594 expect(state.history.latestLocalTurnOrdinal).toBe(10);
595 unmount();
596 yield* Deferred.await(first.closed);
597 const remount = h.registry.mount(h.stateAtom);
598 const next = yield* Queue.take(h.subscriptions);
599 expect(next.afterSequence).toBe(21);
600 remount();
601 yield* Deferred.await(next.closed);
602 }),
603);