Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Pre-gate merge of #6564 (capy/lhf-wave ae5604b7e): wave-16 migrations renumbered v241/v242; QUERY_DESCRIPTION carries GBRA-81's rewrite plus the G6.1 clause
garrytaned2b800407f4
diff --cc CHANGELOG.mdindex da71182350,c95cb8dd45..d3e9bda8f4--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,75 -10,33 +10,102 @@@ credits are retained; no result has beeidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).- ## [0.60.186.0] - 2026-10-12++## [0.60.188.0] - 2026-10-12++**Fix wave 16: a page purge no longer holds its source hostage, duplicate-origin twins can be retired, managed sync's leftover bookkeeping has a repair instead of a permanent red doctor, fact extraction stops refusing whole entities for one forgotten claim, long items are no longer certified complete when the model read only their head, four community CLI and platform fixes land, the three test files failing CI without a product bug are fixed at the root, and the nightly routing eval is green again (#6511, #6517, #6518, #6513 follow-ups, #6506, #6523, #6503, #6333, #6521, #6512, #6514, #6510, #5312 in part, #6040, #6495 in part).** `gbrain delete <slug> --purge` searched the source's whole write journal inside its 5-second publication transaction and a timeout there was requeued forever, blocking every later write to the source; the search now runs at preparation under the preparation budget and the in-transaction lookups fail terminally. Two live pages recording one file had no supported exit short of raw SQL; a soft delete now keeps the file and hides the page. On a managed brain one forgotten claim refused the entity's whole fact group; the claim is skipped and counted. `extract_atoms` stamped an item complete after reading a 50,000-character head and could later retire the atoms a larger cap had produced from the tail; it now records the item as partial. Two additive migrations (v240 online index, v241 nullable column), no paid model call added, no change to any weights file. Plan reviewed by three voices and approved by Garry on 2026-10-12.++### Itemized changes++**Persistence: purge, origins, request indexes (#6511, #6517)**++- **Page purge journal sweep at preparation (#6511).** `preparePagePurge` (`src/core/persistence/page-purge.ts`) reads the page's claims (fact rows and takes filed on the page, trimmed, 8 characters or longer, at most 32 needles) and runs `sweepRequestsCarrying` (`intent-redaction.ts`) at claim steps `purge_claims` / `purge_journal_sweep`: a keyset walk of the source's journal in 2,000-row chunks, every needle in raw and JSON-escaped form against intent, outcome, error detail and error message, compacted rows included, stopped by the claim clock between chunks and at the 10,000-match cap. The sweep records the `sequence` ceiling and the rows pending at the scan; the publication transaction re-checks only the tail past the ceiling and those rows, so a carrying request admitted-then-cancelled or settled after the scan is still redacted and a request still queued at publication is left in place. The committed receipt reports `journal_sweep` (`ceiling`, `scanned`, `tail`, `pending_rechecked`, `complete`); `complete: false` means a cap was hit and is never swallowed. A sweep that outruns the preparation budget is a charged `preparation_deadline` release and `preparation_stalled` at the attempt limit, never a transaction timeout.+- **`purge_lookup_timeout` (#6511).** The lookups that stay inside the transaction (the slug lookup, the tail and pending re-checks, the locking read of `redactRequestIntents`) map a 57014 statement timeout to the terminal, non-retryable `purge_lookup_timeout` on the first claim: nothing removed, tombstoned or redacted, the failed receipt retained, a following write to the source commits, a same-id retry returns the failure and a new `request_id` is admitted. The message names `gbrain repair request-indexes --apply` only when the slug index is missing or INVALID. Registry row (`class: caller`, `actor: host_admin`), `docs/guides/write-refusals.md#purge_lookup_timeout`. `purge_fact` (`src/core/facts/purge.ts`) maps the same timeout of its planning read to the same code.+- **Migration v240 `persistence_request_slug_intent_index` (#6511).** Partial index `persistence_requests_slug_intent ON persistence_requests(source_id,slug,sequence) WHERE intent IS NOT NULL AND NOT compacted`, built online in the `v179` shape (`transaction: false`, CONCURRENTLY on Postgres after dropping an INVALID leftover, inline on PGLite). `readRequestIndexStates`, doctor `persistence_request_indexes` and `gbrain repair request-indexes` cover it through `PERSISTENCE_REQUEST_ONLINE_INDEXES`. DDL only: no column, no backfill.+- **Fault seams (#6511).** `purge:slug_lookup`, `purge:tail_recheck`, `purge:pending_recheck`, `purge:redaction_read`, `purge:sweep_chunk`, `purge:carrying_lookup` in `fault-points.ts`; production never installs a hook; the tests inject a 57014 or a stall at these seams, never through an SQL substring.+- **One origin rule (#6517).** `selectOriginClaimant` (`src/core/persistence/sync-origin.ts`) decides which page an origin file identifies when several pages record it: a live page wins over tombstones; several live pages refuse; a single tombstone may be reused; several tombstones stay ambiguous. Discovery's census (`sync-discovery.ts`, the one-statement identity snapshot now carries `deleted_at`) and `assertSyncPageOrigin` both apply it, so a soft-deleted twin no longer blocks the survivor's imports; the `page_identity_changed` refusals for several live claimants name the soft-delete exit. `assertSoleFileClaim` (`reconcile-state.ts`) uses the same census.+- **Shared-origin soft delete (#6517).** `delete_page` of a page whose file another live page of the source records (`findLiveFileClaimants`, new `src/core/persistence/file-claims.ts`) keeps the file and publishes database-only before any byte comparison: receipt `write_through.skipped: 'shared_origin'` with the warning "The selected database page is hidden; the file and the surviving page remain. This does not erase that file's contents." and the `gbrain sync --source <id> --no-pull --full` that imports the kept file into the surviving page. The survivor is revalidated under the publication guards; the file moved or removed, or a different set of claimants, refuses `source_changed` and never removes the file as a fallback. A purge of a shared-origin page refuses and names the soft delete. The receipt names the surviving slug to the trusted local owner and to a remote writer whose grant, delegated namespace and page visibility independently cover it (`slugDisclosable`, `authority.ts`); every other remote writer reads "Another page of this source records the same file." with no slug and no path.++**Managed sync bookkeeping and diagnostics (#6518, #6513 follow-ups)**++- **Stale bookkeeping of a source incarnation the source no longer has is retirable; `doctor --fast` no longer reports a vanished failure as FAIL (#6518).** A source re-pointed at a new checkout, or removed and added again, left its old cursor, failure row and local-ledger mirror under the previous incarnation: `gbrain sync status` named a cursor no current sync could select, `readManagedSyncFailures` saw nothing while `doctor --fast` still failed on the mirrored row. `gbrain repair managed-sync-orphans --source <id>` now lists such rows as `incarnation_retired` and ledger rows whose durable failure row is gone as `mirror_only`, and applies them under the printed hash; a successful sync prunes a source's stale mirror rows. `gbrain doctor` (with a database) classifies the orphans and names the repair even when no current failure is visible; a classification that fails names its code and is never reported healthy. `gbrain doctor --fast` (no database) reports mirrored managed rows as `warn` "could not be verified without a database connection" instead of `fail`, while old unmanaged file failures keep their severity. `gbrain sync status --source <id> --json` reports an old-incarnation cursor as `cursor: null` with `last_error.code: cursor_incarnation_retired` and the repair preview as `next`.+- **A checkpoint whose cursor another run of the same source replaced is superseded, not failed (#6513 comments).** When a `--retry-failed` rediscovery or a newer sync replaced the cursor while an older run's final checkpoint was in flight, the loser's checkpoint refused `revision_conflict`, its run recorded a managed-sync failure, `gbrain doctor` reported it as unresolved and `--retry-failed` treated the receipt as a page fault. The refusal is now `sync_cursor_replaced` (receipt state `conflict`; new `sync-checkpoint-replaced.ts`), nothing is recorded for the superseded checkpoint, the run that awaited it goes on with the cursor that now covers the source, and `--retry-failed` converts nothing. A same-run index lag still reports `revision_conflict`; a missing manifest still reports `storage_error`.+- **A publication a database trigger refuses names the trigger, its table and a closed reason wherever the failure is shown (#6513 comments).** A managed sync blocked by a trigger gbrain does not know said only `storage_error: Publication failed (P0001 in <raiser>). Inspect owner diagnostics.`; the receipt's `write_error_detail` was the one place that named the raiser and table. The failure the run records, the failure ledger, `gbrain doctor` and `gbrain sync status --json` (`last_error.write_error_detail`, `last_error.detail`) now carry `raiser`, `table` and a `reason` from a closed set (`PUBLICATION_REASONS`): `attribution_unclassified_table` or `trust_unclassified_table` (a gbrain stamp trigger met a table it is not built for: a version mismatch between processes sharing the database), `graduation_in_progress` (the engine-graduation fence, SQLSTATE 55000, now recognized with a retry-later message instead of an owner-exception `storage_error`, and classified retry / no human in `sync status` and `sync unblock`), or `unknown`. The trigger's message text is kept nowhere: not on the receipt, not on the brain host.++**Facts and extraction (#6506, #6523, #6503, #6333, PR #6515)**++- **Managed automatic fact extraction skips a forgotten claim instead of refusing the entity (#6506; supersedes #6507, contributed by @BichengWang).** Sync import, `put_page`, `extract_facts` and the sweep skip a candidate whose exact claim was forgotten in that source and visibility and publish the entity's other facts, counting the skips as `withdrawn_skipped` on the entity and completion receipts and the extraction result; before, one forgotten claim refused the whole group with `fact_withdrawn`. `remember` of the forgotten claim and a purge tombstone still refuse. A claim forgotten between preparation and publication refuses that entity's write with `revision_conflict` and a detail naming the withdrawal. An input-keyed extraction recovers from such a refusal, and from a batch an older release refused for a forgotten claim, on its next run: the retained facts are re-admitted as a follow-up batch with no model call (`followWithdrawalRefusals`), at most three times per batch, historical receipts untouched.+- **The claude-cli provider maps Claude Code's output-cap envelope to `finishReason: 'length'` (#6523; supersedes #6525, contributed by @javieraldape).** "API Error: Claude's response exceeded the N output token maximum…" (any cap, any exit code, no `api_error_status`) becomes a length-limited answer with empty text and the usage as reported, so the escalation ladders fire again: `loops_extract` 2048 → 8192 and the facts extractor 1× → 2×. Every other error envelope stays a typed `ClaudeCliProcessError`.+- **`extract_atoms` no longer certifies an item complete when its text was cut at `cycle.extract_atoms.max_input_chars` (#6503; report and first visibility slice by @herman6888).** The head is extracted once and its atoms kept, but no completion stamp is written, no earlier atom is retired, the phase result and `gbrain dream --drain` count the item under `input_truncated` with a stderr line naming the knob, and the item is skipped with no model call until the cap rises or its content changes. Migration v241 adds nullable `partial_input_chars` to the two extract_atoms state tables; a managed brain records `partial` on the item's checkpoint and the completion receipt reads `status: 'partial'`. The cut moves to new `src/core/cycle/extract-atoms-input.ts`. #6503 stays open for the chunk+overlap feature.+- **The #6333 same-page rewording shadow counter also fires on a managed brain.** New `src/core/facts/same-page-shadow.ts` is shared by the backstop and `facts-prepare.ts`; managed extraction counts `would_dedup_same_page` on the entity and completion receipts and the `extract_facts` result and prints the same stderr line; nothing is dropped; the measurement can now accumulate on a managed brain (#6334 stays open).+- **Two managed enumeration regressions for the #6500 contract**, carried as already-green tests in `test/conversation-facts-managed.test.ts` (the production fix landed in #6516): a slug keyset drains a 23-page timestamp tie without crossing source, type or soft-deletion fences, and a 13-page extraction walk survives a mid-run edit of its oldest unvisited page (supersedes #6515, contributed by @javieraldape).+- #6508 (conversation segment tail clip) was already fixed by v0.60.177.0's window bounding; closed with that pointer.++**CLI and platform (#6521, #6512, #6510, #5312 in part)**++- **`gbrain core <sub> --help` and `gbrain loops <sub> --help` answer before any engine access (#6521, reported by @benswinney).** `core` and `loops` are routers in `src/cli/subcommands.ts` and `src/cli/router-help.ts`; `src/commands/core.ts` and `src/commands/loops.ts` export their `SUBCOMMANDS` and `printUsage`, and `gbrain transcripts status --help` answers the help flag instead of opening the brain. A 14-row table in `test/cli-help-without-brain.test.ts` runs each subcommand's `--help` with no brain configured (on master `internal_error: null is not an object`).+- **A compiled binary installed from a hoisted `node_modules` reaches its PGLite diagnostic (#6512, contributed by @tarush1989).** `src/core/pglite-embedded-assets.ts` imports `@electric-sql/pglite` lazily inside `build()`, so loading the module no longer needs the package and the tier-3 "PGLite assets missing" message is the one the user sees.+- **The Git-scope manifest refuses symlinks, not a filesystem's spelling of a tracked path (#6510; supersedes #6520, contributed by @javieraldape).** `trackedBytes` in `src/core/persistence/worktree-manifest.ts` `lstat`s every directory component and the leaf of each tracked path through Git's own spelling, so a path whose on-disk spelling differs (NFD on macOS, a case-folding volume) reads as the tracked file it is while a symlinked component or leaf is still refused.+- **Backup data-dir sweep on Windows: an owned socket the runtime cannot inspect is probed and claimed, removed only through the native tag check, otherwise kept and named (#5312, part A; native re-test by @xiaopeng6390).** `entryStat` in `src/core/backup/runtime-artefacts.ts` returns `Stats | 'missing' | 'unreadable'`; an unreadable owned entry is removed only via `removeStaleWindowsSocket`, anything nothing can verify is kept as `unreadable` and the refusal says `cannot inspect`. The `windows-latest` row of `test.yml` runs the test natively. The `private_backup_path_unavailable` text names the inherited-permissions cause and the fix (`docs/guides/in-agent-setup.md`).++**Search operations (#6495 in part, #6040)**++- **Postgres keyword search has an operator time bound, `search.keyword_statement_timeout_ms` (Refs #6495).** The keyword, keyword-count, keyword-page, title and CJK search statements used to run under a fixed 8 s `statement_timeout`; they now share one knob (integer milliseconds, default 8000, range 1000–60000; `gbrain config set search.keyword_statement_timeout_ms 20000`, then restart the serving process). It is resolved once per connection by the first keyword statement and never from a request, so a remote caller cannot widen it; `config set` refuses a value outside the range and writes nothing, and a stored value outside it reads as the default. `gbrain doctor` gains `keyword_plan`, a read-only canary that takes the brain's commonest keyword term from the planner's statistics, EXPLAINs the strict count statement and times the engine's own bounded count, warning when it times out or spends more than half the bound; it names the knob, says one canary term is not workload coverage, and never reports a timed-out count as "no matches". A longer bound buys time, not a cheaper statement: the bounded candidate set for broad terms stays open on #6495. PGLite is unchanged. Guide: `docs/guides/troubleshooting.md#keyword-search-times-out-on-a-large-postgres-brain`.+- **`query` and `search` route "all the people/companies/projects that do X" to `query` again (Refs #6040).** The search description rewrite that taught agents keyword OR lists also told Haiku 4.5 that `search` lists every matching page, and the nightly LLM routing eval has been red since (18/20; 28 of 80 concept phrasings misrouted at temperature 1 against 3 of 80 before). Both descriptions now say that people/companies/projects by topic are `query` work, the exact wording that measured 1/80; the batching sentence stays, so `search`'s per-tool budget grows 1800 → 1830. The description-edit checklist in KEY_FILES names the live test (`GBRAIN_TEST_KEEP_PROVIDER_KEYS=1 bun test test/e2e/salience-llm-routing.test.ts`), 20/20 on this head.+- **The served starter tool list keeps 200 characters of headroom under its 25,000-character ceiling** (it sat at 24,998). Redundant words in tool text no other wave owns are gone (`Optional;` on the shared `request_id` parameter, examples and clauses that repeated the description on `capture.type`, `edit_page.expected_revision`, `get_recent_salience.slugPrefix`, `resolve_slugs.partial`, `mute_notice`, the write-receipt tools, `request_tools`, `list_pages`, `traverse_graph.link_type`, `get_skill`). Every pinned phrase is kept and every description stays at or above 60 characters; `test/mcp-schema-budget.test.ts` asserts the floor through the served list with `publish_skills` on and off (measured 24,796). The entity card, the `MEMORY VERB (v1)` labels and the rest of the query/search text belong to other waves and are untouched.++**CI, flakes, tooling (#6514, #6040 item 4, #6534)**++- **The unconfigured-gateway fixtures stop reaching the provider; lint R7 guards the restore (#6514, contributed by @tarush1989).** `test/think-gateway-adapter.test.ts` uses `__unconfigureGatewayForTests()` and asserts `AIConfigError` at the adapter fork and the backstop, restoring in `afterEach`. `scripts/check-test-isolation.sh` rule R7: `__unconfigureGatewayForTests(`/`_clearGatewayForTests(` without `resetGateway(` in an `afterEach`/`afterAll` hook fails the lint; `test/chronicle-upgrade-notice-5876.test.ts` was the one offender and gets its hook. No allowlist row added.+- **Secret scanner: one-pass `correctedEntropy`, `ScanWork` counters, allowlist in its own module.** `src/core/secret-scan.ts` computes the entropy histogram in one pass (about 80 → 25 ms per 250 × 4096-char segment on a 4-core box; `test/secret-scan-entropy-equivalence.test.ts` pins `Object.is` equality with the former function over 561 samples), counts candidates, gated characters, pattern execs and claims through an optional `ScanWork` (`src/core/secret-scan-work.ts`, pinned at the measured counts, two mutants fail), and the workspace allowlist moves to `src/core/secret-scan-allowlist.ts`. The 300 ms perf bound is unchanged.+- **Three deterministic test suites.** `test/migrate-retry.test.ts` runs its poll cases on a fake clock through the `_hooks.now/sleep` seam (exact pins: 30 iterations / 31 calls, `race_resolved` at t=15; the `> 5` assertion stays) (#6534). `test/helpers/managed-atoms-contract.ts` waits for the deferred batch to settle before asserting (forced probe with a 1 ms maintenance wait: 3/3 fail before, 6/6 pass after, both engines). `test/helpers/managed-facts-embedding-contract.ts` restores the 250 ms publish-wait override right after the `write_pending` assertion so replays wait under the product's deadline (forced 600 ms claim stall: `write_pending` before, `committed` after, both engines).+- **5530 Git-coalescing files.** Setup seeds go through `put_pages`; the `#6210` durability-probe cases move to `test/persistence-git-durability-probe-6210.slow.test.ts` with its Postgres wrapper; both share `test/helpers/git-coalescing-fixture.ts`. A new case asserts the batch seed leaves the same Git effect rows, page hashes, queued count and commit count as the per-page seed. Postgres file 74 → 45 s; PGLite 116 → 90 s. `BACKLOG = 600 × 1 s` unchanged.+- **Tier 2 OpenClaw install waits out a registry race.** `scripts/ci-install-openclaw.sh` (from the inline loop in `e2e.yml`): an attempt failing with npm `code ETARGET`/`E404` (a dependency version published but not yet visible everywhere, the 2026-10-12 master red) is retried up to 4 times 20/40/80 s apart; any other failure keeps 3 attempts 10 s apart. `test/scripts/ci-install-openclaw.test.ts` installs a one-file package from a loopback registry that answers ETARGET or E404 three times, forever, or with `EBADPLATFORM`.+- Docs: `docs/TESTING.md` (R7 row; back under its byte cap), new `docs/architecture/key-files/{secret-scan,core-persistence-request-indexes,core-persistence-facts,managed-sync-bookkeeping}.md`, `KEY_FILES.md` rows trimmed under the 10,000-byte cap, `docs/guides/{write-refusals,error-codes,repair,sync-unblock-runbook,memory-boundaries,troubleshooting,in-agent-setup}.md`, `docs/operations/spend-controls.md`; `llms-full.txt`, `scripts/structural-suites.tsv`, manifests and goldens regenerated.++### Things to watch++- `readRequestIndexStates(engine)` lists three indexes by default (`PERSISTENCE_REQUEST_ONLINE_INDEXES`); callers that need the checkpoint pair alone pass `PERSISTENCE_SYNC_RUN_INDEXES`. Doctor `persistence_request_indexes.details.indexes` gains the third row. A committed page purge's receipt gains `journal_sweep`.+- A soft delete can now commit with `write_through.skipped: 'shared_origin'` and a `write_through.warning`. Discovery's identity snapshot and the origin-check statement now select `deleted_at`; tests that match either statement by text were updated.+- New error codes `purge_lookup_timeout`, `cursor_incarnation_retired`, `sync_cursor_replaced` (`gbrain errors <code>`); new `gbrain repair managed-sync-orphans` reasons `incarnation_retired` / `mirror_only` and a `source_incarnation` field on each listed orphan. A `revision_conflict` checkpoint receipt is now only a same-run index lag.+- `ManagedSyncFailure` / `sync status --json last_error` gain `write_error_detail`; `last_error.detail` can now be a publication `reason`. Stored receipt messages for untyped trigger refusals read `Publication failed (P0001 in <raiser>: <reason>). Inspect owner diagnostics.`+- `gbrain doctor --fast` can score higher than before on a brain with stale mirrored managed rows: that is less certainty, not recovery; the engine-backed check stays authoritative.+- Managed facts: under the automatic-extraction flag, locked validation runs the per-entry purge and withdrawal checks before the page's fence re-validation; a purge written between preparation and publication refuses `purged_content`, a withdrawal in that window refuses `revision_conflict` with `error.withdrawn` set. Receipts and the `extract_facts` result gain `withdrawn_skipped` and `would_dedup_same_page`.+- The `extract_atoms` phase result and the drain result carry a new `input_truncated` count; a managed completion receipt for a cut item has `outcome.status: 'partial'` (+ `partial_input_chars`); discovery and the doctor backlog count exclude partial items until the cap rises.+- `search.keyword_statement_timeout_ms` takes effect on the next connection: the next CLI command picks it up, a running `gbrain serve`, autopilot or job worker needs a restart. `gbrain doctor --only keyword_plan --json` shows `details.timeout_ms`.+- `search`'s per-tool description budget is 1830 (was 1800), with the reason in `TOOL_BUDGETS`.+- Weights: `test/persistence-git-durability-probe-6210.slow.test.ts` (≈35 s PGLite) and `test/e2e/persistence-git-durability-probe-6210-postgres.test.ts` (≈18 s) are new and unweighted; the 5530 rows measured 90 s / 45 s. Weights files are not edited in this release.++### Migrations++- v240 `persistence_request_slug_intent_index`: online partial index on `persistence_requests(source_id, slug, sequence)`, `transaction: false`, CONCURRENTLY on Postgres, inline on PGLite. DDL only.+- v241 `extract_atoms_partial_input`: `ADD COLUMN IF NOT EXISTS partial_input_chars INTEGER` on `extract_atoms_page_state` and `extract_atoms_transcript_state`. Metadata-only, no backfill.+ ## [0.60.187.0] - 2026-10-12++ ### Itemized changes++ - **`query` expands only when the search mode says so (GBRA-81 item 1b).** The `query` operation used to send `expand: true` on every call, so every mode, `balanced` included, made one expansion LLM call before retrieval. It now leaves `expand` unset unless the caller passes it, so the resolved mode decides: on in `tokenmax`, off in `balanced` and `conservative`. `expand: true` (CLI `--expand`) forces it and `expand: false` (`--no-expand`) skips it; `gbrain config set search.expansion true` restores it by default for a brain, and a `search.expansion` value set earlier, which `query` ignored, now takes effect. The expander stays wired whenever expansion can resolve on, so `tokenmax` still expands. CRAG's caller-expanded check reads `expansion_applied`; eval capture records the raw `expand` param (null when unset) and `gbrain eval replay` maps null to the mode default. The tool description, the concept-search hint, `gbrain search modes`, `search tune`, top-level help, the picker copy and the docs say the same, and a guard test rejects "in every mode" / "always expands" phrasing in `src/` and `docs/`. `test/search/operation-expansion-contract.serial.test.ts` is rewritten to pin the new contract.+ - **`gbrain init` reads keys the way the gateway does.** Provider keys are read through `mergedProviderEnv`, so a key saved in `~/.gbrain/config.json` counts, and a brain with a ready reranker but no chat key gets `balanced` instead of `conservative` (the reranker branch uses `rerankerReadiness`, not a key name); `conservative` stays for a Haiku subagent or when neither a chat key nor a ready reranker exists.+ - **`gbrain init --search-mode <mode>` and `search.mode_source`.** An agent that knows the operator's choice records it at install time: no recommendation, no first-run `search_mode` ask, `search.mode_source: operator`. On a brain with a different mode it refuses unless `--force`. Picker choices record `auto`; `gbrain config set search.mode` records `operator`.+ - **One source for the mode advice.** `src/core/search/mode-advice.ts` holds the recommendation, its reasons and evidence, the `[AGENT]` and upgrade banners, init's first-run decision text and the cost matrix, now priced for Haiku 5.5, Sonnet 5.5 and Opus 5.5 from `src/core/model-pricing.ts` (about a 200x corner-to-corner spread). `INSTALL_FOR_AGENTS.md` Step 3.5 carries the generated matrix, kept in sync by a test. Switching modes no longer promises a cache refill while semantic result caching is off.+ - **`gbrain eval longmemeval --via-operation query|search`.** Runs each question through the real operation with an agent's stdio MCP context (remote, stdio, source `default`) at the operation's default limit, with `--op-expand on|off` for `query`. Rows record the context, the `expand` sent, model calls per touchpoint, latency, the CRAG grade and the expansion outcome; `run_config.via_operation_summary` has the gbrain tree, commit and dirty flag of the checkout the harness runs from (not the caller's cwd), p50/p95 latency and model calls per query, and a row's `search_meta.reranked` comes from the operation's recorded rerank call. A run that expects expansion fails when any question did not expand.+ - **Lean search rows drop `id` where `fetch` is not callable.** Remote `search` and `query` lean rows carry `id` (the deep-research `fetch` key, base64 of `source_id` and `slug`, so a duplicate of two fields already in the row) only when `fetch` is callable on the caller's surface at call time. MCP dispatch threads one `isCallable(op)` predicate into `OperationContext`, built from the same check tools/list uses: the stdio session's surface after any `request_tools` widening, the HTTP client's effective surface and scopes under the server ceiling. `fields: "full"`, `mcp.result_rows: full`, gbrain's thin client and the local CLI are unchanged. On the committed Cat 40 Hard transcripts (served on `starter`, 3,169 `search` calls) a keyless replay (`scripts/replay-lean-row-savings.ts`) saves 9.52% of `search` characters on the starter surface and 1.35% on the full surface, where `id` stays and only score rounding applies.+ - **Lean-row `score` prints 4 significant digits.** Rounding happens only in `leanRow`, so full rows and trusted local callers keep the raw float; RRF-scale scores are small, so fixed decimals would have collapsed them. Two scores print equal only when they agree to 4 significant digits, and order never inverts.+ - **`fetch` without an id names both routes.** The refusal says to re-run `search` once `fetch` is callable, or to pass the row's slug (accepted when unambiguous in the caller's read scope).+ - **`degraded_recall` shows on every affected call on stdio and the CLI.** Transient degradations (`rerank_failed`, `embed_timeout`, a failed keyword or title arm, every other per-call stage) are no longer deduped per session, so a failure after a different earlier failure, or the same failure after a recovery, always carries its notice. A notice made only of configuration-persistent stages (a keyless brain's `embed_unavailable`, about 600 characters on every search otherwise) carries an unrendered `dedupe_key` of its sorted unique stage/reason pairs, which the notice ledger dedupes on per session and the wire never shows. HTTP stays per call. `docs/protocol/AGENT_OPERATOR_v1.md` now states one rule for stdio, CLI and HTTP.+ - **`entity names[]` is 5 to 17 times faster on a large brain, with byte-identical output.** On a 55,838-page PGLite brain built from the Cat 40 Hard world M generator (seed 20261021, no embeddings), a 20-name batch's median went from 2,250 ms to 129 ms with every name found, from 1,743 ms to 155 ms with half found, and from 1,112 ms to 203 ms with none found. Profiling showed the name lookup itself dominated, not the cards: each found name ran two sequential scans of the source's pages, the alias resolver's "no other live page has this exact title" check and the card's exact-title / exact-slug / slug-suffix arm, about 50 ms each. Migration v240 adds `idx_pages_source_title_lower` (`source_id, lower(title)`) and a trigram index on `slug` (`idx_pages_slug_trgm`), built online on Postgres; the queries are unchanged and now run as index scans in about 1 ms. Single-name `entity`, context_pack cards and search's alias fan-out use the same two reads. The batch also stops assembling a full card per name it then threw away: candidate selection is now one exported function, `selectEntityCandidates`, that `buildEntityCard` and `lookupEntityNames` both call; the lead reuses the candidate row's body; siblings are read without the identity excerpt (`readSiblingIdentity`); and the private-page setting, mention policy and source pack are read once per batch (`entityLookupScope`). Parity tests compare the batch with the old full-card resolver over adversarial names (colliding aliases and titles, namespaced slugs, the same slug in two sources, private, deleted and quarantined candidates, identity siblings, stale aliases, LIKE wildcards) on PGLite and Postgres, and plan tests pin both reads to the new indexes.+ - **A Postgres statement timeout in the keyword or title arm is reported as a timeout (#6495).** `isTimeoutError` (`src/core/search/hybrid/degraded.ts`) now recognizes SQLSTATE 57014 through `isStatementTimeoutError`, so the arms' 8 s `SET LOCAL statement_timeout` on a large brain stamps `keyword_arm_failed` / `title_arm_failed` with reason `timeout` instead of `provider_error`. Probe in `test/hybrid-arm-rethrow.test.ts` (fails before).+ - **Flake fix: `test/pglite-repair-command.serial.test.ts` case 1 no longer writes a fixed PID 99999 as its stale `postmaster.pid`.** On a busy host that PID can belong to a live process, so validation correctly refused ("postmaster.pid names a LIVE process") and the dry-run assertion failed (seen on a Ubicloud gate). The case now uses the file's `deadPid()` helper; a forced probe writing a live PID reproduces the failure.++ ## [0.60.186.0] - 2026-10-12++ **An agent is told when a result leaves out something it could get, and how to get it with what its connection can actually call (D2), and an authenticated connection whose grant blocks operations it could use is told why and what the host can run, without naming any operation (D4).** Before, `get_page`, `search` and `query` dropped takes on surfaces that hide `takes_list` and said nothing, so models either refused or guessed; a "call `takes_list`" hint on a `starter` registration would have led to `unknown_tool`. On a Cat 40 smoke, gpt-6.1-sol answered 10 of 10 hidden-takes tasks on this branch against 1 of 10 on master (Opus 5.5 and Sonnet 5.5 10 of 10, at the ceiling), with 0 leaks, 0 unsafe writes and 0 `unknown_tool` answers after a notice. Nothing a connection can call changes, and no tool schema changes.++ ### Itemized changes++ - **`hidden_tool_content` notice (D2):** `get_page`, `search` and `query` results that omit takes carry it. Its next step comes from the one shared F6 decision (`hiddenToolRoute` in `src/mcp/hidden-tool-hint.ts`) on every transport: call `takes_list` when it is callable, widen once with `request_tools {surface}` when the ceiling allows it, otherwise the host route. It never names a tool the connection's ceiling refuses; read-only access, operator pins and the force-surface clamp hold.+ - **`grant_blocked_operations` notice (D4):** delivered once per (principal, session), or once per grant revision for stateless HTTP calls, through the notice ledger. It counts currently eligible operations the grant excludes within its scope and names none, separates proven blockers (scope, operation snapshot, client pin, server ceiling) from grant age ("original intent unknown" for grants without catalog provenance), and gives a preview-then-apply host command. A missing scope is named only on a refused call; when only the server ceiling blocks, the fix is the read-only doctor check.+ - **Errors and docs:** both codes in `src/core/error-registry.ts` and `error-catalogue.ts` with read-only verify steps; `docs/guides/repair.md`, `docs/mcp/ADMIN.md`, `docs/guides/hosted-harness-access.md` and `skills/mcp-access/SKILL.md` updated; one BEHAVIOR_CHANGES row.+ - **Tests:** the D2 installed-configuration matrix in `test/hidden-tool-hint.test.ts` (callable `starter`, `full`, `verbs`, read-only stdio, pinned HTTP, a client that ignores `tools/list_changed`; every emitted next step is callable on its connection), every D4 hermetic case in the new `test/grant-blocked-notice.test.ts`, and the N6 visibility fuzz with 0 content leaks, 0 existence leaks and 0 oracles across `get_page`, `search`, `query`, `takes_list` and `whoami`. Smoke receipt: gbrain-evals v0.10.79, `docs/benchmarks/2026-10-12-d2d4-smoke/`.## [0.60.185.0] - 2026-10-12diff --cc scripts/module-size-limits.tsvindex 5e3344d0f4,6e0c7a34e2..24e0fc218e--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@@ -21,11 -21,11 +21,11 @@@ src/core/import-file.ts 2027 ratchet +2src/core/migrate.ts 602 ratchet schema-migration runner only; migrations live in src/core/schema-migrations/ (W3); +3 #5216: resumable page revision backfill runs after every migration pass while pages.knowledge_revision is nullablesrc/core/operations.ts 240 ratchet peel target: containment sprint C4-C7; grown v0.46.26.0 megawave op wiring; +chat-connectors wiring (master merge); +5 v0.47 gmail-loops: loopsOperations spread + OP_AREAS; #5105: receipt operation registry wiring; shared-skills integration on company-ingestion base; +2 security wave: withOutputRedaction applied at op registration; +1 #5616: pageEditOperations import (spread shares the pages line); +1 Foundations 1 F1b: attributionOperations import (spread shares the admin line); +1 agent operator wave A6: ops/notices.ts import (mute_notice); +2 agent operator closeout A1: registerOpRoutes import + call (routing logic in fix-routing.ts); +2 retrieval feedback: feedbackOperations import and spread (ops/feedback.ts); +1 #6007: pageBatchOperations import (spread shares the pages line); +1 P5: wanted_pages area row; lowered GBRA-75 W11 cold start: OP_AREAS + finalize step moved to operation-load.ts (shared with the CLI per-op loader); +1 C4 pinned questions: questionsOperations import and spread (ops/questions.ts; its areas live in operation-load.ts OP_AREAS)src/core/pglite-engine.ts 3026 ratchet +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +52 engine graduation (GBRA-50 G2a): marker/tombstone checks before and after the kernel lock (logic in persistence/graduation-custody.ts), lock-retaining close and held-lock open (engine lifecycle methods cannot move); 4 Foundations 2 Lane F: autocommit write statements take the WAL checkpoint guard (classifier writesWal in pglite-engine/checkpoint-guard.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +52 engine graduation (GBRA-50 G2a): marker/tombstone checks before and after the kernel lock (logic in persistence/graduation-custody.ts), lock-retaining close and held-lock open (engine lifecycle methods cannot move); 4 Foundations 2 Lane F: autocommit write statements take the WAL checkpoint guard (classifier writesWal in pglite-engine/checkpoint-guard.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +52 engine graduation (GBRA-50 G2a): marker/tombstone checks before and after the kernel lock (logic in persistence/graduation-custody.ts), lock-retaining close and held-lock open (engine lifecycle methods cannot move); +1 #5984: upsertChunks guards pass the per-transaction config memo (transactionMemo in page-state/transactions.ts); v0.60.58.0 merge: #5984 diet growth re-summed over v0.60.57.0 (2983 measured); 4 Foundations 2 Lane F: autocommit write statements take the WAL checkpoint guard (classifier writesWal in pglite-engine/checkpoint-guard.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +52 engine graduation (GBRA-50 G2a): marker/tombstone checks before and after the kernel lock (logic in persistence/graduation-custody.ts), lock-retaining close and held-lock open (engine lifecycle methods cannot move); +1 #5984: upsertChunks guards pass the per-transaction config memo (transactionMemo in page-state/transactions.ts); v0.60.58.0 merge: #5984 diet growth re-summed over v0.60.57.0 (2983 measured); +4 P7 relationalChainHop delegate; +8 contributor audit wave P0: listFactsKeyset delegate (SQL in engine-sql/facts.ts); +1 #5375: get_versions limit/include_body type import (GetVersionsOpts, PageVersionRows); +2 #5984 lane apply diet: putPage/setPageAliases write inline in the caller's page transaction (engine methods cannot move); +4 GBRA-69: replaceDerivedLinksBatch delegate (logic in derived-links.ts); +5 GBRA-67: readPageSnapshotsBatch delegate (batch logic in page-snapshot-batch.ts); +1 GBRA-75 wave 10: findDuplicatePages delegate (SQL in engine-sql/pages.ts); +2 GBRA-76: transaction/transactionDirect take TransactionOptions and refuse an already-aborted signal before BEGIN; +2 #4772 (W14 PR3): entityTypes HealthDeps delegate + import (policy in schema-pack/entity-types.ts, SQL in engine-sql/health.ts); +2 W14 P3.12 (#4772): entityTypes HealthDeps delegate + import on top of W13; +11 Cat 40 Hard fix wave F2 (#6271) on top: countKeywordPages/searchKeywordPages delegations (SQL in engine-sql/keyword-pages.ts) and the rankQuery score parameter (3023 measured); +3 W15 P1.2 (#6454): three one-line stale-frontmatter-key delegates (SQL in engine-sql/pages.ts)-src/core/postgres-engine.ts 3030 ratchet +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); ceiling rationale: docs/architecture/key-files/engines-2.md entry for src/core/postgres-engine.ts; evidence delivery: getChunkWindows scoped-read delegate + type import (+5; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +10 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3242 #5824: searchVector SQL moved to search/vector-statement.ts, +explainVectorSearch/runVectorAttempt (-156); +6 #5730: onpoisoned wiring on the instance/module/connection-manager pools + poisonedDiscards in getPoolDiagnostics (counter in pool-gauge.ts); +5 #5801: onCheckout observer seam (fires after reserve resolution / transaction-callback entry; listeners in pool-gauge.ts); lowered to 3119 #5889: searchTitles SQL moved to engine-sql/titles.ts (-133); lowered to 2914 F4a: getHealth SQL moved to engine-sql/health.ts (-216); +2 #5984: transactions track held page guards like PGLite (withHeldPageKeys), so repeated guards in one transaction cost no round trips; +1 #5984: traceSqlOptions import for the env-gated GBRAIN_SQL_TRACE bench hook (src/core/sql-trace.ts); v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (2917 measured); +2 engine graduation (GBRA-50 G2a): initSchema sizing parameter (the source embedding layout sizes a fresh target); +1 #5984: upsertChunks guards pass the per-transaction config memo (transactionMemo in page-state/transactions.ts); v0.60.58.0 merge: #5984 diet growth re-summed over v0.60.57.0 (2920 measured); +4 P7 relationalChainHop delegate; +8 contributor audit wave P0: listFactsKeyset delegate (SQL in engine-sql/facts.ts); +1 #5375: get_versions limit/include_body type import (GetVersionsOpts, PageVersionRows); 6 #6085: initSchema pins advisory lock 42, bootstrap, schema replay and unlock to one reserved backend when the DDL pool has more than one slot (gauge only, no long-hold permit), released in finally; wave 10 collector: lane E (#6085), lane G (#5375) and master compose at 2939; +2 #6110: search transactions pass jitOff to withScopedReadTransaction (SET LOCAL jit = off in postgres-engine/search-settings.ts); +2 #5984 lane apply diet: putPage/setPageAliases write inline in the caller's page transaction (engine methods cannot move); +1 #5984 single-write fast path composes with the lane apply diet at 2944; +2 #5984 shared parameter types: the instance pool passes shared_types and initSchema clears them after migrations (helpers in db.ts); +2 #6276: the remote alias-resolving readPageSnapshot runs with JIT off (withScopedReadTransaction jitOff); +5 #6278: executeRaw timeoutMs delegate (statement in postgres-engine/bounded-statement.ts); +23 #6278 PR 1.5: cancelSettleMs() and the settle timer in runUnsafe that discards a reserved connection whose cancel a transaction-mode pooler never completed; +3 #6317 lane 2: getPoolDiagnostics().pool from the vendored driver (postgres-engine/pool-stats.ts) and the prepare mark; +4 GBRA-69: replaceDerivedLinksBatch delegate (logic in derived-links.ts); +1 GBRA-69 extract batching: replaceDerivedLinksBatch delegate (batch logic in derived-links.ts); +9 GBRA-75: getBacklinkCounts and getHealth statements run JIT-off through the private jitOffRead transaction helper (engine methods cannot move); +3 GBRA-75 wave 7: searchKeyword and searchVector start the once-per-engine background search statistics guard (logic in search/projection-statistics.ts); +7 GBRA-67: readPageSnapshotsBatch scoped-read delegate (batch logic in page-snapshot-batch.ts); +1 GBRA-75 wave 10: findDuplicatePages scoped-read delegate (SQL in engine-sql/pages.ts); +7 #6383: poolIncidents hooks on the instance/module/connection-manager pools (counter and lines in pool-gauge.ts, budget in db.ts) and stuckDiscards/buildFailures in getPoolDiagnostics; +3 GBRA-76: transaction/transactionDirect take TransactionOptions; transactionOn attaches the begin handle to withTransactionAbort (logic in postgres-engine/transaction-abort.ts); +2 W14 P3.12 (#4772): entityTypes HealthDeps delegate + import on top of W13; +1 #5227: schema.sql replay under withSchemaLockTimeout (wave 14 PR1); +1 driver desync tripwire: desyncDiscards in getPoolDiagnostics (counter and line in pool-gauge.ts); +11 Cat 40 Hard fix wave F2 (#6271) on top: countKeywordPages/searchKeywordPages scoped-read delegations (SQL in engine-sql/keyword-pages.ts) and the rankQuery score parameter (3027 measured); +3 W15 P1.2 (#6454): three one-line stale-frontmatter-key delegates, reads scoped (SQL in engine-sql/pages.ts)+src/core/postgres-engine.ts 3042 ratchet +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); ceiling rationale: docs/architecture/key-files/engines-2.md entry for src/core/postgres-engine.ts; evidence delivery: getChunkWindows scoped-read delegate + type import (+5; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +10 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3242 #5824: searchVector SQL moved to search/vector-statement.ts, +explainVectorSearch/runVectorAttempt (-156); +6 #5730: onpoisoned wiring on the instance/module/connection-manager pools + poisonedDiscards in getPoolDiagnostics (counter in pool-gauge.ts); +5 #5801: onCheckout observer seam (fires after reserve resolution / transaction-callback entry; listeners in pool-gauge.ts); lowered to 3119 #5889: searchTitles SQL moved to engine-sql/titles.ts (-133); lowered to 2914 F4a: getHealth SQL moved to engine-sql/health.ts (-216); +2 #5984: transactions track held page guards like PGLite (withHeldPageKeys), so repeated guards in one transaction cost no round trips; +1 #5984: traceSqlOptions import for the env-gated GBRAIN_SQL_TRACE bench hook (src/core/sql-trace.ts); v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (2917 measured); +2 engine graduation (GBRA-50 G2a): initSchema sizing parameter (the source embedding layout sizes a fresh target); +1 #5984: upsertChunks guards pass the per-transaction config memo (transactionMemo in page-state/transactions.ts); v0.60.58.0 merge: #5984 diet growth re-summed over v0.60.57.0 (2920 measured); +4 P7 relationalChainHop delegate; +8 contributor audit wave P0: listFactsKeyset delegate (SQL in engine-sql/facts.ts); +1 #5375: get_versions limit/include_body type import (GetVersionsOpts, PageVersionRows); 6 #6085: initSchema pins advisory lock 42, bootstrap, schema replay and unlock to one reserved backend when the DDL pool has more than one slot (gauge only, no long-hold permit), released in finally; wave 10 collector: lane E (#6085), lane G (#5375) and master compose at 2939; +2 #6110: search transactions pass jitOff to withScopedReadTransaction (SET LOCAL jit = off in postgres-engine/search-settings.ts); +2 #5984 lane apply diet: putPage/setPageAliases write inline in the caller's page transaction (engine methods cannot move); +1 #5984 single-write fast path composes with the lane apply diet at 2944; +2 #5984 shared parameter types: the instance pool passes shared_types and initSchema clears them after migrations (helpers in db.ts); +2 #6276: the remote alias-resolving readPageSnapshot runs with JIT off (withScopedReadTransaction jitOff); +5 #6278: executeRaw timeoutMs delegate (statement in postgres-engine/bounded-statement.ts); +23 #6278 PR 1.5: cancelSettleMs() and the settle timer in runUnsafe that discards a reserved connection whose cancel a transaction-mode pooler never completed; +3 #6317 lane 2: getPoolDiagnostics().pool from the vendored driver (postgres-engine/pool-stats.ts) and the prepare mark; +4 GBRA-69: replaceDerivedLinksBatch delegate (logic in derived-links.ts); +1 GBRA-69 extract batching: replaceDerivedLinksBatch delegate (batch logic in derived-links.ts); +9 GBRA-75: getBacklinkCounts and getHealth statements run JIT-off through the private jitOffRead transaction helper (engine methods cannot move); +3 GBRA-75 wave 7: searchKeyword and searchVector start the once-per-engine background search statistics guard (logic in search/projection-statistics.ts); +7 GBRA-67: readPageSnapshotsBatch scoped-read delegate (batch logic in page-snapshot-batch.ts); +1 GBRA-75 wave 10: findDuplicatePages scoped-read delegate (SQL in engine-sql/pages.ts); +7 #6383: poolIncidents hooks on the instance/module/connection-manager pools (counter and lines in pool-gauge.ts, budget in db.ts) and stuckDiscards/buildFailures in getPoolDiagnostics; +3 GBRA-76: transaction/transactionDirect take TransactionOptions; transactionOn attaches the begin handle to withTransactionAbort (logic in postgres-engine/transaction-abort.ts); +2 W14 P3.12 (#4772): entityTypes HealthDeps delegate + import on top of W13; +1 #5227: schema.sql replay under withSchemaLockTimeout (wave 14 PR1); +1 driver desync tripwire: desyncDiscards in getPoolDiagnostics (counter and line in pool-gauge.ts); +11 Cat 40 Hard fix wave F2 (#6271) on top: countKeywordPages/searchKeywordPages scoped-read delegations (SQL in engine-sql/keyword-pages.ts) and the rankQuery score parameter (3027 measured); +3 W15 P1.2 (#6454): three one-line stale-frontmatter-key delegates, reads scoped (SQL in engine-sql/pages.ts); +12 wave 16 G5.1 (#6495): keywordStatementTimeout memo field, its connect/disconnect resets and the keywordStatementTimeoutSetting accessor, plus one awaited setting per keyword/chunk/CJK transaction (resolver in postgres-engine/keyword-statement-timeout.ts); wave 16 G5.1 gate fix: keywordStatementTimeoutSetting resolves the knob once per connection on the first keyword statement from the saved connect config (connect issues no statement for it; 3042 measured)src/core/search/hybrid.ts 1632 ratchet +2 System One v1: HybridSearchOpts.decide (search/decide-stage.ts); refactor wave 1 split target (W4 hybrid, cut line); ceiling rationale: docs/architecture/key-files/core-search-1.md entry for src/core/search/hybrid.ts; +10 #5691: per-request embedding_query_prefix read once and threaded to the embeds and cache key; +5 green master wave (embedding opt-out): HybridSearchOpts._embeddingOptedOut (interface field) read once per request and threaded to the cache-lookup embed and the keyword-only gate; +24 P2 explain RRF attribution stamp in rrfFusionWeighted, backlink_count stamp, explain_target stage observations, explain/explainTarget opts; +14 fix wave 13 P4.8 #6400: lazyQueryEmbedDeadline (the query-embed deadline starts when the embed starts) and the _queryEmbedDeadline getter; +1 query facts arm: HybridSearchOpts.onQueryEmbedding (interface field; its one-line call is paid inside the ceiling) after the vector arms, so the facts arm reuses the query embedding without a second model call; re-summed at the master a08578ca5 merge (1591 master lines + 3 integration lines: the onQueryEmbedding hook)-src/core/types.ts 2292 ratchet +7 fix wave 11 W6.2/W6.3 (#5989, #6132): SearchOpts.hnswIterativeScan and cjkKeyword, the keyword_candidates_incomplete stage and HybridSearchMeta.keyword_candidates (logic in engine-sql/cjk-search.ts); +5 System One v1 retrieval lane: SearchResult injection_p/injection_suspected, HybridSearchMeta answerability, egress_denied degraded reason; +4 System One v1: SearchResult rerank_score_kind/decide_evidence, HybridSearchMeta decide/rerank; +3 wave review: PAGE_SORT_SQL.updated_asc source_id + id tiebreakers (total order under federated scopes); +5 #4881: OntologyReadOpts extends PageReadScope doc; +3 #4857: PAGE_SORT_SQL.slug total-order tiebreaker comment; grown v0.46.26.0 megawave: EvidenceOpts, pacing/usage result fields, PageFilters growth (#4352 #4218); wave-k: +9 SalienceOpts/AnomaliesOpts source scope (#3867); +20 2026-09 adversarial batch 2: keyword_relaxed_carried stage + relaxed_dropped meta field docs; +16 2026-09 fix wave: SearchResult.keyword_relaxed field + full fusion-demotion doc; (#3867); +9: #4648 rerank_passthrough degraded stage + empty_result_set/malformed_shape reasons | merged v0.48.1.0 true-up; +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); corrective release: shared internal PageReadScope and PageReadPolicy; ranker wave v0.48.4.0: HybridSearchMeta relational_rerank_pin / keyword_arm_confidence / metadata_boost_gate + SearchResult.relational_pinned (+48 over master's peel); +12: #4681 Page.updated_at_iso + keyset cursor precision docs; #5105: canonical page state shared module and transaction/snapshot delegates; #5105: public page revision fields; upstream integration: preserve independently reviewed master additions with branch facade extraction; #5252 wave: typed vector pool and readiness metadata; merged company ingestion/schema routing changes; retired provider integration removed; +1 write-path wave: 'created' effective-date source; +3 read-path wave: rerank_failed degraded stage + budget reason (closed vocabularies) and its recall classification note; +8 fw3-search: SearchOpts.source_boosts + keyword_arm_failed/title_arm_failed stages; +2 wave-2 W4: ChunkInput.embedding_input_hash (#5553); fix wave 3 x fix wave 2 (v0.60.5.0) composition: +2 at the merge; evidence delivery: optional SearchResult.delivered (+2; shape in search/evidence-delivery.ts); +2 eval wave N1-3: OntologyReadOpts.visibility (remote world-only ontology reads); +4 #5827: GraphNode.source_id and GraphPath from_source_id/to_source_id; +2 #5824: SearchOpts.vectorLegacyGuard rollback switch; +7 #5154: PageFilters.listColumnsOnly (interface field); +11 Foundations 1 F1b: WriteAttributionView + AttributedPageVersion (get_versions / get_write_attribution read shapes); +1 #5988: SearchResult.stale carries the held-file detail (interface field); +6 retrieval feedback: SearchResult feedback_boost/content_hash/relational_path_edges stamps and RelationalFanoutRow.path_edges (interface fields); +2 RelationalFanoutOpts.wide (interface field); 1 GBRA-49: temporal annotation field on link rows; 1 GBRA-49: temporal annotation field on link rows; 1 GBRA-49: temporal annotation field on link rows; +44 P7 ChainHopOpts/ChainHopEdge chain-hop contract types; P7 SearchResult.relational evidence + RelationalEvidence type + relational_plan meta + planner per-call overrides; +2 P7 SearchOpts.relationalChainSlots per-call override; +1 P7 ChainHopOpts.temporal (relationship-validity policy per hop); P3 x P7 (v0.60.60.0) composition: deltas re-summed at the merge; 1 GBRA-49: temporal annotation field on link rows; +44 P7 ChainHopOpts/ChainHopEdge chain-hop contract types; P7 SearchResult.relational evidence + RelationalEvidence type + relational_plan meta + planner per-call overrides; +2 P7 SearchOpts.relationalChainSlots per-call override; +1 P7 ChainHopOpts.temporal (relationship-validity policy per hop); +1 green master wave: embedding_disabled degraded reason (closed vocabulary); +2 #5951: Chunk.source_id (get_chunks names each row's source); 1 P2 SearchResult explain fields (rrf attribution, blend_norm_rrf, score_details, backlink_count) + RrfAttribution (interface fields); +11 #5575 (L1b): PageReadScope minTrust/suppressFlagged, SearchResult trust_tier/origin/unconfirmed, TimelineOpts eligibility (interface fields cannot move); +8 #4772 (W14 PR3): BrainHealth.entity_types_status field (interface fields cannot move); +1 C4: question page type row; +6 entity anchoring: optional SearchResult.entity_anchored row stamp (logic in search/entity-anchor.ts); +4 query facts arm: optional SearchResult.fact_row and superseded_claim row fields (logic in search/facts-arm.ts); +2 query facts arm: SearchResult result_type/fact_id/page_slug/follow_up (fact rows are never page-shaped); +9 Cat 40 Hard fix wave (#6271): SearchResult matched_alias/evidence_omitted/provenance, SearchOpts.rankQuery, keyword_count_unavailable stage and rerank_failed reasons; +12 fix wave 15 P2.1 (#6500): PageFilters.slugAfter (single-source slug keyset, interface field + doc) and the updated_desc tiebreaker comment (the keyset walk lives in facts/conversation-enumeration.ts)+src/core/types.ts 2294 ratchet +7 fix wave 11 W6.2/W6.3 (#5989, #6132): SearchOpts.hnswIterativeScan and cjkKeyword, the keyword_candidates_incomplete stage and HybridSearchMeta.keyword_candidates (logic in engine-sql/cjk-search.ts); +5 System One v1 retrieval lane: SearchResult injection_p/injection_suspected, HybridSearchMeta answerability, egress_denied degraded reason; +4 System One v1: SearchResult rerank_score_kind/decide_evidence, HybridSearchMeta decide/rerank; +3 wave review: PAGE_SORT_SQL.updated_asc source_id + id tiebreakers (total order under federated scopes); +5 #4881: OntologyReadOpts extends PageReadScope doc; +3 #4857: PAGE_SORT_SQL.slug total-order tiebreaker comment; grown v0.46.26.0 megawave: EvidenceOpts, pacing/usage result fields, PageFilters growth (#4352 #4218); wave-k: +9 SalienceOpts/AnomaliesOpts source scope (#3867); +20 2026-09 adversarial batch 2: keyword_relaxed_carried stage + relaxed_dropped meta field docs; +16 2026-09 fix wave: SearchResult.keyword_relaxed field + full fusion-demotion doc; (#3867); +9: #4648 rerank_passthrough degraded stage + empty_result_set/malformed_shape reasons | merged v0.48.1.0 true-up; +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); corrective release: shared internal PageReadScope and PageReadPolicy; ranker wave v0.48.4.0: HybridSearchMeta relational_rerank_pin / keyword_arm_confidence / metadata_boost_gate + SearchResult.relational_pinned (+48 over master's peel); +12: #4681 Page.updated_at_iso + keyset cursor precision docs; #5105: canonical page state shared module and transaction/snapshot delegates; #5105: public page revision fields; upstream integration: preserve independently reviewed master additions with branch facade extraction; #5252 wave: typed vector pool and readiness metadata; merged company ingestion/schema routing changes; retired provider integration removed; +1 write-path wave: 'created' effective-date source; +3 read-path wave: rerank_failed degraded stage + budget reason (closed vocabularies) and its recall classification note; +8 fw3-search: SearchOpts.source_boosts + keyword_arm_failed/title_arm_failed stages; +2 wave-2 W4: ChunkInput.embedding_input_hash (#5553); fix wave 3 x fix wave 2 (v0.60.5.0) composition: +2 at the merge; evidence delivery: optional SearchResult.delivered (+2; shape in search/evidence-delivery.ts); +2 eval wave N1-3: OntologyReadOpts.visibility (remote world-only ontology reads); +4 #5827: GraphNode.source_id and GraphPath from_source_id/to_source_id; +2 #5824: SearchOpts.vectorLegacyGuard rollback switch; +7 #5154: PageFilters.listColumnsOnly (interface field); +11 Foundations 1 F1b: WriteAttributionView + AttributedPageVersion (get_versions / get_write_attribution read shapes); +1 #5988: SearchResult.stale carries the held-file detail (interface field); +6 retrieval feedback: SearchResult feedback_boost/content_hash/relational_path_edges stamps and RelationalFanoutRow.path_edges (interface fields); +2 RelationalFanoutOpts.wide (interface field); 1 GBRA-49: temporal annotation field on link rows; 1 GBRA-49: temporal annotation field on link rows; 1 GBRA-49: temporal annotation field on link rows; +44 P7 ChainHopOpts/ChainHopEdge chain-hop contract types; P7 SearchResult.relational evidence + RelationalEvidence type + relational_plan meta + planner per-call overrides; +2 P7 SearchOpts.relationalChainSlots per-call override; +1 P7 ChainHopOpts.temporal (relationship-validity policy per hop); P3 x P7 (v0.60.60.0) composition: deltas re-summed at the merge; 1 GBRA-49: temporal annotation field on link rows; +44 P7 ChainHopOpts/ChainHopEdge chain-hop contract types; P7 SearchResult.relational evidence + RelationalEvidence type + relational_plan meta + planner per-call overrides; +2 P7 SearchOpts.relationalChainSlots per-call override; +1 P7 ChainHopOpts.temporal (relationship-validity policy per hop); +1 green master wave: embedding_disabled degraded reason (closed vocabulary); +2 #5951: Chunk.source_id (get_chunks names each row's source); 1 P2 SearchResult explain fields (rrf attribution, blend_norm_rrf, score_details, backlink_count) + RrfAttribution (interface fields); +11 #5575 (L1b): PageReadScope minTrust/suppressFlagged, SearchResult trust_tier/origin/unconfirmed, TimelineOpts eligibility (interface fields cannot move); +8 #4772 (W14 PR3): BrainHealth.entity_types_status field (interface fields cannot move); +1 C4: question page type row; +6 entity anchoring: optional SearchResult.entity_anchored row stamp (logic in search/entity-anchor.ts); +4 query facts arm: optional SearchResult.fact_row and superseded_claim row fields (logic in search/facts-arm.ts); +2 query facts arm: SearchResult result_type/fact_id/page_slug/follow_up (fact rows are never page-shaped); +9 Cat 40 Hard fix wave (#6271): SearchResult matched_alias/evidence_omitted/provenance, SearchOpts.rankQuery, keyword_count_unavailable stage and rerank_failed reasons; +12 fix wave 15 P2.1 (#6500): PageFilters.slugAfter (single-source slug keyset, interface field + doc) and the updated_desc tiebreaker comment (the keyset walk lives in facts/conversation-enumeration.ts); +2 wave 16 G5.1 (#6495): EngineConfig.keyword_statement_timeout_ms (interface field + doc)src/core/minions/queue.ts 2528 ratchet grown #4078 + megawave probe-liveness unlatch (#4310) + master private-queue lifecycle: recovery classifier + monotonic lease; security: durable queued authority and confined filesystem dispatch; master integration: grown #4078 + megawave probe-liveness unlatch (#4310) + master private-queue lifecycle: recovery classifier + monotonic lease; harness support: boundary wiring to shared grants, isolated setup, withdrawal and delegated guards; merged v0.49: durable authority and delegated admission both enforced; typed readiness, configuration-blocked lifecycle and bounded release; +9: prune archives completed dream synthesis keys; +18 Lane D: deferJob (a deferral returns a job to delayed with no attempt counted and no stacktrace growth); the ceiling had 17 lines of slack; +5 agent operator follow-up Item 5 merged over master: claim-time spend fence token and legacy_default stamp (logic in minions/spend-authorization.ts)- src/commands/init.ts 1878 ratchet +2 fix wave 9 lane F #5253: leaving deferred setup also clears the DB-plane embedding_disabled row (both init branches); grown v0.46.x keyless capability notices; grown db-availability loop: initPostgresCore typed-failure extraction + --prefer-postgres ladder hook + pgvector rethrow fix; +1 at megawave/wave-k merge; +master-merge true-up; wave-k: merge; #3753 --force re-init engine-preservation guard; +1 wave-k merge-union brace (--prefer-postgres close); +10 ambient-writeback WP8: runWritebackNudge consent ask in both engine epilogues (logic lives in core/onboard/writeback-nudge.ts); +4: v0.48.2 reranker readiness at init + test seam; +1: v0.48.2 provider normalization; +3: v0.48.2 review fixes; master integration: +2: preserve typed PGLite busy errors in schema-only init; shared-skills integration on company-ingestion base; retired provider integration removed; retain stored-vector identity on re-init; -14: first-run bundle + quickstart registration helpers live in init-first-run.ts (writeback/skills asks folded into the bundle); +5 agent operator follow-up Item 2: --surface flag (value flag, parse, help line, module-level registration surface, type import) for the printed harness registration; +2 fix wave lane B3: both engine paths stamp a database init created as a fresh install for the behavior_changes notice (core/behavior-change-notice.ts)+ src/commands/init.ts 1882 ratchet +2 fix wave 9 lane F #5253: leaving deferred setup also clears the DB-plane embedding_disabled row (both init branches); grown v0.46.x keyless capability notices; grown db-availability loop: initPostgresCore typed-failure extraction + --prefer-postgres ladder hook + pgvector rethrow fix; +1 at megawave/wave-k merge; +master-merge true-up; wave-k: merge; #3753 --force re-init engine-preservation guard; +1 wave-k merge-union brace (--prefer-postgres close); +10 ambient-writeback WP8: runWritebackNudge consent ask in both engine epilogues (logic lives in core/onboard/writeback-nudge.ts); +4: v0.48.2 reranker readiness at init + test seam; +1: v0.48.2 provider normalization; +3: v0.48.2 review fixes; master integration: +2: preserve typed PGLite busy errors in schema-only init; shared-skills integration on company-ingestion base; retired provider integration removed; retain stored-vector identity on re-init; -14: first-run bundle + quickstart registration helpers live in init-first-run.ts (writeback/skills asks folded into the bundle); +5 agent operator follow-up Item 2: --surface flag (value flag, parse, help line, module-level registration surface, type import) for the printed harness registration; +2 fix wave lane B3: both engine paths stamp a database init created as a fresh install for the behavior_changes notice (core/behavior-change-notice.ts); +4 GBRA-81 item 1: --search-mode value flag, its parse line, module-level choice, help line (picker logic lives in init-mode-picker.ts)src/commands/integrations.ts 1739 ratchet grown v0.46.26.0 megawave (#4039 connector compat) + 1 nosemgrep dataflow annotation (path-traversal audit); wave-k: exported heartbeatPath seam (#3900)src/core/minions/handlers/subagent.ts 1925 ratchet merged: master v131 settle rework + dream-wave C5 peel + C6 accounting + C7 lease heartbeats/lost-lease aborts + C9 oneshot dispatch + adversarial fix batches; grown by #4078 subagent-loop capability fix; +6 lines (reasoning-item replay: adaptContentBlocksToChatBlocks handles 'reasoning' blocks); +3 wave G #4514: Anthropic-via-OpenRouter allowed on the subagent loop; +36 lines (code review, same PR): isPromptTooLongError walks a bounded .cause chain so it still matches post-normalizeAIError() wrapping, plus extractPromptTooLongDetail so the dead-lettered job's error carries the matched provider detail instead of the generic normalizeAIError() wrapper text; master integration: harness support: boundary wiring to shared grants, isolated setup, withdrawal and delegated guards; #5105: +13 call-site wiring to shared tool-write-identity helper across fresh and replay dispatch; +7 fix wave 9 lane B #4921: ai.chat.per_turn_timeout_ms read once and passed to the oneshot and gateway-loop paths (resolver lives in minions/handler-timeouts.ts)src/commands/bootstrap.ts 2147 ratchet grandfathered at merge (grew past the 1500 cap on master); raised for #4066 HOME_WORKSPACE_GUARD_EXEMPT (status/uninstall/harness); +5 for the harnessDetect test seam (bulk lives in core/bootstrap/harness.ts); +23 for the contract subcommand dispatcher glue (#4105 absorb — bulk lives in core/bootstrap/contract.ts); +codex hooks-consent gate + mcp+hooks receipt registration + uninstall arm; +42 ambient-writeback WP8: interview-time SURFACE_MULTIUSER audience apply (pre-init ordering) + applyDeclaredAudienceFromInterview; +3 #4897 harness usage clause documenting --source ID semantics; +5 #5878: --refresh-skills dispatch and usage lines (logic in core/bootstrap/harness-skills.ts); +11 #5488: SUBCOMMAND_HELP harness entry (gate on --help / -h / help) — CLI help line, cannot move; +11 #4618 seat: --seat/--no-seat help lines and the runHooks parse (parse + notes live in core/bootstrap/hooks.ts parseSeatFlags); +13 #4082: runAdoptHooks (the --adopt branch of the hooks subcommand, kept out of runHooks for the function-size ratchet) and its two help lines (adoption logic lives in core/bootstrap/adopt-connection.ts + adopted-connections.ts)@@@ -41,7 -41,7 +41,7 @@@ src/core/bootstrap/harness.ts 2610 ratcsrc/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 683 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) compose; +1 wave 11 W4.3 (#5969 D3): put_page drop_timeline param; +1 wave 11 security review: purge_deleted_pages yes param + trusted-CLI guard (consent logic in persistence/purge-deleted.ts); +1 Q2 parser gaps: get_page grammar_diagnostics param (report logic in core/line-grammar-report.ts); master v0.60.136.0 merge into #5575 memory trust (both sides kept)src/core/search/mode.ts 1594 ratchet +10 System One v1: decide.* snapshot subset in loadSearchModeConfig, append-only dec= knobsHash part; +5 #3617 follow-up: v27 same-knobs behavioral-change note (relaxed-row fusion demotion rides the bump); new row: crossed the 1500 unlisted cap in the 2026-08 eval fix wave — KNOBS_HASH v=27 adaptive-return fold (ar/arem/arom/armk/ari parts + KnobsHashContext.adaptiveReturn field + contamination rationale comments) | merged v0.48.1.0 (+#4787) true-up; +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); ranker wave v0.48.4.0: four knobs (expansion_variant_budget, relational_rerank_pin, keyword_arm_confidence_floor, metadata_boost_gate) + v29 hash parts + doc receipts (+218); #4781 loadSearchModeConfig reads the config table once via loadConfigSnapshot (+6); +4 #4359: update loadSearchModeConfig docstring — the cached path now reads config once (threaded snapshot), not twice; retired provider integration removed; +12 fw3-search: search.source_boosts + search.alias_token_hop read in the mode snapshot; +10 #5691: KnobsHashContext.queryPrefix and its append-only qp= part; P7 relational_planner / relational_orient_onehop knobs (interface docs, bundles, overrides, config parse, hash parts); +18 P7 relational_chain_slots knob (interface doc, bundles, override, config parse, rcs= hash part)- src/commands/eval-longmemeval.ts 1519 ratchet new row: crossed the 1500 unlisted cap in fw3-search (#5092 benchmark-brain recycling: configureBrain split + recycler wiring + test seams; the recycler itself lives in src/eval/longmemeval/harness.ts); +1 P6: tokenmax synopsis-tier wiring (logic in eval/longmemeval/synopsis-tier.ts)+ src/commands/eval-longmemeval.ts 1532 ratchet new row: crossed the 1500 unlisted cap in fw3-search (#5092 benchmark-brain recycling: configureBrain split + recycler wiring + test seams; the recycler itself lives in src/eval/longmemeval/harness.ts); +1 P6: tokenmax synopsis-tier wiring (logic in eval/longmemeval/synopsis-tier.ts); +13 GBRA-81 lane A: --via-operation query|search (flags, per-call expansion pin, the run's expectExpansion, the op branch in runOneQuestion, row field, via_operation_summary and its FAIL line; logic in eval/longmemeval/via-operation.ts)src/commands/doctor/checks/extraction-sync.ts 1523 ratchet +1 undeclared_db_only_pages computes the source Git scope once per source (logic in core/markdown.ts sourceGitScope); new row: crossed the 1500 unlisted cap at the fix wave 9 merge: +7 lane W #5028 (extract_atoms freshness judged by the phase itself) and +3 lane F #5863 (extract_health dates a high halt rate by its last halt), each under the cap alone; +7 #5019: content_hash_duplicates fix pins the pairs' source (GBRAIN_SOURCE) and names a delete that runs; +1 fix wave 10 lane L1 #5556: links_extraction_lag denominator excludes quarantined pages (quarantineFilterFragment import); +11 fix wave 15 P2.8 (#5495): extract_health reads the 7-day halt reasons per kind (halt_reasons, top_halt_reason in details and the top reason in the warn line); the read, the unknown bucket and the ranking live in core/extract/rollup-writer.tssrc/core/search/evidence-delivery.ts 1512 ratchet new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8)-src/commands/config.ts 1508 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 GBRA-81 item 1: config set search.mode records search.mode_source operator+src/commands/config.ts 1508 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts)diff --cc src/core/behavior-change-notice.tsindex 0bd61dc852,b3f5106dca..71aec6372b--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@@ -479,20 -479,14 +479,28 @@@ export const BEHAVIOR_CHANGES: Readonly{ since: '0.60.185.0', text: 'gbrain\'s own brain-repo commits (page write-through, facts fences, takes, timeline, `lint --fix`, and `sources harden` scaffolding) now take the checkout\'s commit lock (write-through waits 2 seconds, then commits its one path without it), commit only their own paths, and include both sides of a staged `git mv` rename. Paths passed to the helper or `gbrain git commit-push` are literal: a quoted glob no longer expands and fails `commit_paths_invalid`; name the files.' },{ since: '0.60.185.0', text: 'The pull that `gbrain sources pull`, the pull cron, `sources harden` and the workspace push run no longer rebases: a branch whose local and remote sides diverged is merged in memory and the checkout fast-forwards to the merge, for `pull_strategy: rebase` as well as `merge` (`set-pull-strategy` is still accepted). `gbrain sync`\'s pull is now a fetch plus a fast-forward under the commit lock. `gbrain sources harden` sets `rebase.autoStash=false`, `merge.autoStash=false` and `pull.ff=only` in the checkout\'s local git config so a stray `git pull` refuses instead of autostashing. A conflict now stops with `integrate_conflict` (ask the user; resolve with `gbrain git commit-push --push-only --expect-remote <sha> --resolve <path>=ours|theirs`), and `put_page` reports an unresolved one for that checkout.' },{ since: '0.60.185.0', text: 'The committed `scripts/brain-commit-push.sh` written by `gbrain sources harden` needs a gbrain that knows `git commit-push` to integrate remote commits. Without one it does only a locked, path-scoped commit and a plain push, and a rejected push now fails loudly (exit 4, PUSH FAILED) instead of rebasing. A helper written by a newer gbrain (a higher `# gbrain-protocol:` line) is never downgraded by an older harden.' },+ // GBRA-60 D2/D4 in-band notices. `since` is provisional (current VERSION); restamped at the merge slot.+ { since: '0.60.186.0', text: 'Two new info notices on MCP results; nothing a connection can call changes. `grant_blocked_operations` tells an authenticated connection once per session (once per grant revision for stateless HTTP) that its grant\'s operation snapshot, stored client surface or the server surface keeps operations its scopes allow out of reach, with counts and no operation names, and gives the brain owner\'s preview-then-apply rescope command (a missing scope is named only on a refused call). `hidden_tool_content` on get_page, search and query says when the result left out takes that a tool outside the tool list serves, with the next step that connection can take: the takes_list call (stdio also lists it), one request_tools {surface} widen, or the owner\'s repair. Fixes no longer name an MCP tool outside the grant\'s operation snapshot, and the stdio unknown-tool hint no longer offers a widen that read-only access or GBRAIN_MCP_FORCE_SURFACE would refuse.' },+ // Low-hanging-fruit wave (GBRA-81 items 1 and 1b).+ { since: '0.60.187.0', text: '`query` now expands only when the search mode says so: on in `tokenmax`, off in `balanced` (the default) and `conservative`, so `query` on a `balanced` brain no longer makes an expansion LLM call before retrieval. `expand: true` (CLI `--expand`) expands one call in any mode, and `gbrain config set search.expansion true` restores expansion by default for the brain; `expand: false` (`--no-expand`) still skips it. A `search.expansion` value set earlier, which `query` used to ignore, now takes effect on `query`; `gbrain search modes` shows it. `search` never expands, as before. CRAG escalation now reads whether the first pass actually expanded (`expansion_applied`), and eval capture records the `expand` the caller sent (null when unset) so `gbrain eval replay` replays the mode default.' },+ { since: '0.60.187.0', text: '`gbrain init --search-mode <conservative|balanced|tokenmax>` records the operator\'s choice: no recommendation, no first-run `search_mode` question, and `search.mode_source: operator` (picker choices record `auto`, and `gbrain config set search.mode` records `operator`). On a brain that already has a different mode it refuses unless `--force`. Init now recommends `balanced` instead of `conservative` when a reranker is ready but no chat key exists, and provider keys saved in `~/.gbrain/config.json` count toward the recommendation. The install matrix now prices Haiku 5.5, Sonnet 5.5 and Opus 5.5 from gbrain\'s pricing table (about a 200x corner-to-corner spread), and switching modes no longer promises a cache refill while semantic result caching is off.' },+ // Low-hanging-fruit wave (GBRA-81 items 2 and 3).+ { since: '0.60.187.0', text: 'Lean `search` and `query` rows (remote callers) now carry `id`, the `fetch` key, only when the connection can call `fetch` at that moment: a `full` surface, a stdio session `request_tools` widened, or an HTTP client whose surface and scopes include it. On `starter` and `verbs` connections, `fetch` was never callable, so the row\'s `slug` and `source_id` identify the page; `fields: "full"` returns every field, `id` included, and the `mcp.result_rows: full` host setting does so for every remote caller. Lean-row `score` now prints 4 significant digits. The local CLI and gbrain\'s thin client keep full rows, unchanged. `fetch` called without an id now says to re-run `search` once `fetch` is callable, or to pass the row\'s slug.' },+ { since: '0.60.187.0', text: 'On stdio MCP and the CLI, the `degraded_recall` notice now shows on every call a transient degradation affects (`rerank_failed`, `embed_timeout`, a failed keyword or title arm, and every other per-call stage); it used to show once per session, so a rerank failure after an earlier embedding timeout returned fused-order results with no notice. A keyless brain whose only degradation is `embed_unavailable` still shows it once per session. HTTP is unchanged: every affected call. `_meta.retrieval.degraded` still records every call\'s stages.' },+ // wave 16 (GBRA-79). `since` is provisional at the current VERSION; the integrator restamps it to the merge-slot version.+ { since: '0.60.185.0', text: 'A page purge (`gbrain delete <slug> --purge`) now searches the source\'s write journal for the page\'s claims at preparation, in bounded keyset chunks under the preparation budget (`persistence.maintenance_preparation_ms`), and its publication transaction only re-checks the requests admitted or settled since; the receipt reports `journal_sweep` (`scanned`, `ceiling`, `tail`, `pending_rechecked`, `complete`), and `complete: false` means a cap was hit and some requests were not tested. A purge whose remaining in-transaction lookup times out now ends `failed` with `purge_lookup_timeout` (nothing removed, tombstoned or redacted; later writes to the source move again) instead of being requeued as `database_contention` without bound, and a sweep that outruns its budget twice ends `preparation_stalled`; either failure needs a new request_id. A schema migration adds the request-table slug index (`gbrain repair request-indexes` rebuilds it).' },+ { since: '0.60.185.0', text: 'A soft delete (`delete_page`, `gbrain delete <slug>`) of a page whose canonical file another live page of the source records now keeps the file and publishes database-only (receipt `write_through.skipped: shared_origin`, with a warning): the selected database page is hidden; the file and the surviving page remain, and nothing is erased. It used to refuse `source_changed` (the shared file renders the other page), leaving no supported exit for a duplicate-origin twin. Managed sync\'s discovery census and its origin guards now apply one rule: a live page wins the origin over tombstones, several live pages refuse `page_identity_changed` naming that soft delete, a single tombstone may still be reused and several tombstones still refuse. The receipt names the surviving slug to the trusted local owner or to a remote writer whose grant and visibility cover it, never otherwise. A purge of a shared-origin page refuses and names the soft delete. The kept file is imported into the surviving page by the next sync that imports it (`gbrain sync --source <id> --no-pull --full` does it now); edit the file first if it holds the deleted page\'s text.' },+ // wave 16 (GBRA-79). `since` is provisional at the branch VERSION; the integrator restamps it at the merge slot.+ { since: '0.60.185.0', text: 'A managed sync checkpoint whose cursor another run of the same source replaced (a `--retry-failed` rediscovery or a newer sync) now refuses `sync_cursor_replaced` (receipt state `conflict`) instead of `revision_conflict`, the run that awaited it records no managed-sync failure for it and goes on with the winning cursor, and `--retry-failed` no longer treats the superseded checkpoint as a page fault; `gbrain doctor` stops reporting such a checkpoint as an unresolved sync failure. A same-run index lag still reports `revision_conflict` and a missing manifest `storage_error`.' },+ { since: '0.60.185.0', text: 'A write a database trigger gbrain does not know refuses now carries a closed `reason` in its public failure detail (`attribution_unclassified_table`, `trust_unclassified_table`, `graduation_in_progress`, or `unknown`), its stored message reads `Publication failed (P0001 in <raiser>: <reason>). Inspect owner diagnostics.`, and the engine-graduation fence (SQLSTATE 55000) is recognized as `graduation_in_progress` with a retry-later message instead of an owner-exception `storage_error`. The managed sync failure a run records, the failure ledger, `gbrain doctor` and `gbrain sync status --json` (`last_error.write_error_detail`, `last_error.detail`) now name the raiser, table and reason that only the receipt named before; the trigger\'s message text stays on the brain host (`gbrain write-request <id> --json`).' },+ { since: '0.60.185.0', text: 'Managed sync bookkeeping recorded under a source incarnation the source no longer has (a source re-pointed at a new checkout, or removed and added again) is now retirable: `gbrain repair managed-sync-orphans --source <id>` lists such cursor and failure rows as `incarnation_retired` and local ledger rows whose durable failure row is gone as `mirror_only`, and a successful sync prunes a source\'s stale mirror rows. `gbrain doctor` names them with the repair even when no current failure is visible; `gbrain doctor --fast` (no database) now reports mirrored managed rows as `warn` "could not be verified" instead of `fail` (a better fast score is less certainty, not recovery; the engine-backed check stays authoritative), while old unmanaged file failures keep their severity. `gbrain sync status` reports only a cursor a current sync can select: an old-incarnation cursor is `cursor: null` with `last_error.code: cursor_incarnation_retired` and the repair preview as `next`, instead of a resumable cursor whose `next` selected nothing.' },+ // wave 16 (GBRA-79)+ { since: '0.60.185.0', text: 'On a managed brain, automatic fact extraction (sync import, `put_page`, `extract_facts`, the sweep) now skips a candidate whose exact claim was forgotten in that source and visibility and publishes the other facts of the same entity, counting the skips as `withdrawn_skipped` on the entity and completion write receipts and the extraction result; before, one forgotten claim refused the entity\'s whole group with `fact_withdrawn`. Explicitly remembering the forgotten claim still refuses, and a purge tombstone still refuses the whole write. A claim forgotten after the facts were prepared refuses that entity\'s write with `revision_conflict` and a detail naming the withdrawal, publishing nothing. An extraction keyed by its input alone (no request id) recovers from such a refusal, and from a batch an older release refused for a forgotten claim, on its next run: the retained facts are re-admitted as a follow-up batch with no model call, at most three times per batch, and the refused receipts stay as they were. An extraction admitted under a request id replays its receipt; a new request_id extracts again.' },+ { since: '0.60.185.0', text: 'Atom extraction (`extract_atoms`, `gbrain dream --drain`) no longer marks an item complete when its text was cut at `cycle.extract_atoms.max_input_chars` (default 50,000 characters). The model reads the head once and its atoms are kept, but no completion stamp is written, no atom from an earlier extraction is retired, the phase result and the drain count the item under `input_truncated` with a stderr line naming the knob, and the item is skipped with no model call until the cap is raised or its content changes; raising the cap makes every such item eligible again on the next run. Before, a cut item was certified complete on its full content and a re-extraction could retire the atoms a larger cap had produced from its tail.' },+ { since: '0.60.185.0', text: 'With the `claude-cli` provider, a model answer Claude Code reports as "API Error: Claude\'s response exceeded the N output token maximum" is now treated as an answer that stopped at the output cap (`finishReason: length`), not as a provider failure, so the output-cap ladders run as designed: open-loop extraction (`loops_extract`) retries once at 8192 output tokens and fact extraction retries once at twice its output budget. Each retry is one more model call on the same input; every other claude-cli error envelope still fails the call.' },+ { since: '0.60.185.0', text: 'The same-page rewording measurement (`would_dedup_same_page`, 0.60.177.0) now also runs on a managed brain: automatic fact extraction there counts the rewordings on the entity and completion receipts and the `extract_facts` result and prints the same one stderr line per match. Nothing is dropped; a replay of the same request reports the recorded count without a model call.' },+ // wave 16 (GBRA-79) G5.1 #6495. `since` is provisional at the current VERSION; the integrator moves it to the merge-slot stamp.+ { since: '0.60.185.0', text: 'On Postgres, the keyword, keyword-count, keyword-page, title and CJK search statements run under one operator bound, `search.keyword_statement_timeout_ms` (default 8000, range 1000-60000; `gbrain config set`, then restart `gbrain serve` or the workers), instead of a fixed 8 s; a value outside the range is refused and never set from a request. `gbrain doctor` gains `keyword_plan`, a read-only canary that warns when the brain\'s commonest keyword term cannot be counted inside the bound (one term is not workload coverage, and a timed-out count is never "no matches"). A longer bound buys time, not a cheaper statement (#6495 stays open).' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --cc src/core/operations-descriptions.tsindex 5d555848c5,6f58280c4e..926fdc11c0--- a/src/core/operations-descriptions.ts+++ b/src/core/operations-descriptions.ts@@@ -46,13 -46,13 +46,13 @@@ export const GET_RECENT_TRANSCRIPTS_DES// ──────────────────────────────────────────────────────────────────────────────export const LIST_PAGES_DESCRIPTION =- "List pages with filters. For 'what's recent / what did I touch this week' use sort=updated_desc. Default 50 rows; a full page may be truncated: continue with updated_after + updated_after_slug from the last row.";+ "List pages with filters. For 'what's recent / what did I touch this week' use sort=updated_desc. Default 50 rows; truncated: continue with updated_after + updated_after_slug from the last row.";export const QUERY_DESCRIPTION =- "Hybrid search plus multi-query expansion for concept/landscape questions and people/companies/projects by topic (expansion recovers synonyms). Still top-K; return_unit: sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no LLM call). Personal: get_recent_salience, find_anomalies; transcripts: `gbrain transcripts recent`. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). Needs an embedding key (else keyword-only); expansion needs a chat key. Fact rows: use follow_up. fields: \"full\" adds diagnostics.";- "Hybrid search for concept/landscape questions; expand adds multi-query expansion (expansion recovers synonyms). Still top-K; return_unit: sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no LLM call). Personal: get_recent_salience, find_anomalies; transcripts: `gbrain transcripts recent`. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). Needs an embedding key (else keyword-only); expansion needs a chat key. Fact rows: use follow_up. fields: \"full\" adds diagnostics.";++ "Hybrid search for concept/landscape questions and people/companies/projects by topic; expand adds multi-query expansion (expansion recovers synonyms). Still top-K; return_unit: sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no LLM call). Personal: get_recent_salience, find_anomalies; transcripts: `gbrain transcripts recent`. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). Needs an embedding key (else keyword-only); expansion needs a chat key. Fact rows: use follow_up. fields: \"full\" adds diagnostics.";export const SEARCH_DESCRIPTION =- "Cheap hybrid search, no LLM expansion, top 20: exact tokens, names, field values. NOT proof of coverage; match: \"keyword\" pages every keyword match and takes OR across quoted names or codes (\"A\" OR \"B\" OR …): one call lists every page matching any. Name lists: entity names. Concepts/landscape: `query`; lists: list_pages; personal: get_recent_salience. return_unit: sections or conversations. fields: \"full\" adds diagnostics.";+ "Cheap hybrid search, no LLM expansion, top 20: exact tokens, names, field values. NOT proof of coverage; match: \"keyword\" pages every keyword match and takes OR across quoted names or codes (\"A\" OR \"B\" OR …): one call lists every page matching any. Name lists: entity names. Concepts/landscape or people/companies/projects by topic: `query`; lists: list_pages; personal: get_recent_salience. return_unit: sections or conversations. fields: \"full\" adds diagnostics.";/** `search`'s `match` param (Cat 40 Hard F2). */export const SEARCH_MATCH_DESCRIPTION = 'keyword: every match, paged.';diff --cc src/core/schema-migrations/latest.generated.tsindex dc31b41f5f,e5b395aed4..115c3b3e46--- a/src/core/schema-migrations/latest.generated.ts+++ b/src/core/schema-migrations/latest.generated.ts@@@ -4,4 -4,4 +4,4 @@@// The highest schema migration version (migrate.ts LATEST_VERSION), importable without// loading the migrations themselves.- export const LATEST_SCHEMA_VERSION = 241;-export const LATEST_SCHEMA_VERSION = 240;++export const LATEST_SCHEMA_VERSION = 242;diff --cc src/core/schema-migrations/registry.generated.tsindex 6e88254a1e,2f024605ab..5d10baa3ff--- a/src/core/schema-migrations/registry.generated.ts+++ b/src/core/schema-migrations/registry.generated.ts@@@ -240,8 -240,7 +240,9 @@@ import { v236 } from './v236-open-loopsimport { v237 } from './v237-facts-question-recall-indexes.ts';import { v238 } from './v238-persistence-client-request-id.ts';import { v239 } from './v239-extract-rollup-halt-reasons.ts';- import { v240 } from './v240-persistence-request-slug-intent-index.ts';- import { v241 } from './v241-extract-atoms-partial-input.ts';+ import { v240 } from './v240-pages-name-lookup-indexes.ts';++import { v241 } from './v241-persistence-request-slug-intent-index.ts';++import { v242 } from './v242-extract-atoms-partial-input.ts';// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the// runner sorts by version before applying.@@@ -481,5 -480,4 +482,6 @@@ export const MIGRATIONS: Migration[] =v238,v239,v240,+ v241,++ v242,];diff --cc src/core/schema-migrations/v241-persistence-request-slug-intent-index.tsindex 789933dc06,0000000000..bac7a980d2mode 100644,000000..100644--- a/src/core/schema-migrations/v241-persistence-request-slug-intent-index.ts+++ b/src/core/schema-migrations/v241-persistence-request-slug-intent-index.ts@@@ -1,25 -1,0 +1,25 @@@+import type { Migration } from './types.ts';+import { PERSISTENCE_REQUEST_SLUG_INTENT_INDEX } from '../persistence/schema.ts';+import { buildIndexOnline, migrationNotice } from './helpers.ts';++// Applied by src/core/migrate.ts on the next initSchema(); see docs/ENGINES.md+// ("Canonical schema sources") for when schema.sql or a TS fragment also changes.+//+// #6511 (GBRA-79 wave 16): the page purge's lookup of stored intents for its+// slug (`findRequestsForSlugs`: source, slug, uncompacted rows with an intent)+// had no index and ran as a sequential scan of the request table inside the+// purge's 5 s publication transaction. Postgres builds the partial index+// CONCURRENTLY outside a transaction, after dropping an INVALID leftover (the+// blob omits it); PGLite builds it inline. `gbrain repair request-indexes`+// runs the same helper on a brain whose schema is already current. DDL only:+// no column, no backfill.- export const v240: Migration = {- version: 240,++export const v241: Migration = {++ version: 241,+ name: 'persistence_request_slug_intent_index',+ idempotent: true,+ transaction: false,+ sql: '',+ handler: async engine => {- await buildIndexOnline(engine, 240, PERSISTENCE_REQUEST_SLUG_INTENT_INDEX, { notice: migrationNotice });++ await buildIndexOnline(engine, 241, PERSISTENCE_REQUEST_SLUG_INTENT_INDEX, { notice: migrationNotice });+ },+};diff --cc src/core/schema-migrations/v242-extract-atoms-partial-input.tsindex 6c1dcb14d7,0000000000..c54bcd6ec1mode 100644,000000..100644--- a/src/core/schema-migrations/v242-extract-atoms-partial-input.ts+++ b/src/core/schema-migrations/v242-extract-atoms-partial-input.ts@@@ -1,23 -1,0 +1,23 @@@+import type { Migration } from './types.ts';++// Applied by src/core/migrate.ts on the next initSchema(); the fresh-install+// copies of both tables in src/schema.sql carry the same column.- export const v241: Migration = {- version: 241,++export const v242: Migration = {++ version: 242,+ name: 'extract_atoms_partial_input',+ // #6503: an item cut at `cycle.extract_atoms.max_input_chars` is no longer+ // stamped complete. Its row records the cap the model read it under+ // (`partial_input_chars`): discovery skips the item while the cap is at+ // or below that value and offers it again once the cap rises (the phase+ // clears rows under the new cap before discovery) or the content changes+ // (a new content_hash is a new row). NULL on complete and failed rows.+ // DDL only: a metadata-only ADD COLUMN under migrate.ts's lock timeout,+ // no row rewritten, nothing to backfill.+ idempotent: true,+ sql: `+ ALTER TABLE extract_atoms_page_state+ ADD COLUMN IF NOT EXISTS partial_input_chars INTEGER;+ ALTER TABLE extract_atoms_transcript_state+ ADD COLUMN IF NOT EXISTS partial_input_chars INTEGER;+ `,+};