Skip to content

Commit cafcb01

Browse files
t3dotggclaude
andcommitted
perf(server): check the relay link with one secret read before the publish setting
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 5ddafcc commit cafcb01

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎apps/server/src/relay/AgentAwarenessRelay.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,12 @@ export const make = Effect.gen(function* () {
542542
// Publishes the active threads once. Returns why it did not, so the retry
543543
// knows whether it is waiting on a link or on the publish setting.
544544
const publishActiveThreadsUnsafe = Effect.gen(function* () {
545-
const relayConfig = yield* readRelayConfig.pipe(Effect.orElseSucceed(() => null));
546-
if (!relayConfig) {
545+
// One secret read settles the common never-linked case; the full link
546+
// config is read only once publishing is on.
547+
const relayUrl = yield* readSecretString(RELAY_URL_SECRET).pipe(
548+
Effect.orElseSucceed(() => null),
549+
);
550+
if (!relayUrl) {
547551
yield* Effect.logDebug("agent activity snapshot skipped; relay link credentials unavailable");
548552
return "unlinked" as const;
549553
}
@@ -554,6 +558,11 @@ export const make = Effect.gen(function* () {
554558
yield* Effect.logDebug("agent activity snapshot skipped; publication disabled");
555559
return "disabled" as const;
556560
}
561+
const relayConfig = yield* readRelayConfig.pipe(Effect.orElseSucceed(() => null));
562+
if (!relayConfig) {
563+
yield* Effect.logDebug("agent activity snapshot skipped; relay link credentials unavailable");
564+
return "unlinked" as const;
565+
}
557566
const environmentId = yield* serverEnvironment.getEnvironmentId;
558567
const snapshot = yield* snapshotQuery.getShellSnapshot();
559568
const activeThreadIds = resolveAgentAwarenessRelayActiveThreadIds({

0 commit comments

Comments
 (0)