Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
GST-687: fix the diff-gate failures
garrytan3f483bca113a
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex b2e11fd8fb..d2b77d7346 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -40,11 +40,11 @@ src/core/config.ts 2016 ratchet +1 search.saved_facts_supersede KNOWN_CONFIG_KEYsrc/core/persistence/sync-run.ts 1687 ratchet new row: crossed the 1500 unlisted cap in #6643 (knock-on re-freeze, checkpoint revival, root cause and the truthful --retry-failed wait all drive the private cursor/gate machinery: holdUnderGate, freezeEntry, saveCursor); classification lives in sync-knock-on.ts, the checkpoint clause in checkpoint-validation.ts; peel the settle path (settleFailedRequest and its recoveries) into a sibling module next; +3 #6722: committed pages' size_state tallied into the cursor and the sync receipt size_states (logic in page-embedding-budget.ts addSizeState); merge v0.60.240.0: large pages and master growth compose at 1687; +2 #6694: the slug-mode checkpoint revival import and its doc line (predicate lives in persistence/sync-slug-mode.ts); +11 #6712 PR 3 (L7): a plain sync retries the recorded failure --retry-failed used to (retryRecordedFailure; the unchanged-refusal replay lives in persistence/sync-stop-class.ts replaysUnchangedRefusal), the moved-checkpoint and company content-refusal exceptions; #6712 PR 3 integration: lanes L7 (retryRecordedFailure, +19) and L8 (#6727 legacy-slug refusal line, #6735 timeout revival, +6) compose at 1762; +2 wave 18a integration: #6729 (lane 2, written against the 1745 ceiling) records identity downgrades in performManagedPass through noteIdentityDowngrades (logic in core/sync-identity-downgrades.ts), composed with master 1762; +14 Wave B PR 2: freezeEntry freezes a Markdown file over the read bound by reference (body_ref) and holdFailedFenceRequest holds a streamed refusal; both set freezeEntry/holdFailedFenceRequest locals (blob, oversize, rawHash) so they stay here, the hashing and preparation live in persistence/sync-streamed.ts and the hold in sync-screen.ts streamedRefusalHold; integrated at the master 4e29d0904 merge: master 1764 + Wave B PR 2 14 = 1778 measured; +4 #6948: freezeEntry holds an entry several live pages claim (hold in sync-screen.ts originConflictHold, verdict in persistence/origin-twins.ts); +1 #7167: managedDryRun reports the writer state (the import of persistence/sync-dry-run-writer.ts, where the read lives); +4 G3 git-canonical: freezeEntry reads a strict source's entry from its commit (pinnedBlob) and carries committedOnly to publication; both use freezeEntry locals (rule in persistence/sync-classify.ts); +1 #7886: the import of persistence/sync-receipt-wait.ts, where the managed sync receipt waits and their test seam livesrc/core/bootstrap/harness.ts 2612 ratchet +29 live-PGLite-serve lane: LIVE_SERVE refusal ahead of source resolution + unpinned --token hooks (CI e2e fix); +46 wave review: resolveHookSource dep (serve-parity resolver + federated grant), --source shape validation, loud SOURCE_UNRESOLVED instead of a silent 'default'; +10: #4574 parseCodexBlockBearer http_headers shape + legacy bearer_token fallback; +4 at megawave/wave-k merge; +codex hooks lane: step-7 codex hooks.json + config.toml trust pair, removeHarness arm; +234 ambient-writeback WP3: kind:'instructions' targets (plan/apply/converge-off/remove/status probes, OV-A4 override pre-check) — splice/render mechanics live in instructions-block.ts; +59 adversarial fix wave: registrar-mode block suppression, converge-failure receipt tracking, MCP-confirmed guard before block install; +26 round-3 fixes: codex-lane MCP-confirmed guard + smoke-rollback block strip; master: | merged v0.48.1.0 true-up; +41 #4897 resolveImplicitSource dep + defaultResolveImplicitSource: hooks/token/receipt bind to the serve's implicit default source when --source is omitted; +23 #4586 statusHarness live claude-code mcp verdict (URL mismatch or same-scope non-HTTP registration reads failed, receipt untouched); shared-skills integration on company-ingestion base; +18 #5671: logAmbientPostureNotes helper (registrar note moved out of applyHarness + pre-consent warning when an explicit private facts default meets the HTTP harness; text shared with doctor in facts/writeback-config.ts); +24 #5893: rotation grant carry wiring and its rotationCarry/withheldOperationsNote helpers (carry rules live in token-mint.ts carryLegacyGrant); +6 #5878: --refresh-skills flag and status epoch line (refresh logic lives in harness-skills.ts); +7 #4618 seat: HarnessFlags.seat field, --seat/--no-seat parse via hooks.ts parseSeatFlags, GBRAIN_SEAT in the hook env; -119 #6082: plugin-lane detectors moved to plugin-lanes.ts (re-exported); +18 #6092/#6171: hook ownership identity on write/remove/converge, permission ownership carry, --remove --dry-run and the --status hook census (logic in hooks.ts + harness-hooks.ts); +5 D8 Codex slice: the Codex SessionEnd capture hook obeys the recorded consent (wireCodexCapture: hooks on, capture accepted, never registrar mode) and is disclosed in the consent block; -31 #6743: cleanup gate moved to harness-cleanup.ts; +8 #6798: supersededEnrollments dep (interface field + default) and the --status epoch hint printed only for a superseded enrollment (the brain read lives in harness-skills.ts brainSupersededEnrollments); +13 brain-first block lane: --no-instructions flag field + parse, opencodeAgentsPath dep (field + default) and the step-10b / remove call sites (logic lives in harness-brain-first.ts); +7 GBRA-243 per-turn rule hook: consent-block interface field, step-10c call site, turn_hooks JSON field, exit code and the remove arm (writer, host list and consent text live in harness-brain-first.ts)src/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 option-src/core/ops/pages.ts 728 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); +21 large pages (Wave A): get_page body-mode dispatch, fetch window branch, put_page large-page admission and allow_shrink param, description text (logic in ops/get-page-body.ts and persistence/large-page-guard.ts); +1 D8 funnel: committed put_page records a save when the opt-in funnel is on; +1 #6609: restore_page detach param (logic in persistence/detached-pages.ts); +1 Wave B gem A: post-batch auto-link reads a segmented page materialized (helpers in persistence/segmented-apply.ts); merge v0.60.249.0: composes at 707; +4 Wave B PR 2: get_page refuses a segmented page whole and fetch windows one (logic in ops/get-page-body.ts and page-window/segmented.ts); +2 Wave B PR 2 lane F: get_page and fetch pin segmented reads to the authorized snapshot (pin logic in ops/get-page-body.ts authorizedReadPin); +3 W2 page-at-time: get_page known_as_of param and dispatch (logic in ops/known-as-of.ts and belief/page-at-time.ts); GBRA-151 retrieval P0 x operability wave merge: both sides grew the file, re-summed (721 measured); GBRA-151 #7147 follow-up re-summed at the v0.60.334.0 merge (727 measured); +1 #7305: capture dry run applies the hyphen-run slug admission (logic in persistence/suffixed-slug.ts)+src/core/ops/pages.ts 729 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); +21 large pages (Wave A): get_page body-mode dispatch, fetch window branch, put_page large-page admission and allow_shrink param, description text (logic in ops/get-page-body.ts and persistence/large-page-guard.ts); +1 D8 funnel: committed put_page records a save when the opt-in funnel is on; +1 #6609: restore_page detach param (logic in persistence/detached-pages.ts); +1 Wave B gem A: post-batch auto-link reads a segmented page materialized (helpers in persistence/segmented-apply.ts); merge v0.60.249.0: composes at 707; +4 Wave B PR 2: get_page refuses a segmented page whole and fetch windows one (logic in ops/get-page-body.ts and page-window/segmented.ts); +2 Wave B PR 2 lane F: get_page and fetch pin segmented reads to the authorized snapshot (pin logic in ops/get-page-body.ts authorizedReadPin); +3 W2 page-at-time: get_page known_as_of param and dispatch (logic in ops/known-as-of.ts and belief/page-at-time.ts); GBRA-151 retrieval P0 x operability wave merge: both sides grew the file, re-summed (721 measured); GBRA-151 #7147 follow-up re-summed at the v0.60.334.0 merge (727 measured); +1 #7305: capture dry run applies the hyphen-run slug admission (logic in persistence/suffixed-slug.ts); +1 GST-687: get_page include_timeline_entries quotes rows for remote readers (import only; logic in ops/timeline-quote.ts)src/core/search/mode.ts 1709 ratchet +53 W3 confidence-gated reranking: reranker_gate / reranker_gate_min_gap bundle fields, overrides, config parse and KNOB_CONFIG_KEY rows, knobsHash v=31 rrg=/rrgg=/ecf= parts (parse contracts in crag.ts); +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); +22 GBRA-60 S1 diverse_pool_depth knob (interface doc, bundles, overrides, pick, config parse, append-only dpd= hash part); +35 GBRA-154: collapse and rank_priors knobs (interface docs, bundles, overrides, pick, config parse, append-only col=/rpr= hash parts); GBRA-151 retrieval P0 x operability wave merge: both sides grew the file, re-summed (1704 measured); +5 GBRA-156 #7593: private-pages grant part in the cache keysrc/commands/eval-longmemeval.ts 1545 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); +12 --call-plan FILE / --call-plan-gate CMD: two LME_FLAGS entries (CLI help lines), two ParsedArgs fields, the parseArgs pairing check and the header invariant (planner lives in eval/longmemeval/call-plan.ts; runEvalLongMemEval is one line shorter); +1 #7619: parseArgs refuses a value on a switch (--judge=false turned the paid judge on)src/commands/doctor/checks/extraction-sync.ts 1500 ratchet +7 GBRA-130 A-1: links_extraction_lag held bucket and its retry fix (logic in core/extraction-lag.ts heldExtractionReport); +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.ts; +20 wave 18b lane 1: links_extraction_lag names the columns its pre-migration degrade reads (#6599 strict predicate), sync_freshness separates sync outcome from freshness for a source with no successful sync (#4960; verdict text, fixes and the attempt read live in doctor/sync-outcome.ts and core/sync-attempt.ts) and exempts read-only skill-pack catalogs (#6076; core/shared-skills/adopted-packs.ts); -51 #6803 (D1): links_extraction_lag reads its counts and verdict from core/extraction-lag.ts (shared with the sync nudge); +1 #7145: content_hash_duplicates reads one group past its list to report a floor ("at least 50")-src/core/search/evidence-delivery.ts 1755 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); 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); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned)+src/core/search/evidence-delivery.ts 1759 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); 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); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts); +11 #7600: assemble_evidence quotes conversation rows and capEvidenceToBudget counts the quote fence (logic in search/transcript-quote.ts); +2 GBRA-156 /ship review: the cut-path admission and title room count the quote fence; +2 GBRA-156 /ship review pass 2: capEvidenceToBudget counts the fence only for the paths that fence (quote flag; recall counts the text as returned); +4 GST-687: page evidence and the extractive fallback quote below-owner-tier text for untrusted readers (untrusted flag; logic in search/transcript-quote.ts)src/commands/config.ts 1524 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); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal)src/commands/mcp-expose.ts 1519 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts); +7 GBRA-199: --surface help lines, surfaceChosen option field and the advertise pass-through (registrationAdvertise in core/mcp-registration.ts)-src/core/behavior-change-notice.ts 1575 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +1 GBRA-250 #8071 rows_behind_checkpoint_8071 row (since TBD until the merge slot); +1 GBRA-250 #8073 derived_write_through_commits_8073 row (since TBD until the merge slot); +2 GBRA-250 #8072 rows (oversize hold left unread, refresh sync budget; since TBD until the merge slot); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1)+src/core/behavior-change-notice.ts 1577 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row; +1 GBRA-242 provider_key_rules_7959 row (#7959), +2 the GBRA-199 registration_lists_verbs row (since TBD until the merge slot); +2 GBRA-133 #7652: the #7611 pass_abandoned reader row and the lean read-only serve socket row (re-summed at the 0.60.503.0 merge: master 1555 + 2); +1 GBRA-243: the per-turn hook disclosure row (rows are data and cannot move); +4 GBRA-156 #7598 harness wave comment and rows (remote page cap, sources_not_readable refusal, sources add next step); +4 GBRA-156 #7601 search_quotes_transcript_rows comment and row; +1 GBRA-175 #7475 autopilot_restarts_serve_7475 row (re-summed at the #8012 merge: 1566 + 1); +3 #7997/#8014/#8015 rows (redaction markers, company db_only keep, ignored supabase_only scope); +1 GBRA-250 #8071 rows_behind_checkpoint_8071 row (since TBD until the merge slot); +1 GBRA-250 #8073 derived_write_through_commits_8073 row (since TBD until the merge slot); +2 GBRA-250 #8072 rows (oversize hold left unread, refresh sync budget; since TBD until the merge slot); +1 GBRA-156 #7593: private_pages_granted_sources row (re-summed at the 0.60.527.0 merge: 1574 + 1); +2 GST-687 remote_quotes_unverified_text_gst687 row and its comment (since TBD until the merge slot)diff --git a/scripts/persistence/model.ts b/scripts/persistence/model.tsindex db008449ef..6ea0f6ce8d 100644--- a/scripts/persistence/model.ts+++ b/scripts/persistence/model.ts@@ -18,6 +18,7 @@ import { parseFactsFence } from '../../src/core/facts-fence.ts';import { parseTakesFence } from '../../src/core/takes-fence.ts';import { FACT_FENCE_KIND, TAKE_FENCE_KIND, fenceOwnerKey, readFenceBlocks } from '../../src/core/generations/fence.ts';import { isRegistryCode } from '../../src/core/error-catalogue.ts';+import { unquoteTranscriptText } from '../../src/core/search/transcript-quote.ts';import { CONNECTOR_SLUG, contextFor, retryingRead, type OpDescriptor, type OpKind, type OpObservation, type World } from './ops.ts';/**@@ -287,8 +288,9 @@ export class ReferenceModel {async recall(actor: string, source: string, entity: string): Promise<string[]> {try {const r = await this.retrying(() => operationsByName.recall.handler(contextFor(this.world, actor, source),- { entity, limit: 100, ...(actor === 'local' ? { source_id: source } : {}) })) as { facts?: { fact?: string }[] };- return (r.facts ?? []).map(f => String(f.fact ?? ''));+ { entity, limit: 100, ...(actor === 'local' ? { source_id: source } : {}) })) as { facts?: { id?: number; fact?: string; quoted?: string }[] };+ // GST-687: a remote reader gets an agent-written fact quoted; the stored text is what the receipt promised.+ return (r.facts ?? []).map(f => f.quoted ? unquoteTranscriptText(String(f.fact ?? ''), `fact ${f.id}`) : String(f.fact ?? ''));} catch { return []; }}diff --git a/src/core/ops/pages.ts b/src/core/ops/pages.tsindex dcdd943b95..59b4211166 100644--- a/src/core/ops/pages.ts+++ b/src/core/ops/pages.ts@@ -23,7 +23,7 @@ import { isSegmentedPage } from '../page-body/page-shape.ts';import { MIN_TRUST_PARAM } from '../eligibility/policy.ts';import { getPageKnownAsOf, KNOWN_AS_OF_PARAM } from './known-as-of.ts';import { stampRowTrust } from '../eligibility/stamp.ts';-import { quoteTimelineRows } from './timeline.ts';+import { quoteTimelineRows } from './timeline-quote.ts';import { isAutoLinkEnabled } from '../link-extraction.ts';import { sanitizeRemoteBody } from '../remote-body.ts';import { getContentFlag } from '../quarantine.ts';diff --git a/src/core/ops/timeline-quote.ts b/src/core/ops/timeline-quote.tsnew file mode 100644index 0000000000..13e954eb8c--- /dev/null+++ b/src/core/ops/timeline-quote.ts@@ -0,0 +1,16 @@+import type { OperationContext } from './contract.ts';+import { pageTypesById, quotePageText, quotesStored } from '../search/transcript-quote.ts';++/** GST-687: an untrusted reader gets an entry of a chat page, or one below the owner's tier, quoted like get_page's timeline. */+export async function quoteTimelineRows<T extends { page_id: number; summary: string; detail?: string | null; trust_tier: string | null }>(+ ctx: OperationContext, slug: string, rows: T[],+): Promise<Array<T | (T & { quoted: 'transcript' })>> {+ if (ctx.remote === false || rows.length === 0) return rows;+ const types = await pageTypesById(ctx.engine, rows.map(e => e.page_id));+ return rows.map(e => {+ const type = types.get(e.page_id);+ if (!quotesStored(type, e.trust_tier)) return e;+ const quote = (text: string) => quotePageText(text, slug, type);+ return { ...e, summary: quote(e.summary), ...(e.detail ? { detail: quote(e.detail) } : {}), quoted: 'transcript' as const };+ });+}diff --git a/src/core/ops/timeline.ts b/src/core/ops/timeline.tsindex 00b067d362..9d3e4858fb 100644--- a/src/core/ops/timeline.ts+++ b/src/core/ops/timeline.ts@@ -8,12 +8,12 @@ import { MERGE_PRECONDITION_PARAMS, WRITE_REQUEST_PARAM } from '../persistence/p* (cycle).*/-import { opError, type Operation, type OperationContext } from './contract.ts';+import { opError, type Operation } from './contract.ts';import { opTransport } from './op-fix.ts';import { readPolicyOpts } from './context.ts';import { MIN_TRUST_PARAM, resolveReadEligibility } from '../eligibility/policy.ts';import { stampRowTrust } from '../eligibility/stamp.ts';-import { pageTypesById, quotePageText, quotesStored } from '../search/transcript-quote.ts';+import { quoteTimelineRows } from './timeline-quote.ts';import {enforceSubagentSlugFence,enforceClientSlugFence,@@ -21,19 +21,6 @@ import {// --- Timeline ----/** GST-687: an untrusted reader gets an entry of a chat page, or one below the owner's tier, quoted like get_page's timeline. */-export async function quoteTimelineRows<T extends { page_id: number; summary: string; detail?: string | null; trust_tier: string | null }>(- ctx: OperationContext, slug: string, rows: T[],-): Promise<Array<T | (T & { quoted: 'transcript' })>> {- if (ctx.remote === false || rows.length === 0) return rows;- const types = await pageTypesById(ctx.engine, rows.map(e => e.page_id));- return rows.map(e => {- const type = types.get(e.page_id);- if (!quotesStored(type, e.trust_tier)) return e;- const quote = (text: string) => quotePageText(text, slug, type);- return { ...e, summary: quote(e.summary), ...(e.detail ? { detail: quote(e.detail) } : {}), quoted: 'transcript' as const };- });-}const add_timeline_entry: Operation = {name: 'add_timeline_entry',diff --git a/src/core/persistence/page-mutations.ts b/src/core/persistence/page-mutations.tsindex 83450cd19e..0bfffaf40e 100644--- a/src/core/persistence/page-mutations.ts+++ b/src/core/persistence/page-mutations.ts@@ -44,6 +44,7 @@ import { liveSearchable } from './searchable.ts';import { cachedPreadmitBrain, dropPreadmitCache, preadmitReads, preadmitRecheckFailed } from './preadmit-cache.ts';import { pipelined } from '../page-state/transactions.ts';import { holdsSummarizedToolCalls, isQuotedPageType, quotesTier, unquoteTranscriptText } from '../search/transcript-quote.ts';+import { chunkVisibleFilter } from '../search/safe-chunks.ts';import { isMirrorOnlyPage, sourceMirrorReadOnly } from './mirror-read-only.ts';export async function requestPrincipalForContext(ctx: OperationContext): Promise<Principal> {@@ -268,7 +269,8 @@ async function unquotedPutContent(engine: BrainEngine, sourceId: string, slug: s'SELECT id, type, trust_tier FROM pages WHERE source_id = $1 AND slug = $2', [sourceId, slug]);// The stored page's own literal summaries, read from its chunks; a summary split across two chunks is missed, so that write is refused.const storedSummaries = async (pageId: number) => (await engine.executeRaw<{ chunk_text: string }>(- "SELECT chunk_text FROM content_chunks WHERE page_id = $1 AND chunk_text LIKE '%, arguments omitted]%'", [pageId])).map(r => r.chunk_text).join('\n');+ `SELECT cc.chunk_text FROM content_chunks cc JOIN pages p ON p.id = cc.page_id+ WHERE cc.page_id = $1 AND cc.chunk_text LIKE '%, arguments omitted]%' AND ${chunkVisibleFilter('p', 'cc')}`, [pageId])).map(r => r.chunk_text).join('\n');if (summarized && stored && isQuotedPageType(stored.type) && holdsSummarizedToolCalls(await storedSummaries(Number(stored.id)), unquoted)) {throw new OperationError('invalid_params', `put_page: this content has tool calls that a read of ${slug} summarized; writing it would replace the stored calls with their summaries.`,'Nothing was written. Read the page with get_page include_content: true (its content keeps the stored text) and write that back, or change the page with edit_page.');diff --git a/test/e2e/facts-context-injection-postgres.test.ts b/test/e2e/facts-context-injection-postgres.test.tsindex 76a42edeb9..b5d18585c7 100644--- a/test/e2e/facts-context-injection-postgres.test.ts+++ b/test/e2e/facts-context-injection-postgres.test.ts@@ -5,6 +5,7 @@import { describe, test, expect, beforeAll, afterAll, beforeEach } from 'bun:test';import { setupDB, teardownDB, hasDatabase, getEngine } from './helpers.ts';+import { asOwner } from '../helpers/owner-tier.ts';import { dispatchToolCall } from '../../src/mcp/dispatch.ts';import {getBrainHotMemoryMeta,@@ -17,14 +18,16 @@ const d = RUN ? describe : describe.skip;beforeAll(async () => {if (!RUN) return;const engine = await setupDB();- await engine.insertFact(- { fact: 'world fact', kind: 'fact', entity_slug: 'meta-pg', visibility: 'world', source: 'test' },- { source_id: 'default' },- );- await engine.insertFact(- { fact: 'private fact', kind: 'fact', entity_slug: 'meta-pg', visibility: 'private', source: 'test' },- { source_id: 'default' },- );+ await asOwner(engine, async tx => {+ await tx.insertFact(+ { fact: 'world fact', kind: 'fact', entity_slug: 'meta-pg', visibility: 'world', source: 'test' },+ { source_id: 'default' },+ );+ await tx.insertFact(+ { fact: 'private fact', kind: 'fact', entity_slug: 'meta-pg', visibility: 'private', source: 'test' },+ { source_id: 'default' },+ );+ });});afterAll(async () => { if (RUN) await teardownDB(); });diff --git a/test/e2e/http-transport.test.ts b/test/e2e/http-transport.test.tsindex 68421fbce1..769f81a6bf 100644--- a/test/e2e/http-transport.test.ts+++ b/test/e2e/http-transport.test.ts@@ -13,6 +13,7 @@ import { describe, test, expect, beforeAll, afterAll } from 'bun:test';import { createHash, randomBytes } from 'crypto';import { startHttpTransport } from '../../src/mcp/http-transport.ts';import { hasDatabase, setupDB, teardownDB, getEngine, getConn } from './helpers.ts';+import { fenceTranscriptText } from '../../src/core/search/transcript-quote.ts';const skip = !hasDatabase();const describeE2E = skip ? describe.skip : describe;@@ -306,12 +307,13 @@ describeE2E('http-transport E2E (real Postgres)', () => {const marker = randomBytes(6).toString('hex');const worldFact = `E2E world fact ${marker}`;const privateFact = `E2E private fact SECRET-${marker}`;- await conn.unsafe(+ const inserted = await conn.unsafe(`INSERT INTO facts (source_id, fact, kind, visibility, source) VALUES('default', $1, 'fact', 'world', 'e2e-http'),- ('default', $2, 'fact', 'private', 'e2e-http')`,+ ('default', $2, 'fact', 'private', 'e2e-http') RETURNING id, visibility`,[worldFact, privateFact],);+ const worldId = inserted.find(row => row.visibility === 'world')!.id;// include_private only widens for trusted-local callers (ctx.remote ===// false); this transport always dispatches remote:true, so the flag must@@ -335,9 +337,10 @@ describeE2E('http-transport E2E (real Postgres)', () => {const rawText = body.result.content[0].text;const parsed = JSON.parse(rawText);expect(parsed.protocol_version).toBe(1);- // World fact present — proves the facts arm actually ran (non-vacuous).+ // World fact present — proves the facts arm actually ran (non-vacuous). A raw insert carries no+ // owner tier, so this remote reader gets it quoted (GST-687).const factTexts = parsed.facts.map((f: { fact: string }) => f.fact);- expect(factTexts).toContain(worldFact);+ expect(factTexts).toContain(fenceTranscriptText(worldFact, `fact ${worldId}`));// Private fact absent from facts[], from the injectable text, and from// the entire serialized payload (covers every additive field at once).expect(factTexts).not.toContain(privateFact);diff --git a/test/e2e/legacy-chunk-privacy.test.ts b/test/e2e/legacy-chunk-privacy.test.tsindex 11b48db575..88615b7f69 100644--- a/test/e2e/legacy-chunk-privacy.test.ts+++ b/test/e2e/legacy-chunk-privacy.test.ts@@ -9,6 +9,7 @@ import type { SearchResult } from '../../src/core/types.ts';import { operationsByName, type OperationContext } from '../../src/core/operations.ts';import { readPolicyOpts } from '../../src/core/ops/context.ts';import { importFromContent } from '../../src/core/import-file.ts';+import { asOwner } from '../helpers/owner-tier.ts';import { serializeMarkdown } from '../../src/core/markdown.ts';import { runReindex } from '../../src/commands/reindex.ts';import { buildEmptyRetrievalBlock } from '../../src/mcp/dispatch.ts';@@ -105,9 +106,9 @@ for (const kind of ['pglite', 'postgres'] as const) {}async function safe(slug: string, sourceId: string, body: string): Promise<number> {- const result = await importFromContent(engine, slug,+ const result = await asOwner(engine, tx => importFromContent(tx, slug,serializeMarkdown({ visibility: 'world' }, body, '', { type: TYPE, title: 'Synthetic safely imported document', tags: [] }),- { sourceId, noEmbed: true, forceRechunk: true });+ { sourceId, noEmbed: true, forceRechunk: true }));expect(result.status).toBe('imported');return (await engine.getPage(slug, { sourceId }))!.id;}diff --git a/test/e2e/thin-client.test.ts b/test/e2e/thin-client.test.tsindex d96415cf1c..c529cc188a 100644--- a/test/e2e/thin-client.test.ts+++ b/test/e2e/thin-client.test.ts@@ -368,8 +368,11 @@ describeWhen('thin-client end-to-end (requires DATABASE_URL)', () => {for (const key of ['slug', 'page_id', 'title', 'type', 'chunk_text', 'chunk_source', 'score', 'evidence', 'source_id', 'stale']) {expect(Object.keys(routedRow)).toContain(key);}- // Full key-set parity local ↔ routed.- expect(Object.keys(routedRow).sort()).toEqual(Object.keys(localRow).sort());+ // Full key-set parity local ↔ routed. The CLI put stamps the page agent-written, so the routed (remote)+ // read alone returns it quoted and adds `quoted` (GST-687); the local read returns it as stored.+ expect(routedRow.quoted).toBe('transcript');+ expect(localRow.quoted).toBeUndefined();+ expect(Object.keys(routedRow).filter(k => k !== 'quoted').sort()).toEqual(Object.keys(localRow).sort());};pinRowParity(runs.hostSearch, runs.clientSearch, 'search');pinRowParity(runs.hostQuery, runs.clientQuery, 'query');diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.jsonindex 6274069f76..a5aa8871ba 100644--- a/test/fixtures/goldens/doctor/content-pglite-json.json+++ b/test/fixtures/goldens/doctor/content-pglite-json.json@@ -3120,6 +3120,7 @@"table": "timeline_entries"}],+ "unknown_pages": 0,"unknown_pct": 0},"elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.jsonindex b979583551..b0e7953764 100644--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json@@ -3324,10 +3324,11 @@"table": "timeline_entries"}],+ "unknown_pages": 1,"unknown_pct": 10},"elapsed_ms": "<volatile>",- "message": "10% of 30 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for.",+ "message": "10% of 30 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for. Remote MCP readers see the 1 unverified-origin page(s) quoted as source material until the backfill classifies them or the owner claims their source (gbrain trust claim-sources); local reads are unchanged.","name": "trust_tiers","status": "ok"},@@ -8205,10 +8206,11 @@"table": "timeline_entries"}],+ "unknown_pages": 1,"unknown_pct": 12.9},"elapsed_ms": "<volatile>",- "message": "12.9% of 31 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for.",+ "message": "12.9% of 31 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for. Remote MCP readers see the 1 unverified-origin page(s) quoted as source material until the backfill classifies them or the owner claims their source (gbrain trust claim-sources); local reads are unchanged.","name": "trust_tiers","status": "ok"},diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 2a1c4acc2c..fcca7db087 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -3326,10 +3326,11 @@"table": "timeline_entries"}],+ "unknown_pages": 1,"unknown_pct": 10},"elapsed_ms": "<volatile>",- "message": "10% of 30 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for.",+ "message": "10% of 30 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for. Remote MCP readers see the 1 unverified-origin page(s) quoted as source material until the backfill classifies them or the owner claims their source (gbrain trust claim-sources); local reads are unchanged.","name": "trust_tiers","status": "ok"},@@ -8208,10 +8209,11 @@"table": "timeline_entries"}],+ "unknown_pages": 1,"unknown_pct": 12.9},"elapsed_ms": "<volatile>",- "message": "12.9% of 31 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for.",+ "message": "12.9% of 31 row(s) have an unverified origin (unknown tier); the backfill has classified every row it has a signal for. Remote MCP readers see the 1 unverified-origin page(s) quoted as source material until the backfill classifies them or the owner claims their source (gbrain trust claim-sources); local reads are unchanged.","name": "trust_tiers","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex a6bbad91d0..c12abdd22a 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -2841,6 +2841,7 @@"table": "timeline_entries"}],+ "unknown_pages": 0,"unknown_pct": 0},"elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex ca9f480348..c3f8b2d6b6 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -2884,6 +2884,7 @@"table": "timeline_entries"}],+ "unknown_pages": 0,"unknown_pct": 0},"elapsed_ms": "<volatile>",diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex f2354ac43d..508d1b3ee7 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -2886,6 +2886,7 @@"table": "timeline_entries"}],+ "unknown_pages": 0,"unknown_pct": 0},"elapsed_ms": "<volatile>",diff --git a/test/get-versions-defaults.test.ts b/test/get-versions-defaults.test.tsindex c6ded30488..f27baef198 100644--- a/test/get-versions-defaults.test.ts+++ b/test/get-versions-defaults.test.ts@@ -19,6 +19,7 @@ import { PGLiteEngine } from '../src/core/pglite-engine.ts';import { operationsByName, type OperationContext } from '../src/core/operations.ts';import type { Notice } from '../src/core/agent-output.ts';import { formatResult } from '../src/cli/main.ts';+import { asOwner } from './helpers/owner-tier.ts';const SLUG = 'people/alice-example';const SHORT = 'notes/short-history';@@ -30,15 +31,17 @@ beforeAll(async () => {engine = new PGLiteEngine();await engine.connect({});await engine.initSchema();- const page = await engine.putPage(SLUG, { type: 'person', title: 'Alice', compiled_truth: 'current body' });- await engine.executeRaw(- `INSERT INTO page_versions (page_id, compiled_truth, timeline, frontmatter, snapshot_at, title)- SELECT $1, 'body v' || g || E'\\n\\n' || $2, 'timeline v' || g, '{}'::jsonb, '2026-01-01'::timestamptz + g * interval '1 hour', 'title v' || g- FROM generate_series(1, ${VERSIONS}) g`,- [page.id, TAKES]);- const short = await engine.putPage(SHORT, { type: 'note', title: 'Short', compiled_truth: 'short body' });- await engine.executeRaw(- `INSERT INTO page_versions (page_id, compiled_truth, frontmatter, title) VALUES ($1, 'only version', '{}'::jsonb, 'only')`, [short.id]);+ await asOwner(engine, async tx => {+ const page = await tx.putPage(SLUG, { type: 'person', title: 'Alice', compiled_truth: 'current body' });+ await tx.executeRaw(+ `INSERT INTO page_versions (page_id, compiled_truth, timeline, frontmatter, snapshot_at, title)+ SELECT $1, 'body v' || g || E'\\n\\n' || $2, 'timeline v' || g, '{}'::jsonb, '2026-01-01'::timestamptz + g * interval '1 hour', 'title v' || g+ FROM generate_series(1, ${VERSIONS}) g`,+ [page.id, TAKES]);+ const short = await tx.putPage(SHORT, { type: 'note', title: 'Short', compiled_truth: 'short body' });+ await tx.executeRaw(+ `INSERT INTO page_versions (page_id, compiled_truth, frontmatter, title) VALUES ($1, 'only version', '{}'::jsonb, 'only')`, [short.id]);+ });}, 120_000);afterAll(async () => { await engine.disconnect(); });diff --git a/test/get-versions-response-bounds.test.ts b/test/get-versions-response-bounds.test.tsindex 31c5b60f3a..0e852402a2 100644--- a/test/get-versions-response-bounds.test.ts+++ b/test/get-versions-response-bounds.test.ts@@ -20,6 +20,7 @@ import { PGLiteEngine } from '../src/core/pglite-engine.ts';import { operationsByName, type OperationContext } from '../src/core/operations.ts';import { toAgentError } from '../src/core/agent-output.ts';import { isolatedPersistencePostgres } from './helpers/persistence-postgres.ts';+import { asOwner } from './helpers/owner-tier.ts';const SOURCE = 'acme-example';const OTHER = 'widget-co';@@ -37,7 +38,7 @@ beforeAll(async () => {}for (const { engine: e } of databases) {await e.executeRaw('INSERT INTO sources(id, name) VALUES ($1, $1), ($2, $2)', [SOURCE, OTHER]);- await seed(e);+ await asOwner(e, tx => seed(tx));}}, 120_000);diff --git a/test/helpers/segmented-privacy-fixture.ts b/test/helpers/segmented-privacy-fixture.tsindex 4f57be128a..44778f8ab4 100644--- a/test/helpers/segmented-privacy-fixture.ts+++ b/test/helpers/segmented-privacy-fixture.ts@@ -9,7 +9,7 @@import { expect } from 'bun:test';import type { BrainEngine } from '../../src/core/engine.ts';import { importFromContent } from '../../src/core/import-file.ts';-import { asOwner } from './owner-tier.ts';+import { withTrustPromotion } from '../../src/core/persistence/context.ts';import { renderFactsTable, type ParsedFact } from '../../src/core/facts-fence.ts';import { holdFingerprint } from '../../src/core/write-gate-store.ts';import { fenceRowHoldTexts } from '../../src/core/eligibility/fence-overlay.ts';@@ -100,7 +100,10 @@ export function pageContent(truth: string, timeline = ''): string {/** Import `content` with segmented storage on and return the page id; the page must come out segmented. */export async function importSegmented(engine: BrainEngine, slug: string, content: string): Promise<number> {await engine.setConfig('pages.segmented_storage', 'on');- await asOwner(engine, tx => importFromContent(tx, slug, content, { sourceId: 'default', noEmbed: true }));+ await importFromContent(engine, slug, content, { sourceId: 'default', noEmbed: true });+ // The owner's tier, as a sync of the owner's file stamps it (GST-687: below it a remote reader gets the page quoted).+ await engine.transaction(tx => withTrustPromotion(tx, 'operator_curated', () =>+ tx.executeRaw("UPDATE pages SET trust_tier = 'operator_curated' WHERE source_id = $1 AND slug = $2", ['default', slug])));const [page] = await engine.executeRaw<{ id: number; body_storage: string }>('SELECT id, body_storage FROM pages WHERE source_id=$1 AND slug=$2', ['default', slug]);expect(page?.body_storage).toBe('segmented');return Number(page!.id);