Skip to content

fix(retrieval): configure database deadline and narrow entity hydration - #537

Merged
fazpu merged 6 commits into
mainfrom
fix/configurable-retrieval-timeout
Nov 6, 2026
Merged

fazpu merged 6 commits into
mainfrom
fix/configurable-retrieval-timeout

Conversation

@fazpu

@fazpu fazpu commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Retrieval could spend most of its hard-coded 25-second database deadline calculating entity statistics the caller never requested, then return an empty boundary. The saved conv-47 run recorded 24 wholly empty deadline results in 69 calls.

This change makes the database budget explicit per QueryEngine/deployment: REMEMBERSTACK_SELFHOST_RETRIEVAL_DATABASE_BUDGET_S, default 120 seconds, maximum 3600. Nested reads retain one absolute deadline and the private bounded pool. Python/TypeScript/CLI requests default to 300 seconds, and CLI --timeout / REMEMBER_TIMEOUT are configurable. LoCoMo freezes both budgets, accounting for the two independently bounded combined-context children.

The view-only p9_42_0063 migration attaches the one-row entity count aggregate with LEFT JOIN LATERAL, allowing identity-only readers to skip unused statistics. Provenance, merge/forget visibility and requested counts are preserved. Alias candidates are materialized before per-candidate authority hydration; exact homonyms remain uncapped and fuzzy/phonetic ordering is unchanged.

The new view AST is registered in the query-space manifest and advances its hash to 9f02973aa7ccf1484b4e4c50cf5318a1065f1a2efe7bccdc0c1776949ae6440f. Ordinary setup therefore moves active saved-query versions to pending_revalidation before publishing the hash; shipped examples follow the existing reseeding policy. The current LoCoMo pin advances. Only the three manifest-identity fields in the D143 default-surface capture advance; every other capture member is unchanged. The separate D143 operation-response fixture and PostgreSQL byte-equality check are retained. This is a surface metadata change, not ingestion reprocessing.

Validation/evidence:

  • All 24 original empty calls returned evidence in a sequential copied-store replay: 13 entity lookups, median 0.124 s; eight fact contexts, median 13.375 s; three source contexts, median 8.065 s. No typed deadline indicators, including child responses.
  • The previously partial combined call returned 50 facts/50 claims/50 chunks in 18.088 s. T1 and T2 spelling checks also returned the expected candidates.
  • Real Alembic migration and subsequent reads preserved 14 stored-table fingerprints and all 118 entity counts. Original benchmark state SHA is unchanged. Raw timings, SQL, requests/results, plans and source snapshots are archived in GCS; see operations PR #777.
  • Request timings used source 7200a4a before the metadata-only manifest registration; the retrieval SQL and view body are unchanged by that correction. This is one warm copied store, not a corpus-size/concurrency latency guarantee.
  • Full offline CI unit pack at the updated capture: 3,094 passed/11 optional skipped. TypeScript: 514 passed/8 skipped. The earlier broad surface/profile run had 1,338 passed/496 PG-dependent skipped. Types, lint and import contracts passed.
  • PostgreSQL surface/adapter CI passed on the earlier head. All current-head CI passed, including the spine pruning/migration tests and corrected Compose schema-head assertion. Claude Opus 5.5 high APPROVED exact head 1f204da after the full review and final delta check. All required current-head CI passed, including PostgreSQL workers/spine, surfaces, adapters, Compose upgrade and contract/SDK checks.

Sources: QueryEngine, bounded read admission, SelfHostSettings/EngineSettings, current-entity view and migrations, D89/D97/D142, saved conv-47 traces, copied-store wait events/EXPLAIN and PR #505's chunk-search measurement scope. Rationale: plan/analysis/retrieval_database_deadline_20261106.md.

No stored ingestion products, paid-product reuse keys/generations, model bindings, answer/judge prompts, gold labels or scores change. The original 17/20 run and GCS archives remain immutable. Full scoring remains paused. Old v39 runs remain readable as recorded runs; changed-current-pin execution requires a new prepared identity. Longer budgets hold a slot/snapshot longer and require appropriate client/proxy timeouts. Disconnect-driven SQL cancellation is outside scope. Doctor's short health probe and the remote MCP bridge have documented timeout exceptions. Autoboard status is unavailable without BOARD_API_KEY.

@fazpu
fazpu force-pushed the fix/configurable-retrieval-timeout branch from c3b7b24 to 7200a4a Compare November 6, 2026 18:18
@fazpu
fazpu marked this pull request as ready for review November 6, 2026 18:58
@fazpu
fazpu merged commit b64a1a2 into main Nov 6, 2026
23 checks 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