Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Raise slow RPC ack warning threshold to 15s (#1760)
Julius Marmingee0874b651d5c
diff --git a/apps/web/src/rpc/requestLatencyState.ts b/apps/web/src/rpc/requestLatencyState.tsindex 01c59ea0d..d21e37b52 100644--- a/apps/web/src/rpc/requestLatencyState.ts+++ b/apps/web/src/rpc/requestLatencyState.ts@@ -3,8 +3,9 @@ import { Atom } from "effect/unstable/reactivity";import { appAtomRegistry } from "./atomRegistry";-export const SLOW_RPC_ACK_THRESHOLD_MS = 2_500;+export const SLOW_RPC_ACK_THRESHOLD_MS = 15_000;export const MAX_TRACKED_RPC_ACK_REQUESTS = 256;+let slowRpcAckThresholdMs = SLOW_RPC_ACK_THRESHOLD_MS;export interface SlowRpcAckRequest {readonly requestId: string;@@ -56,12 +57,12 @@ export function trackRpcRequestSent(requestId: string, tag: string): void {startedAt: new Date(startedAtMs).toISOString(),startedAtMs,tag,- thresholdMs: SLOW_RPC_ACK_THRESHOLD_MS,+ thresholdMs: slowRpcAckThresholdMs,};const timeoutId = setTimeout(() => {pendingRpcAckRequests.delete(requestId);appendSlowRpcAckRequest(request);- }, SLOW_RPC_ACK_THRESHOLD_MS);+ }, slowRpcAckThresholdMs);pendingRpcAckRequests.set(requestId, {request,@@ -119,9 +120,14 @@ function evictOldestPendingRpcRequestIfNeeded(): void {}export function resetRequestLatencyStateForTests(): void {+ slowRpcAckThresholdMs = SLOW_RPC_ACK_THRESHOLD_MS;clearAllTrackedRpcRequests();}+export function setSlowRpcAckThresholdMsForTests(thresholdMs: number): void {+ slowRpcAckThresholdMs = thresholdMs;+}+export function useSlowRpcAckRequests(): ReadonlyArray<SlowRpcAckRequest> {return useAtomValue(slowRpcAckRequestsAtom);}diff --git a/apps/web/src/wsTransport.test.ts b/apps/web/src/wsTransport.test.tsindex af02a5288..da5404b23 100644--- a/apps/web/src/wsTransport.test.ts+++ b/apps/web/src/wsTransport.test.ts@@ -5,7 +5,11 @@ import {__resetClientTracingForTests,configureClientTracing,} from "./observability/clientTracing";-import { getSlowRpcAckRequests, resetRequestLatencyStateForTests } from "./rpc/requestLatencyState";+import {+ getSlowRpcAckRequests,+ resetRequestLatencyStateForTests,+ setSlowRpcAckThresholdMsForTests,+} from "./rpc/requestLatencyState";import {getWsConnectionStatus,getWsConnectionUiState,@@ -292,6 +296,8 @@ describe("WsTransport", () => {});it("marks unary requests as slow until the first server ack arrives", async () => {+ const slowAckThresholdMs = 25;+ setSlowRpcAckThresholdMsForTests(slowAckThresholdMs);const transport = new WsTransport("ws://localhost:3020");const requestPromise = transport.request((client) =>@@ -320,7 +326,7 @@ describe("WsTransport", () => {tag: WS_METHODS.serverUpsertKeybinding,},]);- }, 5_000);+ }, 1_000);socket.serverMessage(JSON.stringify({@@ -343,7 +349,7 @@ describe("WsTransport", () => {expect(getSlowRpcAckRequests()).toEqual([]);await transport.dispose();- }, 10_000);+ }, 5_000);it("sends unary RPC requests and resolves successful exits", async () => {const transport = new WsTransport("ws://localhost:3020");