Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(propose_takes): make the extractor call timeout configurable (#5958)
time-attackce177401bc60
diff --git a/scripts/function-size-baseline.tsv b/scripts/function-size-baseline.tsvindex 3e6d80bad3..47605b2545 100644--- a/scripts/function-size-baseline.tsv+++ b/scripts/function-size-baseline.tsv@@ -36,7 +36,7 @@ src/core/cycle/extract-atoms.ts runPhaseExtractAtoms>withBudgetTracker(#1) 316 ssrc/core/cycle/extract-facts.ts runExtractFacts 505 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)src/core/cycle/grade-takes.ts GradeTakesPhase.process 402 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)src/core/cycle/patterns.ts runPhasePatterns 303 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)-src/core/cycle/propose-takes.ts ProposeTakesPhase.process 427 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)+src/core/cycle/propose-takes.ts ProposeTakesPhase.process 429 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +2 #5958 (issue #5874): call_timeout_ms read and its per-page bound (phaseBoundedCallTimeout)src/core/cycle/synthesize-concepts.ts runPhaseSynthesizeConcepts 473 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +4 #5490 review: a narrative a chat_fallback_chain model wrote is hashed under that model so the next cycle re-synthesizes it; +13 fix wave 9 lane P (D-N3): fence-stripped member hash with legacy-hash grandfathering, and the classic write moved to publishClassicConcept (concept-publication.ts); +3 (#5041): opt-in concept write-through hook and the import callback publishClassicConcept runs under the page lock; +6 #4907 (issue #4906): configured budget read, budget-capped counter, summary clause and details.warnings (message text in budgetWarnings)src/core/cycle/synthesize.ts runPhaseSynthesizeInner 1046 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +3 #5854: publish_pending from postprocess, a pending summary publish deferred instead of failing the phasesrc/core/facts/backstop.ts runPipelineBodyInner 358 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 6b2f5c2725..fdd3fc99fc 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -36,7 +36,7 @@ src/core/embedding-migration.ts 1586 ratchet new row: crossed 1500 in v0.46.25.0src/core/github-source.ts 1530 ratchet new row: crossed the 1500 unlisted cap in v0.46.23.0 review fix wave (scope-state gating, client hardening, symlink containment); merged reliability/shared-skills source integration; managed sweep lease wrapper; fix wave 3 lane A: config parser peeled to github-source-config.ts (-47), +account pin wiring and pinned-installation refreshsrc/commands/hook.ts 1903 ratchet cathedral-5 heartbeat extraction offsets part of the BrainBench-seam growth; grown v0.46.26.0 megawave hooks-ipc (#4245); +108 monthly backup check: banner + gated session-start note + detached spawn (backup/status-file readers); +28 ship-review egress hardening: per-harness capture dispatch (capture-spec), memorable gate + receipt + relay block, fail-closed unscanned/newest-guess skips; +79 ambient-writeback WP4: hookStop bank step (gate -> bankWritebackTurn -> IPC flush; gate/bank logic live in core/facts + corpus-segments); +41 adversarial fix wave: wide-tail retry when the 128KB window misses the user turn, by-design heartbeat outcome classes, source-in-name banking; +11 #5413 session-end skips claude-cli self-transcripts; +11 #5701: hook lanes pass allowOversize so a long session reaches the bounded tail readsrc/core/chunkers/code.ts 1588 ratchet new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (decorated-python defs #3821, version-gate + timeout chunker fixes); grown wave-g (#4511): named defs never folded into merged chunks; grown #4669: skip WASM parse for languages without TOP_LEVEL_TYPES; +6 N13-1: CodeChunkMetadata.definesFunction field + merge-guard stamp (predicate lives in def-types.ts)-src/core/config.ts 1874 ratchet +8 #5988: sync.holds/hold_cap/hold_escalate_count/hold_escalate_pct/parser_regression key registration (read by persistence/sync-holds.ts); +3 agent operator wave A4: GBrainConfig.consent file-plane slot + 2 consent.preapprove.* key rows (logic in core/consent.ts); +1 System One v1: decide.* key prefix (validated by ai/decide/config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (spend-controls hint #3703, config-set validation); +3 wave G #3974: sync.include_working_tree key; grown wave-g (#4540 #4494 #4415): extractor caps + intent-pattern config keys; +1 chat-connectors: connectors. config prefix; wave-k: config-table snapshot serving the DB-plane reads (#3980 + #2119 merge); +8: loadConfig hook for ~/.gbrain/.env, loader lives in gbrain-env-file.ts (#3893); +17: litellm/together key-fold slots (#3904 reimpl: two GBrainConfig fields + KNOWN_CONFIG_KEYS rows); +1: link_resolution.cross_source key (#3908); +4 v0.47 gmail-loops: loops.extraction_enabled key; +1: pricing.overrides key (#4633 adoption); +7 #4667 adoption: sync.exclude key registration; +4: eval fix wave keys (quote_verify + 3 rescue knobs); +memorable file-plane key registration (integrations.memorable.enabled + consent-event doc); +33 ambient-writeback: memory.* + brain.audience key registration + GBrainConfig.memory mirror slot (resolvers live in facts/writeback-config.ts); +38 2026-08 wave: retrieval_reflex_volunteer key + env mapping (volunteer-arm kill switch) + E5a registration of the 10 adaptive_return*/autocut*/crag_* search (incl. adversarial batch isEnvDisabled dedup); ambient-writeback (master merge): facts/writeback-config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave; prior growth: sync/intent/chat-connectors/litellm/pricing/loops key folds; +34: #4702 content_sanity.disabled_patterns (type + DB-plane parse/merge + key registration); composition true-up (fix-wave multi-train) | merged v0.48.1.0: master #4788 writeback keys + wave #4702/#4748 keys; master: | merged v0.48.1.0 true-up; ranker wave v0.48.4.0: +4 KNOWN_CONFIG_KEYS rows (+8); +5 #4895: CWD_DOTENV_FILES gains the per-NODE_ENV .local variants Bun auto-loads; +2 #5003: sync.include_hidden key registration; +57 #4605: search.* registry reconciled to the keys mode.ts reads (+20 knob rows, +4 direct-read singletons) + GBrainConfig.search slot + adaptive_return* DB-plane merge; +2 pre-landing review: fts.reindex_in_progress key registration (#4795 marker escape hatch); +4 #4987: auto_timeline key registration (the documented off switch was rejected as unknown); lowered to 1793: GHSA wave v0.50.5.0 moved CWD_DOTENV_FILES + dotenvValuesForKey into core/env-trust.ts (-49, re-exported); re-summed to the merged line count after merging master v0.50.2.0 (#5122) with the v0.50.5.0 security wave; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; evidence delivery: 5 registered config keys + comment (+7); +2 #5691: embedding_query_prefix key registration; evidence delivery auto v2: search.return_budget_conversation key row (+1); +1 #5836: facts.entity_inference key row; +6 #5824: search.vector_legacy_guard key row + GBrainConfig.search slot + DB-plane merge; +3 wave 8 lane D1 #5885: takes.auto_embed key row; +3 #5232: GBrainConfig.persistence.write_wait_ms file-plane slot + key row (resolver in persistence/write-wait.ts); +2 F4b: planner.* and import.analyze_every_pages keys; +3 cat40 cost wave C1 (garrytan/gbrain-evals#57 follow-ups): mcp.result_rows GBrainConfig slot + key row (resolver in mcp/result-rows.ts); v0.60.46.0 merge: both waves' +3 compose (1824 + 3 = 1827 measured); +4 #5984: sync.bulk, sync.bulk_size, sync.bulk_max_txn_ms known keys; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (1838 measured); +3 retrieval feedback: the feedback keys in KNOWN_CONFIG_KEYS; 2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); P3 x engine graduation composition: both deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); P3 x foundations-2 composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); P3 x P1 (v0.60.57.0) composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; P3 x P7 (v0.60.60.0) composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; +3 agent operator follow-up Item 2: mcp.allow_session_widen (GBrainConfig.mcp slot + known key); P3 x aow-followup composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; +3 agent operator follow-up Item 2: mcp.allow_session_widen (GBrainConfig.mcp slot + known key); +2 entity mention index: mentions.auto_link, mentions.entity_types, mentions.ignore key rows (resolver in core/mentions/policy.ts); cat40 entity wave merge with v0.60.61.0 (1853 measured); P3 x cat40-entity-wave composition: deltas re-summed at the merge; +6 fix wave lane B3: chat_fallback_on_refusal (GBrainConfig slot, GBRAIN_CHAT_FALLBACK_ON_REFUSAL env fold, known key); +2 W-B4: shared_skills.inventory.* known keys (logic in shared-skills/inventory-limits.ts); +2 fix wave 9 lane B #4921: ai.chat.per_turn_timeout_ms known key; +1 wave 9 lane W #5363: cycle.consolidate.cluster_threshold key row; +1 #5984 lanes: sync.lanes key registration; +2 P8: dream.quote_verify and think.quote_verify known keys; +2 P8: GBrainConfig.mcp.advertised_surface interface slot (resolver in mcp/surface.ts); +2 fix wave 10 lane L1 #4907: cycle.synthesize_concepts.budget_usd registered (validation in cycle/phase-config-values.ts)+src/core/config.ts 1876 ratchet +8 #5988: sync.holds/hold_cap/hold_escalate_count/hold_escalate_pct/parser_regression key registration (read by persistence/sync-holds.ts); +3 agent operator wave A4: GBrainConfig.consent file-plane slot + 2 consent.preapprove.* key rows (logic in core/consent.ts); +1 System One v1: decide.* key prefix (validated by ai/decide/config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (spend-controls hint #3703, config-set validation); +3 wave G #3974: sync.include_working_tree key; grown wave-g (#4540 #4494 #4415): extractor caps + intent-pattern config keys; +1 chat-connectors: connectors. config prefix; wave-k: config-table snapshot serving the DB-plane reads (#3980 + #2119 merge); +8: loadConfig hook for ~/.gbrain/.env, loader lives in gbrain-env-file.ts (#3893); +17: litellm/together key-fold slots (#3904 reimpl: two GBrainConfig fields + KNOWN_CONFIG_KEYS rows); +1: link_resolution.cross_source key (#3908); +4 v0.47 gmail-loops: loops.extraction_enabled key; +1: pricing.overrides key (#4633 adoption); +7 #4667 adoption: sync.exclude key registration; +4: eval fix wave keys (quote_verify + 3 rescue knobs); +memorable file-plane key registration (integrations.memorable.enabled + consent-event doc); +33 ambient-writeback: memory.* + brain.audience key registration + GBrainConfig.memory mirror slot (resolvers live in facts/writeback-config.ts); +38 2026-08 wave: retrieval_reflex_volunteer key + env mapping (volunteer-arm kill switch) + E5a registration of the 10 adaptive_return*/autocut*/crag_* search (incl. adversarial batch isEnvDisabled dedup); ambient-writeback (master merge): facts/writeback-config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave; prior growth: sync/intent/chat-connectors/litellm/pricing/loops key folds; +34: #4702 content_sanity.disabled_patterns (type + DB-plane parse/merge + key registration); composition true-up (fix-wave multi-train) | merged v0.48.1.0: master #4788 writeback keys + wave #4702/#4748 keys; master: | merged v0.48.1.0 true-up; ranker wave v0.48.4.0: +4 KNOWN_CONFIG_KEYS rows (+8); +5 #4895: CWD_DOTENV_FILES gains the per-NODE_ENV .local variants Bun auto-loads; +2 #5003: sync.include_hidden key registration; +57 #4605: search.* registry reconciled to the keys mode.ts reads (+20 knob rows, +4 direct-read singletons) + GBrainConfig.search slot + adaptive_return* DB-plane merge; +2 pre-landing review: fts.reindex_in_progress key registration (#4795 marker escape hatch); +4 #4987: auto_timeline key registration (the documented off switch was rejected as unknown); lowered to 1793: GHSA wave v0.50.5.0 moved CWD_DOTENV_FILES + dotenvValuesForKey into core/env-trust.ts (-49, re-exported); re-summed to the merged line count after merging master v0.50.2.0 (#5122) with the v0.50.5.0 security wave; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; evidence delivery: 5 registered config keys + comment (+7); +2 #5691: embedding_query_prefix key registration; evidence delivery auto v2: search.return_budget_conversation key row (+1); +1 #5836: facts.entity_inference key row; +6 #5824: search.vector_legacy_guard key row + GBrainConfig.search slot + DB-plane merge; +3 wave 8 lane D1 #5885: takes.auto_embed key row; +3 #5232: GBrainConfig.persistence.write_wait_ms file-plane slot + key row (resolver in persistence/write-wait.ts); +2 F4b: planner.* and import.analyze_every_pages keys; +3 cat40 cost wave C1 (garrytan/gbrain-evals#57 follow-ups): mcp.result_rows GBrainConfig slot + key row (resolver in mcp/result-rows.ts); v0.60.46.0 merge: both waves' +3 compose (1824 + 3 = 1827 measured); +4 #5984: sync.bulk, sync.bulk_size, sync.bulk_max_txn_ms known keys; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (1838 measured); +3 retrieval feedback: the feedback keys in KNOWN_CONFIG_KEYS; 2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); P3 x engine graduation composition: both deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); P3 x foundations-2 composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); P3 x P1 (v0.60.57.0) composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; P3 x P7 (v0.60.60.0) composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; +3 agent operator follow-up Item 2: mcp.allow_session_widen (GBrainConfig.mcp slot + known key); P3 x aow-followup composition: deltas re-summed at the merge; 2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +3 P7 search.relational_planner / search.relational_orient_onehop key registration; +2 P7 search.relational_chain_slots key registration; +3 agent operator follow-up Item 2: mcp.allow_session_widen (GBrainConfig.mcp slot + known key); +2 entity mention index: mentions.auto_link, mentions.entity_types, mentions.ignore key rows (resolver in core/mentions/policy.ts); cat40 entity wave merge with v0.60.61.0 (1853 measured); P3 x cat40-entity-wave composition: deltas re-summed at the merge; +6 fix wave lane B3: chat_fallback_on_refusal (GBrainConfig slot, GBRAIN_CHAT_FALLBACK_ON_REFUSAL env fold, known key); +2 W-B4: shared_skills.inventory.* known keys (logic in shared-skills/inventory-limits.ts); +2 fix wave 9 lane B #4921: ai.chat.per_turn_timeout_ms known key; +1 wave 9 lane W #5363: cycle.consolidate.cluster_threshold key row; +1 #5984 lanes: sync.lanes key registration; +2 P8: dream.quote_verify and think.quote_verify known keys; +2 P8: GBrainConfig.mcp.advertised_surface interface slot (resolver in mcp/surface.ts); +2 fix wave 10 lane L1 #4907: cycle.synthesize_concepts.budget_usd registered (validation in cycle/phase-config-values.ts); +2 #5958: dream.propose_takes.call_timeout_ms registeredsrc/core/bootstrap/harness.ts 2711 ratchet +29 live-PGLite-serve lane: LIVE_SERVE refusal ahead of source resolution + unpinned --token hooks (CI e2e fix); +46 wave review: resolveHookSource dep (serve-parity resolver + federated grant), --source shape validation, loud SOURCE_UNRESOLVED instead of a silent 'default'; +10: #4574 parseCodexBlockBearer http_headers shape + legacy bearer_token fallback; +4 at megawave/wave-k merge; +codex hooks lane: step-7 codex hooks.json + config.toml trust pair, removeHarness arm; +234 ambient-writeback WP3: kind:'instructions' targets (plan/apply/converge-off/remove/status probes, OV-A4 override pre-check) — splice/render mechanics live in instructions-block.ts; +59 adversarial fix wave: registrar-mode block suppression, converge-failure receipt tracking, MCP-confirmed guard before block install; +26 round-3 fixes: codex-lane MCP-confirmed guard + smoke-rollback block strip; master: | merged v0.48.1.0 true-up; +41 #4897 resolveImplicitSource dep + defaultResolveImplicitSource: hooks/token/receipt bind to the serve's implicit default source when --source is omitted; +23 #4586 statusHarness live claude-code mcp verdict (URL mismatch or same-scope non-HTTP registration reads failed, receipt untouched); shared-skills integration on company-ingestion base; +18 #5671: logAmbientPostureNotes helper (registrar note moved out of applyHarness + pre-consent warning when an explicit private facts default meets the HTTP harness; text shared with doctor in facts/writeback-config.ts); +24 #5893: rotation grant carry wiring and its rotationCarry/withheldOperationsNote helpers (carry rules live in token-mint.ts carryLegacyGrant); +6 #5878: --refresh-skills flag and status epoch line (refresh logic lives in harness-skills.ts); +7 #4618 seat: HarnessFlags.seat field, --seat/--no-seat parse via hooks.ts parseSeatFlags, GBRAIN_SEAT in the hook envsrc/core/oauth-provider.ts 1236 ratchet new row: crossed the 1500 unlisted cap absorbing #3819 (DCR 400 invalid_client_metadata + scope filtering + custom-scheme redirect_uris + pseudo-scheme guard); merged v0.49: transactional grant enforcement shared with hosted grant policies; +1 #5222 resourceUrl optionsrc/core/ops/pages.ts 671 ratchet crossed the unlisted 1500 cap in the fix wave: pack-vocabulary enforcement on capture (#4721) + get_page alias follow (#4275) landed together; next growth should peel a pages-ops submodule; +3: alias hop reads the canonical in the owning source (ship-review); +5: explicit source_id liveness check in get_page/list_pages (#4620); +3: #4857 total-order slug sort + list_pages source_id parse; +5: #4620 explicit removed-source id fails loudly; master integration: +4: authenticated delegated private-write boundary and auto-link suppression; #5105: canonical page mutations peeled into persistence modules; +2 v0.50.5.0 purge parameter and shared preflight call; preparation composes through the persistence modules; +7: source-qualified deep-research fetch authorization and ambiguity refusal (codec lives in deep-research-id.ts); +1 #5567: remote get_page keeps materialized markers; +1 #5622: trusted local capture file parameter; +5 #5709: get_page include_timeline_entries (rows via get_timeline's read policy); +8 GBRA-36 security wave: required outputRedaction policy on each pages op; +1 #5154: list_pages passes listColumnsOnly; +17 #5641: list_pages exposes the updated_after_slug keyset cursor and updated_at_iso; +8 agent operator wave A2: every op declares mutating + idempotent (tags only); +7 F3b (#5954): list_pages pagination meta + listing_truncated notice for MCP callers (logic in ops/list-pages-pagination.ts); +4 #5988: get_page file_held (one indexed hold lookup; logic in persistence/held-reads.ts); +6 #6103: list_pages maps an unreadable updated_after (SQLSTATE 22007/22008) to invalid_params; wave 10 collector: #6103 (+6) and #4807 (+2) composediff --git a/src/core/config.ts b/src/core/config.tsindex b4f5c8b501..54e7ca687f 100644--- a/src/core/config.ts+++ b/src/core/config.ts@@ -1512,6 +1512,8 @@ export const KNOWN_CONFIG_KEYS: readonly string[] = [// inside maxTokens, so the hardcoded defaults truncated every dense page.'dream.propose_takes.max_tokens','dream.propose_takes.retry_max_tokens',+ // #5958: per-call extractor timeout (whole ms 1000..300000; unset scales with the output cap); cycle/phase-config-values.ts.+ 'dream.propose_takes.call_timeout_ms','dream.patterns.lookback_days','dream.patterns.min_evidence',// #2782-family: patterns-phase subagent timeouts (mirror of thediff --git a/src/core/cycle/phase-config-values.ts b/src/core/cycle/phase-config-values.tsindex 90f73faded..aa363ab2d0 100644--- a/src/core/cycle/phase-config-values.ts+++ b/src/core/cycle/phase-config-values.ts@@ -11,6 +11,11 @@ import { opError, type OperationError } from '../ops/contract.ts';export const SYNTHESIZE_CONCEPTS_BUDGET_KEY = 'cycle.synthesize_concepts.budget_usd';export const SYNTHESIZE_CONCEPTS_DEFAULT_BUDGET_USD = 1.5;+export const PROPOSE_TAKES_CALL_TIMEOUT_KEY = 'dream.propose_takes.call_timeout_ms';+export const PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS = 1_000;+/** The gateway's default chat timeout; the gateway still races its own (shorter wins). */+export const PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS = 300_000;+interface PhaseConfigSpec {/** Human range, used in the refusal and the stored-value warnings. */expected: string;@@ -34,6 +39,20 @@ const SPECS: Record<string, PhaseConfigSpec> = {defaultText: String(SYNTHESIZE_CONCEPTS_DEFAULT_BUDGET_USD),parse: finitePositive,},+ [PROPOSE_TAKES_CALL_TIMEOUT_KEY]: {+ expected: `a whole number of milliseconds from ${PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS} to ${PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS}`,+ defaultText: 'scaled with the output cap, 90000 to 300000 ms',+ parse(raw) {+ if (!/^\d+$/.test(raw.trim())) return null;+ const n = Number(raw.trim());+ return n >= PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS && n <= PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS ? n : null;+ },+ clamp(raw) {+ const n = finitePositive(raw);+ if (n === null) return null;+ return Math.min(PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS, Math.max(PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS, Math.floor(n)));+ },+ },};export const PHASE_CONFIG_KEYS: readonly string[] = Object.keys(SPECS);diff --git a/src/core/cycle/propose-takes.ts b/src/core/cycle/propose-takes.tsindex a3deaa488c..268b848bc0 100644--- a/src/core/cycle/propose-takes.ts+++ b/src/core/cycle/propose-takes.ts@@ -40,6 +40,9 @@import { randomUUID, createHash } from 'node:crypto';import { BaseCyclePhase, CYCLE_DEADLINE_RESERVE_MS, type ScopedReadOpts, type BasePhaseOpts } from './base-phase.ts';import { defaultTimeoutMsFor } from '../minions/handler-timeouts.ts';+import {+ PROPOSE_TAKES_CALL_TIMEOUT_KEY, PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS, PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS, readPhaseConfigNumber,+} from './phase-config-values.ts';import { chat as gatewayChat, getChatModel, probeChatModel } from '../ai/gateway.ts';import { createGlobalLlmHaltTracker, haltedClassOf, type GlobalLlmErrorClass } from '../ai/errors.ts';import { normalizeModelId } from '../model-id.ts';@@ -193,6 +196,10 @@ export type ProposeTakesExtractor = (input: {/** #4494: escalated cap for the one truncation retry (default* PROPOSE_TAKES_RETRY_MAX_TOKENS; clamped to >= maxTokens). */retryMaxTokens?: number;+ /** #5874: wall-clock bound for every extractor call+ * (dream.propose_takes.call_timeout_ms, held to the remaining phase+ * time). Unset: scales with the output cap. */+ callTimeoutMs?: number;/** #5425: include EXTRACT_TAKES_ATTRIBUTION_RULES (opt-in). */attributionRules?: boolean;}) => Promise<ProposedTake[]>;@@ -385,12 +392,28 @@ export const PROPOSE_TAKES_RETRY_MAX_TOKENS = 4096;* page was re-billed (base call + aborted retry) forever with no tombstone.* 90s per PROPOSE_TAKES_MAX_TOKENS of output, floored at 90s, capped at* EXTRACTOR_CALL_TIMEOUT_MAX_MS.+ *+ * #5874: a configured `callTimeoutMs` replaces the scaling for every call.+ * The claude-cli provider ignores maxTokens and never reports a truncation,+ * so the retry never runs and the base call keeps 90s, which a large page on+ * a slow model does not fit. The gateway's own chat timeout still races it.*/-function extractorCallTimeoutMs(maxTokens: number): number {+function extractorCallTimeoutMs(maxTokens: number, callTimeoutMs?: number): number {+ if (callTimeoutMs !== undefined) return callTimeoutMs;const scaled = Math.ceil((EXTRACTOR_CALL_TIMEOUT_MS * maxTokens) / PROPOSE_TAKES_MAX_TOKENS);return Math.min(EXTRACTOR_CALL_TIMEOUT_MAX_MS, Math.max(EXTRACTOR_CALL_TIMEOUT_MS, scaled));}+/**+ * #5958: the configured per-call bound, held to the phase time left so it+ * never outlasts the phase deadline (never below the default 90s floor, which+ * the unconfigured path already allows). Unset: no override.+ */+function phaseBoundedCallTimeout(configuredMs: number | undefined, phaseRemainingMs: number): { callTimeoutMs?: number } {+ if (configuredMs === undefined) return {};+ return { callTimeoutMs: Math.min(configuredMs, Math.max(EXTRACTOR_CALL_TIMEOUT_MS, phaseRemainingMs)) };+}+/*** #3763 — halt streak for a dead extractor lane. When EVERY extractor call in* the run has failed (zero successes) and the failure count reaches this@@ -435,13 +458,30 @@ export async function defaultExtractor(// full gateway default (GBRAIN_AI_CHAT_TIMEOUT_MS, 300s) x pageLimit. The// caller already catches per-page errors, logs a warning, and continues.// The bound scales with maxTokens so an escalated or configured larger cap- // gets time to generate what it allows.- const call = (maxTokens: number) => gatewayChat({- messages: [{ role: 'user', content: prompt }],- ...(input.modelHint ? { model: input.modelHint } : {}),- maxTokens,- abortSignal: AbortSignal.timeout(extractorCallTimeoutMs(maxTokens)),- });+ // gets time to generate what it allows, unless+ // dream.propose_takes.call_timeout_ms replaces it for every call.+ const call = async (maxTokens: number) => {+ const timeoutMs = extractorCallTimeoutMs(maxTokens, input.callTimeoutMs);+ const abortSignal = AbortSignal.timeout(timeoutMs);+ try {+ return await gatewayChat({+ messages: [{ role: 'user', content: prompt }],+ ...(input.modelHint ? { model: input.modelHint } : {}),+ maxTokens,+ abortSignal,+ });+ } catch (err) {+ if (!abortSignal.aborted) throw err;+ // #5874: a provider abort message names neither the bound nor the key that moves it.+ const msg = err instanceof Error ? err.message : String(err);+ throw new Error(+ `propose_takes extractor: call timed out after ${timeoutMs} ms on ${input.pagePath} (${msg}); ` ++ `set ${PROPOSE_TAKES_CALL_TIMEOUT_KEY} (${PROPOSE_TAKES_CALL_TIMEOUT_MIN_MS}-${PROPOSE_TAKES_CALL_TIMEOUT_MAX_MS} ms) ` ++ `to change the bound; no tombstone written, page retries next cycle`,+ { cause: err },+ );+ }+ };let result = await call(baseMaxTokens);// #3763: a truncated response (stopReason 'length' — e.g. reasoning tokens@@ -739,6 +779,7 @@ class ProposeTakesPhase extends BaseCyclePhase {if (retryCap != null) extractorRetryMaxTokens = Math.floor(retryCap);} catch { /* keep defaults */ }extractorRetryMaxTokens = Math.max(extractorMaxTokens, extractorRetryMaxTokens);+ const callTimeout = await readPhaseConfigNumber(engine, PROPOSE_TAKES_CALL_TIMEOUT_KEY); // #5874// With the default (gateway) extractor, skip cheaply when the resolved// model's provider can't run — same probe semantics as patterns.ts /@@ -808,7 +849,7 @@ class ProposeTakesPhase extends BaseCyclePhase {budget_exhausted: false,llm_calls_succeeded: 0,llm_calls_failed: 0,- warnings: [],+ warnings: callTimeout.warning ? [callTimeout.warning] : [],deadline_hit: false,};@@ -906,6 +947,7 @@ class ProposeTakesPhase extends BaseCyclePhase {// #4494: configurable output caps (see resolution above).maxTokens: extractorMaxTokens,retryMaxTokens: extractorRetryMaxTokens,+ ...phaseBoundedCallTimeout(callTimeout.value, deadlineMs - (Date.now() - phaseStartMs)),attributionRules,});} catch (err) {diff --git a/test/propose-takes-config-max-tokens.test.ts b/test/propose-takes-config-max-tokens.test.tsindex 7bcce66dec..9c53c6c9b1 100644--- a/test/propose-takes-config-max-tokens.test.ts+++ b/test/propose-takes-config-max-tokens.test.ts@@ -25,6 +25,9 @@ import {PROPOSE_TAKES_RETRY_MAX_TOKENS,type ProposeTakesExtractor,} from '../src/core/cycle/propose-takes.ts';+import { parsePhaseConfigValue } from '../src/core/cycle/phase-config-values.ts';+import { renderCliError } from '../src/core/agent-output.ts';+import { KNOWN_CONFIG_KEYS } from '../src/core/config.ts';import type { OperationContext } from '../src/core/operations.ts';import type { BrainEngine } from '../src/core/engine.ts';@@ -195,3 +198,98 @@ describe('runPhaseProposeTakes threads dream.propose_takes.* config (#4494)', ()expect(seen[0].retryMaxTokens).toBe(PROPOSE_TAKES_RETRY_MAX_TOKENS);});});++// #5958 / #5874: dream.propose_takes.call_timeout_ms. A stored value the phase+// cannot use warns with the key named (never the value); an out-of-range number+// is held to 1000..300000; the configured bound never outlasts the remaining+// phase deadline beyond the default 90s floor.+describe('runPhaseProposeTakes threads dream.propose_takes.call_timeout_ms (#5958)', () => {+ const KEY = 'dream.propose_takes.call_timeout_ms';+ test.each([+ ['an in-range value threads through', '240000', 240_000, false],+ ['unset keeps the output-cap scaling', undefined, undefined, false],+ ['blank reads as unset', ' ', undefined, false],+ ['a non-number keeps the scaling with a warning', 'banana', undefined, true],+ ['zero keeps the scaling with a warning', '0', undefined, true],+ ['a negative value keeps the scaling with a warning', '-7', undefined, true],+ ['a fractional value floors with a warning', '1500.7', 1_500, true],+ ['below 1000 is held to 1000 with a warning', '20', 1_000, true],+ ['above 300000 is held to 300000 with a warning', '300001', 300_000, true],+ ['a value AbortSignal.timeout would reject is held to 300000', '1e16', 300_000, true],+ ] as const)('call_timeout_ms: %s', async (_name, raw, expectedMs, warns) => {+ const engine = buildMockEngine(raw === undefined ? {} : { [KEY]: raw });+ const seen: Array<number | undefined> = [];+ const extractor: ProposeTakesExtractor = async (input) => {+ seen.push(input.callTimeoutMs);+ return [];+ };+ const result = await runPhaseProposeTakes(buildCtx(engine), { extractor });+ expect(seen).toEqual([expectedMs]);+ const warnings = (result.details as { warnings: string[] }).warnings;+ const named = warnings.filter((w) => w.includes(KEY));+ expect(named.length > 0).toBe(warns);+ for (const w of named) {+ expect(w).toContain(`gbrain config set ${KEY}`);+ expect(w).toContain(`gbrain config get ${KEY}`);+ if (raw !== undefined && raw.trim().length > 2) expect(w).not.toContain(raw);+ }+ if (warns) expect(result.status).toBe('warn');+ });++ test('a failed config read keeps the scaling and does not stop the phase', async () => {+ const engine = buildMockEngine({});+ const getConfig = engine.getConfig.bind(engine);+ engine.getConfig = async (key: string) => {+ if (key === KEY) throw new Error('config plane down');+ return getConfig(key);+ };+ const seen: Array<number | undefined> = [];+ const extractor: ProposeTakesExtractor = async (input) => {+ seen.push(input.callTimeoutMs);+ return [];+ };+ const result = await runPhaseProposeTakes(buildCtx(engine), { extractor });+ expect(seen).toEqual([undefined]);+ expect(result.status).not.toBe('fail');+ });++ test('the configured bound is held to the remaining phase deadline, never below the 90s default', async () => {+ const seen: Array<number | undefined> = [];+ const extractor: ProposeTakesExtractor = async (input) => {+ seen.push(input.callTimeoutMs);+ return [];+ };+ await runPhaseProposeTakes(buildCtx(buildMockEngine({ [KEY]: '240000' })), { extractor, deadlineMs: 150_000 });+ expect(seen[0]).toBeGreaterThan(149_000);+ expect(seen[0]).toBeLessThanOrEqual(150_000);+ await runPhaseProposeTakes(buildCtx(buildMockEngine({ [KEY]: '240000' })), { extractor, deadlineMs: 10_000 });+ expect(seen[1]).toBe(90_000);+ });+});++describe('config set validation for dream.propose_takes.call_timeout_ms (#5958)', () => {+ const KEY = 'dream.propose_takes.call_timeout_ms';+ test('the key is registered and an in-range whole number is accepted', () => {+ expect(KNOWN_CONFIG_KEYS).toContain(KEY);+ expect(parsePhaseConfigValue(KEY, '1000')).toBe(1_000);+ expect(parsePhaseConfigValue(KEY, '300000')).toBe(300_000);+ });++ for (const bad of ['999', '300001', '1500.5', 'banana', '0']) {+ test(`${JSON.stringify(bad)} is refused with the rendered contract and never echoed`, () => {+ let err: unknown;+ try { parsePhaseConfigValue(KEY, bad); } catch (e) { err = e; }+ const rendered = renderCliError(err, { json: true, command: 'config', tty: false });+ expect(rendered.exitCode).toBe(2);+ const env = JSON.parse(rendered.stdout!);+ expect(env).toMatchObject({+ code: 'invalid_params',+ fix: { argv: ['gbrain', 'config', 'set', KEY, '<VALUE>'], verify: { argv: ['gbrain', 'config', 'get', KEY] } },+ });+ expect(env.message).toContain('1000 to 300000');+ expect(env.why).toContain('Nothing was written');+ if (bad.length > 1) expect(rendered.stdout).not.toContain(bad);+ });+ }+});+diff --git a/test/propose-takes-truncation.test.ts b/test/propose-takes-truncation.test.tsindex 1011422cd9..527fe18818 100644--- a/test/propose-takes-truncation.test.ts+++ b/test/propose-takes-truncation.test.ts@@ -34,6 +34,7 @@ import {EXTRACTOR_FAILURE_HALT_STREAK,type ProposeTakesExtractor,} from '../src/core/cycle/propose-takes.ts';+import { classifyGlobalLlmError } from '../src/core/ai/errors.ts';import type { OperationContext } from '../src/core/operations.ts';import type { BrainEngine } from '../src/core/engine.ts';@@ -129,45 +130,66 @@ describe('defaultExtractor truncation retry (#3763)', () => {});});-// ─── per-call timeout scales with the output cap (#5771) ────────────+// ─── per-call timeout: output-cap scaling (#5771), override (#5958) ──-describe('defaultExtractor per-call timeout scales with maxTokens (#5771)', () => {+/** Runs `fn` with AbortSignal.timeout spied; returns every armed timeout (ms). */+async function armedTimeouts(fn: () => Promise<unknown>): Promise<number[]> {+ const timeouts: number[] = [];+ const realTimeout = AbortSignal.timeout;+ AbortSignal.timeout = ((ms: number) => {+ timeouts.push(ms);+ return realTimeout.call(AbortSignal, ms);+ }) as typeof AbortSignal.timeout;+ try {+ await fn();+ } finally {+ AbortSignal.timeout = realTimeout;+ }+ return timeouts;+}++describe('defaultExtractor per-call timeout (#5771, #5958)', () => {const input = {pagePath: 'companies/acme-example',pageBody: 'I bet Acme doubles ARR by Q4. They ship weekly.',existingTakes: [],};- async function timeoutsFor(extra: { maxTokens?: number; retryMaxTokens?: number }): Promise<number[]> {- const timeouts: number[] = [];- const realTimeout = AbortSignal.timeout;- AbortSignal.timeout = ((ms: number) => {- timeouts.push(ms);- return realTimeout.call(AbortSignal, ms);- }) as typeof AbortSignal.timeout;+ // The first call truncates, so every case arms the base call AND the retry.+ test.each([+ ['base call keeps 90s; the default 4096 retry gets 180s', {}, [90_000, 180_000]],+ ['a large configured retry cap is bounded at the 300s gateway ceiling, not 90s', { retryMaxTokens: 12_000 }, [90_000, 300_000]],+ ['small caps never drop below the 90s floor', { maxTokens: 256, retryMaxTokens: 256 }, [90_000, 90_000]],+ ['callTimeoutMs bounds both calls', { callTimeoutMs: 240_000 }, [240_000, 240_000]],+ ['callTimeoutMs wins over output-cap scaling, below the default too', { callTimeoutMs: 30_000, retryMaxTokens: 12_000 }, [30_000, 30_000]],+ ] as const)('%s', async (_name, extra, expected) => {let calls = 0;__setChatTransportForTests(async () => {calls++;return calls === 1 ? chatResult('[{"claim_text":"Acme dou', 'length') : chatResult(GOOD_JSON, 'end');});- try {- await defaultExtractor({ ...input, ...extra });- } finally {- AbortSignal.timeout = realTimeout;- }- return timeouts;- }-- test('base call keeps 90s; the default 4096 retry gets 180s', async () => {- expect(await timeoutsFor({})).toEqual([90_000, 180_000]);+ expect(await armedTimeouts(() => defaultExtractor({ ...input, ...extra }))).toEqual([...expected]);});- test('a large configured retry cap is bounded at the 300s gateway ceiling, not 90s', async () => {- expect(await timeoutsFor({ retryMaxTokens: 12_000 })).toEqual([90_000, 300_000]);+ test('a call its own bound stops names the bound and the key, and stays a per-page failure', async () => {+ // Hangs until aborted, the way a stalled `claude -p` does.+ __setChatTransportForTests((opts) => new Promise((_resolve, reject) => {+ opts.abortSignal?.addEventListener('abort', () => reject(new Error('claude-cli adapter aborted')), { once: true });+ }));+ const err = await defaultExtractor({ ...input, callTimeoutMs: 20 }).then(() => null, (e: unknown) => e as Error);+ expect(err?.message).toContain('timed out after 20 ms');+ expect(err?.message).toContain('dream.propose_takes.call_timeout_ms');+ expect(err?.message).toContain('claude-cli adapter aborted');+ expect(classifyGlobalLlmError(err)).toBeNull();});- test('small caps never drop below the 90s floor', async () => {- expect(await timeoutsFor({ maxTokens: 256, retryMaxTokens: 256 })).toEqual([90_000, 90_000]);+ test('a failure before the bound keeps its own error', async () => {+ __setChatTransportForTests(async () => {+ throw new Error('provider exploded');+ });+ const err = await defaultExtractor(input).then(() => null, (e: unknown) => e as Error);+ expect(err?.message).toContain('provider exploded');+ expect(err?.message).not.toContain('timed out');});});@@ -175,10 +197,16 @@ describe('defaultExtractor per-call timeout scales with maxTokens (#5771)', () =interface CapturedSql { sql: string; params: unknown[] }-function buildMockEngine(pageCount: number): { engine: BrainEngine; captured: CapturedSql[] } {+function buildMockEngine(+ pageCount: number,+ config: Record<string, string> = {},+): { engine: BrainEngine; captured: CapturedSql[] } {const captured: CapturedSql[] = [];const engine = {kind: 'pglite',+ async getConfig(key: string): Promise<string | null> {+ return config[key] ?? null;+ },async executeRaw<T>(sql: string, params?: unknown[]): Promise<T[]> {captured.push({ sql, params: params ?? [] });if (sql.includes('SELECT slug, source_id, compiled_truth')) {@@ -207,6 +235,21 @@ function buildCtx(engine: BrainEngine): OperationContext {};}+describe('dream.propose_takes.call_timeout_ms reaches the extractor call (#5958)', () => {+ test('a run that never truncates (the claude-cli shape) arms the configured bound, not 90s', async () => {+ const { engine } = buildMockEngine(1, { 'dream.propose_takes.call_timeout_ms': '240000' });+ // claude-cli ignores maxTokens and always reports a clean stop, so the+ // truncation retry never fires and the base call's bound is the only one.+ __setChatTransportForTests(async () => chatResult(GOOD_JSON, 'end'));+ let details: Record<string, unknown> = {};+ const timeouts = await armedTimeouts(async () => {+ details = (await runPhaseProposeTakes(buildCtx(engine), {})).details as Record<string, unknown>;+ });+ expect(timeouts).toEqual([240_000]);+ expect(details.llm_calls_succeeded).toBe(1);+ });+});+describe('extractor failure-streak halt (#3763)', () => {test(`always-throwing extractor over N+2 pages halts at N with status 'fail' and no tombstones`, async () => {const pageCount = EXTRACTOR_FAILURE_HALT_STREAK + 2;