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 session: null,
309 latestUserMessageAt: null,
310 hasPendingApprovals: false,
311 hasPendingUserInput: false,
312 hasActionableProposedPlan: false,
313 } satisfies Omit<OrchestrationThreadShell, "id">;
314
315 expect(
316 AgentAwarenessRelay.resolveAgentAwarenessRelayActiveThreadIds({
317 environmentId,
318 projects: [
319 {
320 id: projectId,
321 title: "T3 Code",
322 },
323 ],
324 threads: [
325 {
326 ...baseThread,
327 id: activeThreadId,
328 latestTurn: {
329 turnId: "turn-1" as TurnId,
330 state: "running",
331 requestedAt: now,
332 startedAt: now,
333 completedAt: null,
334 assistantMessageId: null,
335 },
336 },
337 {
338 ...baseThread,
339 id: idleThreadId,
340 },
341 {
342 ...baseThread,
343 id: "thread-missing-project" as ThreadId,
344 projectId: "missing-project" as ProjectId,
345 latestTurn: {
346 turnId: "turn-2" as TurnId,
347 state: "running",
348 requestedAt: now,
349 startedAt: now,
350 completedAt: null,
351 assistantMessageId: null,
352 },
353 },
354 ],
355 }),
356 ).toEqual([activeThreadId]);
357 });
358
359 it("signs the activity publish JWT and rejects tampering", async () => {
360 const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
361 privateKeyEncoding: { format: "pem", type: "pkcs8" },
362 publicKeyEncoding: { format: "pem", type: "spki" },
363 });
364 const payload = {
365 iss: "t3-env:env",
366 aud: "https://relay.example.test",
367 sub: "env",
368 jti: "nonce-1",
369 iat: 100,
370 exp: 200,
371 environmentId: state.environmentId,
372 threadId: state.threadId,
373 state,
374 } satisfies RelayAgentActivityPublishProofPayload;
375 const proof = await Effect.runPromise(
376 AgentAwarenessRelay.signRelayAgentActivityPublishProof({
377 privateKey: keyPair.privateKey,
378 payload,
379 }),
380 );
381
382 await expect(
383 Effect.runPromise(
384 verifyRelayJwt({
385 publicKey: keyPair.publicKey,
386 token: proof,
387 typ: RELAY_ACTIVITY_PUBLISH_TYP,
388 issuer: "t3-env:env",
389 audience: "https://relay.example.test",
390 nowEpochSeconds: 150,
391 }),
392 ),
393 ).resolves.toMatchObject({ jti: "nonce-1", state });
394 await expect(
395 Effect.runPromise(
396 verifyRelayJwt({
397 publicKey: keyPair.publicKey,
398 token: (() => {
399 const [header, body, signature = ""] = proof.split(".");
400 const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
401 return `${header}.${body}.${corruptedSignature}`;
402 })(),
403 typ: RELAY_ACTIVITY_PUBLISH_TYP,
404 issuer: "t3-env:env",
405 audience: "https://relay.example.test",
406 nowEpochSeconds: 150,
407 }),
408 ),
409 ).rejects.toBeDefined();
410 });
411
412 it.effect("keeps the orchestration listener armed until relay config is installed", () =>
413 Effect.scoped(
414 Effect.gen(function* () {
415 const events = yield* Queue.unbounded<OrchestrationEvent>();
416 const threadShellRequested = yield* Deferred.make<void>();
417 const secrets = makeMemorySecretStore();
418 const now = "2026-05-25T00:00:00.000Z";
419 const projectId = "project-1" as ProjectId;
420 const threadId = "thread-1" as ThreadId;
421 const environmentId = "env-1" as EnvironmentId;
422
423 const project = {
424 id: projectId,
425 title: "T3 Code",
426 workspaceRoot: "/workspace",
427 repositoryIdentity: null,
428 defaultModelSelection: null,
429 scripts: [],
430 createdAt: now,
431 updatedAt: now,
432 } satisfies OrchestrationProjectShell;
433
434 const thread = {
435 id: threadId,
436 projectId,
437 title: "Run remote agent",
438 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
439 runtimeMode: "full-access",
440 interactionMode: "default",
441 branch: null,
442 worktreePath: null,
443 latestTurn: {
444 turnId: "turn-1" as TurnId,
445 state: "running",
446 requestedAt: now,
447 startedAt: now,
448 completedAt: null,
449 assistantMessageId: null,
450 },
451 createdAt: now,
452 updatedAt: now,
453 archivedAt: null,
454 session: {
455 threadId,
456 status: "running",
457 providerName: "Codex",
458 runtimeMode: "full-access",
459 activeTurnId: "turn-1" as TurnId,
460 lastError: null,
461 updatedAt: now,
462 },
463 latestUserMessageAt: now,
464 hasPendingApprovals: false,
465 hasPendingUserInput: false,
466 hasActionableProposedPlan: false,
467 } satisfies OrchestrationThreadShell;
468
469 const orchestrationEngine = {
470 readEvents: () => Stream.empty,
471 dispatch: () => Effect.succeed({ sequence: 1 }),
472 streamDomainEvents: Stream.fromQueue(events),
473 latestSequence: Effect.succeed(0),
474 } satisfies OrchestrationEngineShape;
475
476 const snapshotQuery = {
477 getShellSnapshot: () =>
478 Effect.succeed({
479 snapshotSequence: 1,
480 projects: [project],
481 threads: [thread],
482 updatedAt: now,
483 } satisfies OrchestrationShellSnapshot),
484 getThreadShellById: () =>
485 Deferred.succeed(threadShellRequested, undefined).pipe(
486 Effect.ignore,
487 Effect.as(Option.some(thread)),
488 ),
489 getProjectShellById: () => Effect.succeed(Option.some(project)),
490 } as unknown as ProjectionSnapshotQueryShape;
491
492 const descriptor = {
493 environmentId,
494 label: "Test Desktop",
495 platform: {
496 os: "darwin",
497 arch: "arm64",
498 },
499 serverVersion: "0.0.0-test",
500 capabilities: {
501 repositoryIdentity: true,
502 },
503 } satisfies ExecutionEnvironmentDescriptor;
504
505 const layer = Layer.mergeAll(
506 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
507 Layer.succeed(ServerEnvironment.ServerEnvironment, {
508 getEnvironmentId: Effect.succeed(environmentId),
509 getDescriptor: Effect.succeed(descriptor),
510 }),
511 Layer.succeed(OrchestrationEngineService, orchestrationEngine),
512 Layer.succeed(ProjectionSnapshotQuery, snapshotQuery),
513 );
514
515 yield* Effect.gen(function* () {
516 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
517 yield* relay.start();
518 yield* secrets.setString(RELAY_URL_SECRET, "http://127.0.0.1:1");
519 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
520 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
521 yield* Queue.offer(events, {
522 type: "thread.activity-appended",
523 sequence: 1,
524 eventId: "evt-1",
525 commandId: CommandId.make("cmd-1"),
526 aggregateKind: "thread",
527 aggregateId: threadId,
528 actor: { kind: "server" },
529 payload: {
530 threadId,
531 activity: {
532 kind: "approval.requested",
533 },
534 },
535 occurredAt: now,
536 } as unknown as OrchestrationEvent);
537
538 yield* Deferred.await(threadShellRequested).pipe(Effect.timeout("2 seconds"));
539 }).pipe(
540 Effect.provide(
541 AgentAwarenessRelay.layer.pipe(
542 Layer.provide(layer),
543 Layer.provideMerge(NodeServices.layer),
544 ),
545 ),
546 );
547 }),
548 ),
549 );
550
551 it.effect("publishes agent activity to the relay transport URL, not the relay issuer", () =>
552 Effect.scoped(
553 Effect.gen(function* () {
554 const originalFetch = globalThis.fetch;
555 const context = yield* Effect.context<never>();
556 const runFork = Effect.runForkWith(context);
557 const events = yield* Queue.unbounded<OrchestrationEvent>();
558 const fetchSeen = yield* Deferred.make<URL>();
559 const userSpans: Array<string> = [];
560 const productSpans: Array<string> = [];
561 const collectingTracer = (spans: Array<string>) =>
562 Tracer.make({
563 span: (options) => {
564 const span = new Tracer.NativeSpan(options);
565 const end = span.end.bind(span);
566 span.end = (endTime, exit) => {
567 end(endTime, exit);
568 spans.push(span.name);
569 };
570 return span;
571 },
572 });
573 const secrets = makeMemorySecretStore();
574 const now = "2026-05-25T00:00:00.000Z";
575 const projectId = "project-1" as ProjectId;
576 const threadId = "thread-1" as ThreadId;
577 const environmentId = "env-1" as EnvironmentId;
578
579 const project = {
580 id: projectId,
581 title: "T3 Code",
582 workspaceRoot: "/workspace",
583 repositoryIdentity: null,
584 defaultModelSelection: null,
585 scripts: [],
586 createdAt: now,
587 updatedAt: now,
588 } satisfies OrchestrationProjectShell;
589
590 const thread = {
591 id: threadId,
592 projectId,
593 title: "Run remote agent",
594 modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
595 runtimeMode: "full-access",
596 interactionMode: "default",
597 branch: null,
598 worktreePath: null,
599 latestTurn: {
600 turnId: "turn-1" as TurnId,
601 state: "running",
602 requestedAt: now,
603 startedAt: now,
604 completedAt: null,
605 assistantMessageId: null,
606 },
607 createdAt: now,
608 updatedAt: now,
609 archivedAt: null,
610 session: {
611 threadId,
612 status: "running",
613 providerName: "Codex",
614 runtimeMode: "full-access",
615 activeTurnId: "turn-1" as TurnId,
616 lastError: null,
617 updatedAt: now,
618 },
619 latestUserMessageAt: now,
620 hasPendingApprovals: false,
621 hasPendingUserInput: false,
622 hasActionableProposedPlan: false,
623 } satisfies OrchestrationThreadShell;
624
625 const descriptor = {
626 environmentId,
627 label: "Test Desktop",
628 platform: {
629 os: "darwin",
630 arch: "arm64",
631 },
632 serverVersion: "0.0.0-test",
633 capabilities: {
634 repositoryIdentity: true,
635 },
636 } satisfies ExecutionEnvironmentDescriptor;
637
638 globalThis.fetch = ((input: Parameters<typeof fetch>[0]) => {
639 const url = new URL(
640 typeof input === "string" || input instanceof URL
641 ? input
642 : (input as unknown as { readonly url: string }).url,
643 );
644 runFork(Deferred.succeed(fetchSeen, url));
645 return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
646 }) as unknown as typeof fetch;
647 yield* Effect.addFinalizer(() =>
648 Effect.sync(() => {
649 globalThis.fetch = originalFetch;
650 }),
651 );
652
653 const layer = Layer.mergeAll(
654 Layer.succeed(ServerSecretStore.ServerSecretStore, secrets.store),
655 Layer.succeed(ServerEnvironment.ServerEnvironment, {
656 getEnvironmentId: Effect.succeed(environmentId),
657 getDescriptor: Effect.succeed(descriptor),
658 }),
659 Layer.succeed(OrchestrationEngineService, {
660 readEvents: () => Stream.empty,
661 dispatch: () => Effect.succeed({ sequence: 1 }),
662 streamDomainEvents: Stream.fromQueue(events),
663 latestSequence: Effect.succeed(0),
664 } satisfies OrchestrationEngineShape),
665 Layer.succeed(ProjectionSnapshotQuery, {
666 getShellSnapshot: () =>
667 Effect.succeed({
668 snapshotSequence: 1,
669 projects: [project],
670 threads: [thread],
671 updatedAt: now,
672 } satisfies OrchestrationShellSnapshot),
673 getThreadShellById: () => Effect.succeed(Option.some(thread)),
674 getProjectShellById: () => Effect.succeed(Option.some(project)),
675 } as unknown as ProjectionSnapshotQueryShape),
676 );
677
678 yield* Effect.gen(function* () {
679 const relay = yield* AgentAwarenessRelay.AgentAwarenessRelay;
680 yield* secrets.setString(RELAY_URL_SECRET, "https://transport.example.test");
681 yield* secrets.setString(RELAY_ISSUER_SECRET, "https://issuer.example.test");
682 yield* secrets.setString(RELAY_ENVIRONMENT_CREDENTIAL_SECRET, "relay-credential");
683 yield* secrets.setString(PUBLISH_AGENT_ACTIVITY_SECRET, "true");
684 yield* relay.start();
685 yield* Queue.offer(events, {
686 type: "thread.activity-appended",
687 sequence: 1,
688 eventId: "evt-1",
689 commandId: CommandId.make("cmd-1"),
690 aggregateKind: "thread",
691 aggregateId: threadId,
692 actor: { kind: "server" },
693 payload: {
694 threadId,
695 activity: {
696 kind: "approval.requested",
697 },
698 },
699 occurredAt: now,
700 } as unknown as OrchestrationEvent);
701
702 const url = yield* Deferred.await(fetchSeen).pipe(Effect.timeout("2 seconds"));
703 expect(url.origin).toBe("https://transport.example.test");
704 expect(productSpans).toContain("makePublishProof");
705 expect(userSpans).not.toContain("makePublishProof");
706 }).pipe(
707 Effect.provide(
708 AgentAwarenessRelay.layer.pipe(
709 Layer.provide(layer),
710 Layer.provideMerge(NodeServices.layer),
711 ),
712 ),
713 Effect.provideService(RelayClientTracer, Option.some(collectingTracer(productSpans))),
714 Effect.withTracer(collectingTracer(userSpans)),
715 );
716 }),
717 ),
718 );
719});