Skip to content

fix: capture path drops embed timeoutMs - #30

Merged
TheGreatAxios merged 1 commit into
mainfrom
capture-embed-timeout
Aug 6, 2026
Merged

fix: capture path drops embed timeoutMs#30
TheGreatAxios merged 1 commit into
mainfrom
capture-embed-timeout

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Bug

PR #29 (3b6ded2) plumbed EMBED_TIMEOUT_MS through EngineConfig and into src/services/search.ts's toEmbedClientConfig. But captureDocument (src/services/capture.ts) never called that function — it built its own EmbedClientConfig object literal (validated via EmbedClientConfigSchema directly) that omitted timeoutMs entirely. So in production, capture kept hitting embed-client.ts's 10000ms default regardless of the env var.

Construction sites found

  • src/services/search.tstoEmbedClientConfig / toRerankClientConfig: included timeoutMs.
  • src/services/capture.ts — capture-local toEmbedClientConfig: missing timeoutMs (the bug).
  • src/core/embed-worker.ts — takes EmbedClientConfig as a parameter only, doesn't construct one.
  • src/services/transform.tsbuildEmbedClientConfig / buildRerankClientConfig: build per-request derivation configs from replay params, not from EngineConfig; out of scope (different inputs, not part of this duplication).
  • No other rerank construction site duplicates the EngineConfig-based mapping — only search.ts built one, and capture never needed rerank.

Fix

Extracted toEmbedClientConfig / toRerankClientConfig into a single shared module, src/core/engine-client-config.ts. Both search.ts and capture.ts now import and re-export from there instead of each defining/duplicating the mapping. capture.ts's capture-local literal + schema validation is gone.

Test

Added src/services/capture.test.ts asserting the capture path's embed client config (via toEmbedClientConfig as re-exported by capture.ts) carries EngineConfig.embed.timeoutMs through, plus the undefined-default case.

bun test ./src — 320 pass, 0 fail.

Capture built its own EmbedClientConfig literal instead of using search.ts's
EngineConfig-to-client-config mapping, so EMBED_TIMEOUT_MS never reached the
capture path and it kept timing out at embed-client.ts's 10s default.

Extract the mapping into a single shared engine-client-config.ts used by
search.ts and capture.ts (and re-exported from both for existing imports),
so every construction site stays in sync with EngineConfig.
@TheGreatAxios
TheGreatAxios merged commit 8003402 into main Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant