Open History to see the last commit
1import * as NodeCrypto from "node:crypto";
2import * as NodeServices from "@effect/platform-node/NodeServices";
3
4import type {
5 EnvironmentId,
6 ExecutionEnvironmentDescriptor,
7 OrchestrationEvent,
8 OrchestrationProjectShell,
9 OrchestrationShellSnapshot,
10 OrchestrationThreadShell,
11 ProjectId,
12 ThreadId,
13 TurnId,
14} from "@t3tools/contracts";
15import type {
16 RelayAgentActivityPublishProofPayload,
17 RelayAgentActivityState,
18} from "@t3tools/contracts/relay";
19import { CommandId, ProviderInstanceId } from "@t3tools/contracts";
20import { RelayClientTracer } from "@t3tools/shared/relayTracing";
21import { RELAY_ACTIVITY_PUBLISH_TYP, verifyRelayJwt } from "@t3tools/shared/relayJwt";
22import { describe, expect, it } from "@effect/vitest";
23import * as Deferred from "effect/Deferred";
24import * as Effect from "effect/Effect";
25import * as Layer from "effect/Layer";
26import * as Option from "effect/Option";
27import * as Queue from "effect/Queue";
28import * as Stream from "effect/Stream";
29import * as Tracer from "effect/Tracer";
30
31import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
32import * as ServerEnvironment from "../environment/ServerEnvironment.ts";
33import {
34 OrchestrationEngineService,
35 type OrchestrationEngineShape,
36} from "../orchestration/Services/OrchestrationEngine.ts";
37import {
38 ProjectionSnapshotQuery,
39 type ProjectionSnapshotQueryShape,
40} from "../orchestration/Services/ProjectionSnapshotQuery.ts";
41import {
42 RELAY_ENVIRONMENT_CREDENTIAL_SECRET,
43 RELAY_ISSUER_SECRET,
44 RELAY_URL_SECRET,
45 PUBLISH_AGENT_ACTIVITY_SECRET,
46} from "../cloud/config.ts";
47import * as AgentAwarenessRelay from "./AgentAwarenessRelay.ts";
48
49const state: RelayAgentActivityState = {
50 environmentId: "env" as RelayAgentActivityState["environmentId"],
51 threadId: "thread" as RelayAgentActivityState["threadId"],
52 projectTitle: "Project",
53 threadTitle: "Thread",
54 modelTitle: "gpt-5.4",
55 phase: "running",
56 headline: "Running",
57 updatedAt: "2026-05-25T00:00:00.000Z",
58 deepLink: "/threads/env/thread",
59};
60
61const encodeSecret = (value: string): Uint8Array => new TextEncoder().encode(value);
62
63function makeMemorySecretStore() {
64 const values = new Map<string, Uint8Array>();
65 const store = {
66 get: ((name) =>
67 Effect.sync(() => {
68 const value = values.get(name);
69 return value === undefined ? Option.none() : Option.some(Uint8Array.from(value));
70 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["get"],
71 set: ((name, value) =>
72 Effect.sync(() => {
73 values.set(name, Uint8Array.from(value));
74 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["set"],
75 create: ((name, value) =>
76 Effect.sync(() => {
77 values.set(name, Uint8Array.from(value));
78 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["create"],
79 getOrCreateRandom: ((name, bytes) =>
80 Effect.sync(() => {
81 const existing = values.get(name);
82 if (existing) {
83 return existing;
84 }
85 const generated = new Uint8Array(bytes);
86 values.set(name, generated);
87 return generated;
88 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["getOrCreateRandom"],
89 remove: ((name) =>
90 Effect.sync(() => {
91 values.delete(name);
92 })) satisfies ServerSecretStore.ServerSecretStore["Service"]["remove"],
93 } satisfies ServerSecretStore.ServerSecretStore["Service"];
94 return {
95 store,
96 setString: (name: string, value: string) => store.set(name, encodeSecret(value)),
97 };
98}
99
100describe.sequential("signRelayAgentActivityPublishProof", () => {
101 it("distinguishes pending link credentials from disabled publication", () => {
102 expect(
103 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
104 relayConfigured: false,
105 publishEnabled: false,
106 }),
107 ).toBe("waiting-for-link");
108 expect(
109 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
110 relayConfigured: true,
111 publishEnabled: false,
112 }),
113 ).toBe("disabled");
114 expect(
115 AgentAwarenessRelay.resolveAgentActivityPublishingStartupState({
116 relayConfigured: true,
117 publishEnabled: true,
118 }),
119 ).toBe("enabled");
120 });
121
122 it("derives the thread id from the aggregate id for thread events without payload thread ids", () => {
123 const threadId = "thread-aggregate-1" as ThreadId;
124 const now = "2026-05-25T00:00:00.000Z";
125 const event = {
126 type: "thread.activity-appended",
127 sequence: 1,
128 eventId: "evt-aggregate-1",
129 commandId: CommandId.make("cmd-1"),
130 aggregateKind: "thread",
131 aggregateId: threadId,
132 actor: { kind: "server" },
133 payload: {},
134 occurredAt: now,
135 } as unknown as OrchestrationEvent;
136
137 expect(AgentAwarenessRelay.eventThreadId(event)).toBe(threadId);
138 });
139
140 it("does not publish start intents, streaming content, or non-awareness activity events", () => {
141 const now = "2026-05-25T00:00:00.000Z";
142 const base = {
143 sequence: 1,
144 eventId: "evt-1",
145 commandId: CommandId.make("cmd-1"),
146 aggregateKind: "thread",
147 aggregateId: "thread-1" as ThreadId,
148 occurredAt: now,
149 };
150
151 expect(
152 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
153 ...base,
154 type: "thread.message-sent",
155 payload: {
156 threadId: "thread-1" as ThreadId,
157 streaming: true,
158 },
159 } as unknown as OrchestrationEvent),
160 ).toBe(false);
161 expect(
162 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
163 ...base,
164 type: "thread.activity-appended",
165 payload: {
166 threadId: "thread-1" as ThreadId,
167 activity: {
168 kind: "task.progress",
169 },
170 },
171 } as unknown as OrchestrationEvent),
172 ).toBe(false);
173 expect(
174 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
175 ...base,
176 type: "thread.activity-appended",
177 payload: {
178 threadId: "thread-1" as ThreadId,
179 activity: {
180 kind: "approval.requested",
181 },
182 },
183 } as unknown as OrchestrationEvent),
184 ).toBe(true);
185 expect(
186 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
187 ...base,
188 type: "thread.message-sent",
189 payload: {
190 threadId: "thread-1" as ThreadId,
191 streaming: false,
192 },
193 } as unknown as OrchestrationEvent),
194 ).toBe(false);
195 expect(
196 AgentAwarenessRelay.shouldPublishAgentAwarenessEvent({
197 ...base,
198 type: "thread.turn-start-requested",
199 payload: {
200 threadId: "thread-1" as ThreadId,
201 },
202 } as unknown as OrchestrationEvent),
203 ).toBe(false);
204 });
205
206 it("deduplicates awareness state updates whose only change is their event timestamp", () => {
207 expect(AgentAwarenessRelay.agentAwarenessPublishIdentity(state)).toBe(
208 AgentAwarenessRelay.agentAwarenessPublishIdentity({
209 ...state,
210 updatedAt: "2026-05-25T00:10:00.000Z",
211 }),
212 );
213 expect(AgentAwarenessRelay.agentAwarenessPublishIdentity(state)).not.toBe(
214 AgentAwarenessRelay.agentAwarenessPublishIdentity({
215 ...state,
216 phase: "completed",
217 headline: "Agent finished",
218 }),
219 );
220 });
221
222 it("requires an explicit opt-in before publishing agent activity", () => {
223 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled(null)).toBe(false);
224 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("false")).toBe(false);
225 expect(AgentAwarenessRelay.isAgentActivityPublishingEnabled("true")).toBe(true);
226 });
227
228 it("redacts failed activity details and caps other relay detail", () => {
229 expect(
230 AgentAwarenessRelay.sanitizeRelayAgentActivityState({
231 ...state,
232 phase: "failed",
233 detail: "Provider process exited with secret token.",
234 }),
235 ).toMatchObject({
236 phase: "failed",
237 detail: "The agent run failed.",
238 });
239 expect(
240 AgentAwarenessRelay.sanitizeRelayAgentActivityState({
241 ...state,
242 detail: "x".repeat(200),
243 })?.detail,
244 ).toHaveLength(160);
245 });
246
247 it("resolves a null publish state when a thread or project snapshot disappeared", () => {
248 const environmentId = "env-1" as EnvironmentId;
249 const threadId = "thread-1" as ThreadId;
250 const thread = {
251 id: threadId,
252 projectId: "project-1" as ProjectId,
253 title: "Deleted thread",
254 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
255 session: null,
256 latestTurn: null,
257 updatedAt: "2026-05-25T00:00:00.000Z",
258 hasPendingApprovals: false,
259 hasPendingUserInput: false,
260 } as OrchestrationThreadShell;
261
262 expect(
263 AgentAwarenessRelay.resolveAgentAwarenessRelayPublishSnapshot({
264 environmentId,
265 threadId,
266 thread: Option.none(),
267 project: Option.none(),
268 }),
269 ).toEqual({
270 projectId: null,
271 state: null,
272 reason: "thread-not-found",
273 });
274
275 expect(
276 AgentAwarenessRelay.resolveAgentAwarenessRelayPublishSnapshot({
277 environmentId,
278 threadId,
279 thread: Option.some(thread),
280 project: Option.none(),
281 }),
282 ).toEqual({
283 projectId: "project-1",
284 state: null,
285 reason: "project-not-found",
286 });
287 });
288
289 it("selects only active shell snapshot threads for startup catch-up", () => {
290 const now = "2026-05-25T00:00:00.000Z";
291 const environmentId = "env-1" as EnvironmentId;
292 const projectId = "project-1" as ProjectId;
293 const activeThreadId = "thread-active" as ThreadId;
294 const idleThreadId = "thread-idle" as ThreadId;
295
296 const baseThread = {
297 projectId,
298 title: "Run remote agent",
299 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
300 runtimeMode: "full-access",
301 interactionMode: "default",
302 branch: null,
303 worktreePath: null,
304 latestTurn: null,
305 createdAt: now,
306 updatedAt: now,
307 archivedAt: null,
308 settledOverride: null,
309 settledAt: null,
310 session: null,
311 latestUserMessageAt: null,
312 hasPendingApprovals: false,
313 hasPendingUserInput: false,
314 hasActionableProposedPlan: false,
315 } satisfies Omit<OrchestrationThreadShell, "id">;
316
317 expect(
318 AgentAwarenessRelay.resolveAgentAwarenessRelayActiveThreadIds({
319 environmentId,
320 projects: [
321 {
322 id: projectId,
323 title: "T3 Code",
324 },
325 ],
326 threads: [
327 {
328 ...baseThread,
329 id: activeThreadId,
330 latestTurn: {
331 turnId: "turn-1" as TurnId,
332 state: "running",
333 requestedAt: now,
334 startedAt: now,
335 completedAt: null,
336 assistantMessageId: null,
337 },
338 },
339 {
340 ...baseThread,
341 id: idleThreadId,
342 },
343 {
344 ...baseThread,
345 id: "thread-missing-project" as ThreadId,
346 projectId: "missing-project" as ProjectId,
347 latestTurn: {
348 turnId: "turn-2" as TurnId,
349 state: "running",
350 requestedAt: now,
351 startedAt: now,
352 completedAt: null,
353 assistantMessageId: null,
354 },
355 },
356 ],
357 }),
358 ).toEqual([activeThreadId]);
359 });
360
361 it("signs the activity publish JWT and rejects tampering", async () => {
362 const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
363 privateKeyEncoding: { format: "pem", type: "pkcs8" },
364 publicKeyEncoding: { format: "pem", type: "spki" },
365 });
366 const payload = {
367 iss: "t3-env:env",
368 aud: "https://relay.example.test",
369 sub: "env",
370 jti: "nonce-1",
371 iat: 100,
372 exp: 200,
373 environmentId: state.environmentId,
374 threadId: state.threadId,
375 state,
376 } satisfies RelayAgentActivityPublishProofPayload;
377 const proof = await Effect.runPromise(
378 AgentAwarenessRelay.signRelayAgentActivityPublishProof({
379 privateKey: keyPair.privateKey,
380 payload,
381 }),
382 );
383
384 await expect(
385 Effect.runPromise(
386 verifyRelayJwt({
387 publicKey: keyPair.publicKey,
388 token: proof,
389 typ: RELAY_ACTIVITY_PUBLISH_TYP,
390 issuer: "t3-env:env",
391 audience: "https://relay.example.test",
392 nowEpochSeconds: 150,
393 }),
394 ),
395 ).resolves.toMatchObject({ jti: "nonce-1", state });
396 await expect(
397 Effect.runPromise(
398 verifyRelayJwt({
399 publicKey: keyPair.publicKey,
400 token: (() => {
401 const [header, body, signature = ""] = proof.split(".");
402 const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
403 return `${header}.${body}.${corruptedSignature}`;
404 })(),
405 typ: RELAY_ACTIVITY_PUBLISH_TYP,
406 issuer: "t3-env:env",
407 audience: "https://relay.example.test",
408 nowEpochSeconds: 150,
409 }),
410 ),
411 ).rejects.toBeDefined();
412 });
413
414 it.effect("keeps the orchestration listener armed until relay config is installed", () =>
415 Effect.scoped(
416 Effect.gen(function* () {
417 const events = yield* Queue.unbounded<OrchestrationEvent>();
418 const threadShellRequested = yield* Deferred.make<void>();
419 const secrets = makeMemorySecretStore();
420 const now = "2026-05-25T00:00:00.000Z";
421 const projectId = "project-1" as ProjectId;
422 const threadId = "thread-1" as ThreadId;
423 const environmentId = "env-1" as EnvironmentId;
424
425 const project = {
426 id: projectId,
427 title: "T3 Code",
428 workspaceRoot: "/workspace",
429 repositoryIdentity: null,
430 defaultModelSelection: null,
431 scripts: [],
432 createdAt: now,
433 updatedAt: now,
434 } satisfies OrchestrationProjectShell;
435
436 const thread = {
437 id: threadId,
438 projectId,
439 title: "Run remote agent",
440 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
441 runtimeMode: "full-access",
442 interactionMode: "default",
443 branch: null,
444 worktreePath: null,
445 latestTurn: {
446 turnId: "turn-1" as TurnId,
447 state: "running",
448 requestedAt: now,
449 startedAt: now,
450 completedAt: null,
451 assistantMessageId: null,
452 },
453 createdAt: now,
454 updatedAt: now,
455 archivedAt: null,
456 settledOverride: null,
457 settledAt: null,
458 session: {
459 threadId,
460 status: "running",
461 providerName: "Codex",
462 runtimeMode: "full-access",
463 activeTurnId: "turn-1" as TurnId,
464 lastError: null,
465 updatedAt: now,
466 },
467 latestUserMessageAt: now,
468 hasPendingApprovals: false,
469 hasPendingUserInput: false,
470 hasActionableProposedPlan: false,
471 } satisfies OrchestrationThreadShell;
472
473 const orchestrationEngine = {
474 readEvents: () => Stream.empty,
475 dispatch: () => Effect.succeed({ sequence: 1 }),
476 streamDomainEvents: Stream.fromQueue(events),
477 latestSequence: Effect.succeed(0),
478 } satisfies OrchestrationEngineShape;
479
480 const snapshotQuery = {
481 getShellSnapshot: () =>
482 Effect.succeed({
483 snapshotSequence: 1,
484 projects: [project],
485 threads: [thread],
486 updatedAt: now,
487 } satisfies OrchestrationShellSnapshot),
488 getThreadShellById: () =>
489 Deferred.succeed(threadShellRequested, undefined).pipe(
490 Effect.ignore,
491 Effect.as(Option.some(thread)),
492 ),
493 getProjectShellById: () => Effect.succeed(Option.some(project)),
494 } as unknown as ProjectionSnapshotQueryShape;
495
496 const descriptor = {
497 environmentId,
498 label: "Test Desktop",
499 platform: {
500 os: "darwin",
501 arch: "arm64",
502 },
503 serverVersion: "0.0.0-test",
504 capabilities: {
505 repositoryIdentity: true,
506 },
507 } satisfies ExecutionEnvironmentDescriptor;
508
509 const layer = Layer.mergeAll(
510 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
511 Layer.succeed(ServerEnvironment.ServerEnvironment, {
512 getEnvironmentId: Effect.succeed(environmentId),
513 getDescriptor: Effect.succeed(descriptor),
514 }),
515 Layer.succeed(OrchestrationEngineService, orchestrationEngine),
516 Layer.succeed(ProjectionSnapshotQuery, snapshotQuery),
517 );
518
519 yield* Effect.gen(function* () {
520 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
521 yield* relay.start();
522 yield* secrets.setString(RELAY_URL_SECRET, "http://127.0.0.1:1");
523 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
524 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
525 yield* Queue.offer(events, {
526 type: "thread.activity-appended",
527 sequence: 1,
528 eventId: "evt-1",
529 commandId: CommandId.make("cmd-1"),
530 aggregateKind: "thread",
531 aggregateId: threadId,
532 actor: { kind: "server" },
533 payload: {
534 threadId,
535 activity: {
536 kind: "approval.requested",
537 },
538 },
539 occurredAt: now,
540 } as unknown as OrchestrationEvent);
541
542 yield* Deferred.await(threadShellRequested).pipe(Effect.timeout("2 seconds"));
543 }).pipe(
544 Effect.provide(
545 AgentAwarenessRelay.layer.pipe(
546 Layer.provide(layer),
547 Layer.provideMerge(NodeServices.layer),
548 ),
549 ),
550 );
551 }),
552 ),
553 );
554
555 it.effect("publishes agent activity to the relay transport URL, not the relay issuer", () =>
556 Effect.scoped(
557 Effect.gen(function* () {
558 const originalFetch = globalThis.fetch;
559 const context = yield* Effect.context<never>();
560 const runFork = Effect.runForkWith(context);
561 const events = yield* Queue.unbounded<OrchestrationEvent>();
562 const fetchSeen = yield* Deferred.make<URL>();
563 const userSpans: Array<string> = [];
564 const productSpans: Array<string> = [];
565 const collectingTracer = (spans: Array<string>) =>
566 Tracer.make({
567 span: (options) => {
568 const span = new Tracer.NativeSpan(options);
569 const end = span.end.bind(span);
570 span.end = (endTime, exit) => {
571 end(endTime, exit);
572 spans.push(span.name);
573 };
574 return span;
575 },
576 });
577 const secrets = makeMemorySecretStore();
578 const now = "2026-05-25T00:00:00.000Z";
579 const projectId = "project-1" as ProjectId;
580 const threadId = "thread-1" as ThreadId;
581 const environmentId = "env-1" as EnvironmentId;
582
583 const project = {
584 id: projectId,
585 title: "T3 Code",
586 workspaceRoot: "/workspace",
587 repositoryIdentity: null,
588 defaultModelSelection: null,
589 scripts: [],
590 createdAt: now,
591 updatedAt: now,
592 } satisfies OrchestrationProjectShell;
593
594 const thread = {
595 id: threadId,
596 projectId,
597 title: "Run remote agent",
598 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
599 runtimeMode: "full-access",
600 interactionMode: "default",
601 branch: null,
602 worktreePath: null,
603 latestTurn: {
604 turnId: "turn-1" as TurnId,
605 state: "running",
606 requestedAt: now,
607 startedAt: now,
608 completedAt: null,
609 assistantMessageId: null,
610 },
611 createdAt: now,
612 updatedAt: now,
613 archivedAt: null,
614 settledOverride: null,
615 settledAt: null,
616 session: {
617 threadId,
618 status: "running",
619 providerName: "Codex",
620 runtimeMode: "full-access",
621 activeTurnId: "turn-1" as TurnId,
622 lastError: null,
623 updatedAt: now,
624 },
625 latestUserMessageAt: now,
626 hasPendingApprovals: false,
627 hasPendingUserInput: false,
628 hasActionableProposedPlan: false,
629 } satisfies OrchestrationThreadShell;
630
631 const descriptor = {
632 environmentId,
633 label: "Test Desktop",
634 platform: {
635 os: "darwin",
636 arch: "arm64",
637 },
638 serverVersion: "0.0.0-test",
639 capabilities: {
640 repositoryIdentity: true,
641 },
642 } satisfies ExecutionEnvironmentDescriptor;
643
644 globalThis.fetch = ((input: Parameters<typeof fetch>[0]) => {
645 const url = new URL(
646 typeof input === "string" || input instanceof URL
647 ? input
648 : (input as unknown as { readonly url: string }).url,
649 );
650 runFork(Deferred.succeed(fetchSeen, url));
651 return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
652 }) as unknown as typeof fetch;
653 yield* Effect.addFinalizer(() =>
654 Effect.sync(() => {
655 globalThis.fetch = originalFetch;
656 }),
657 );
658
659 const layer = Layer.mergeAll(
660 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
661 Layer.succeed(ServerEnvironment.ServerEnvironment, {
662 getEnvironmentId: Effect.succeed(environmentId),
663 getDescriptor: Effect.succeed(descriptor),
664 }),
665 Layer.succeed(OrchestrationEngineService, {
666 readEvents: () => Stream.empty,
667 dispatch: () => Effect.succeed({ sequence: 1 }),
668 streamDomainEvents: Stream.fromQueue(events),
669 latestSequence: Effect.succeed(0),
670 } satisfies OrchestrationEngineShape),
671 Layer.succeed(ProjectionSnapshotQuery, {
672 getShellSnapshot: () =>
673 Effect.succeed({
674 snapshotSequence: 1,
675 projects: [project],
676 threads: [thread],
677 updatedAt: now,
678 } satisfies OrchestrationShellSnapshot),
679 getThreadShellById: () => Effect.succeed(Option.some(thread)),
680 getProjectShellById: () => Effect.succeed(Option.some(project)),
681 } as unknown as ProjectionSnapshotQueryShape),
682 );
683
684 yield* Effect.gen(function* () {
685 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
686 yield* secrets.setString(RELAY_URL_SECRET, "https://transport.example.test");
687 yield* secrets.setString(RELAY_ISSUER_SECRET, "https://issuer.example.test");
688 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
689 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
690 yield* relay.start();
691 yield* Queue.offer(events, {
692 type: "thread.activity-appended",
693 sequence: 1,
694 eventId: "evt-1",
695 commandId: CommandId.make("cmd-1"),
696 aggregateKind: "thread",
697 aggregateId: threadId,
698 actor: { kind: "server" },
699 payload: {
700 threadId,
701 activity: {
702 kind: "approval.requested",
703 },
704 },
705 occurredAt: now,
706 } as unknown as OrchestrationEvent);
707
708 const url = yield* Deferred.await(fetchSeen).pipe(Effect.timeout("2 seconds"));
709 expect(url.origin).toBe("https://transport.example.test");
710 expect(productSpans).toContain("makePublishProof");
711 expect(userSpans).not.toContain("makePublishProof");
712 }).pipe(
713 Effect.provide(
714 AgentAwarenessRelay.layer.pipe(
715 Layer.provide(layer),
716 Layer.provideMerge(NodeServices.layer),
717 ),
718 ),
719 Effect.provideService(RelayClientTracer, Option.some(collectingTracer(productSpans))),
720 Effect.withTracer(collectingTracer(userSpans)),
721 );
722 }),
723 ),
724 );
725});