Skip to content

DEFAULT_WATCH_TIMEOUT_MS (core's actual watch-timeout default) not exported by either SDK #2135

Description

@realfishsam

Gap

Core exports a public constant, DEFAULT_WATCH_TIMEOUT_MS, that is the real default timeout applied by seven exchanges' WebSocket watch* methods when no watchTimeoutMs override is supplied. Neither SDK imports or re-exports this constant. Instead, each SDK independently hardcodes its own 30000 / 30000.0 literal as the watch-timeout default inside its WS client, with no reference back to the core constant. A caller who wants to detect "the server's default watch timeout was used" or build retry/backoff logic around it has no way to read the actual value from either SDK — only to guess that it currently matches core's.

Core

core/src/utils/watch-timeout.ts:7-8

export const DEFAULT_WATCH_TIMEOUT_MS = 30_000;
export function withWatchTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T> { ... }

DEFAULT_WATCH_TIMEOUT_MS is imported and used as the fallback timeout in seven venues' WebSocket configs:
core/src/exchanges/probable/websocket.ts, polymarket_us/websocket.ts, polymarket/websocket.ts, opinion/websocket.ts, kalshi/websocket.ts, gemini-titan/websocket.ts, baozi/websocket.ts.

It is not re-exported from core/src/index.ts (no export * from './utils/watch-timeout'), same situation as addBinaryOutcomes (#2043) and parseOpenApiSpec before it was added — i.e. it is a real, used, top-level export const, just not surfaced through the package barrel or either SDK.

TypeScript SDK

Missing — no import/re-export of DEFAULT_WATCH_TIMEOUT_MS anywhere in sdks/typescript/pmxt/. Instead sdks/typescript/pmxt/ws-client.ts:346 and :398 each hardcode their own timeoutMs = 30000 default parameter, disconnected from the core constant.

Python SDK

Missing — no equivalent constant anywhere in sdks/python/pmxt/. sdks/python/pmxt/ws_client.py:295 and :347 each hardcode timeout_ms: float = 30000.0 as the default parameter, disconnected from the core constant.

Evidence

grep -rn DEFAULT_WATCH_TIMEOUT_MS core/src shows it defined once and consumed by seven exchange WS configs. grep -rn "DEFAULT_WATCH_TIMEOUT_MS\|30000\|30_000" sdks/typescript/pmxt sdks/python/pmxt finds no reference to the core constant's name in either SDK — only independently-hardcoded 30000 literals in ws-client.ts and ws_client.py.

Impact

SDK users cannot programmatically discover the server's real default watch timeout (e.g. to size their own client-side retry/backoff, or to detect when core's default has changed in a new release). The three copies of "30000" (core's constant, TS SDK's literal, Python SDK's literal) can silently drift out of sync on a future core change, since nothing ties the SDK defaults back to the core constant.


Found by automated Core-to-SDK surface coverage audit

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions