Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: recorded-time get_page and traverse_graph hops answer Sol's filled-in calls instead of refusing (GST-2214)
garrytan1028962eec68
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 821c6f24a1..310387aca7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,18 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**GPT-6.1 Sol's recorded-time page reads and typed graph chains now get answers instead of refusals.** Sol fills in every optional argument of a tool call. A `get_page` with `known_as_of` (the page as the brain had recorded it at an instant) arrived beside `include_content: true`, `include_timeline_entries: true`, a one-line `lines` window, `view: "read"` and the rest, and gbrain refused the whole call because a recorded-time read does not serve those arguments. A `traverse_graph` with `hops` arrived beside `depth`, `link_type` and `direction`, and was refused the same way. Sol does not follow the refusal's fix, so in a replay of its recorded calls 178 of 651 `get_page` and `traverse_graph` calls failed on arguments alone. Both calls now run: a recorded-time read returns the whole page as recorded, a chain walks its hops, and the response's `set_aside` names each argument that was ignored and why. `body: outline` or `window` with `known_as_of` still refuses, because that names a read mode the ledger cannot serve.++### Itemized changes++- `src/core/ops/known-as-of.ts`: `get_page {known_as_of}` sets aside the arguments that shape a current read (window selectors, `section`, `grep`, `context`, `include_content`, `content_only`, `include_timeline_entries`, `view`, `max_bytes`, `fuzzy` and the rest) and returns `set_aside {ignored, note}`; only `body: outline|window` refuses `invalid_params`, with the same keep-only-what-applies `fix`.+- `src/core/ops/links.ts`: `traverse_graph` with `hops` walks the chain with `depth`, `link_type` and `direction` set aside and named in `set_aside`; malformed hops still refuse.+- `src/core/behavior-change-notice.ts`: one row for the changed refusals.+- Docs: `docs/guides/multi-hop.md`, the key-files rows for `known-as-of.ts` and `links.ts`.+- Tests: `test/tool-args-empty-optional-sol.test.ts` replays Sol's shapes on every entry point (MCP remote and local, `gbrain call`, the SkillOpt rollout and write-capture registries, the subagent registry) against a ledger-enabled brain; `test/traverse-graph-hops.test.ts` and `test/get-page-slices.test.ts` assert the set-aside contract where they asserted the refusal.+## [0.60.626.0] - 2026-11-09**`gbrain sources record-origin --remote` now locks down the existing checkout too, and on a managed brain it can no longer report success while a reclone still clones with git-lfs on.** On a managed brain the record took only the source row lock, so a reclone that had already read the source, or held its worktree locks, could clone with git-lfs downloads and hooks on after the command said the source was recorded. The record now takes the worktree locks and rows a reclone takes (refusing the id `source_busy` while one runs), and the reclone reads the record under its own locks. `--remote --apply` now also turns git-lfs downloads and hooks off in the existing checkout's `.git/config`, because a reclone only happens when a checkout is lost or replaced, and until then doctor read green while the checkout still fetched git-lfs objects and ran hooks. The git-lfs check now reads a committed `.gitattributes` under a directory whose name holds a tab (it was cut at the tab and skipped), ignores commented-out `filter=lfs` lines, says "declares a git-lfs filter" when a rule only declares one, and records a clone of an empty repository instead of telling the operator to restore an intact checkout. A failed write is reported for its own id instead of ending the run without saying which ids were recorded.diff --git a/docs/architecture/key-files/belief-ledger.md b/docs/architecture/key-files/belief-ledger.mdindex 51201758d0..d8e0669d38 100644--- a/docs/architecture/key-files/belief-ledger.md+++ b/docs/architecture/key-files/belief-ledger.md@@ -18,7 +18,7 @@ Design: [BELIEF_LEDGER.md](../../designs/BELIEF_LEDGER.md). Operator surface: `g- `src/core/belief/page-at-time.ts` — W2 page-at-time (BELIEF_LEDGER.md section 10): `readPageAtTime` replays a slug's page events of every lifetime into validity intervals under the section 5.3 visibility rule (a straddling write refuses `known_as_of_unproven`), refuses `coverage_from` / `coverage_gap` from `coverageAt`, and pairs each closed interval with the preimage version the next transition wrote (by revision, in order); the open head reads the live page. A body no version holds is disclosed (`body_reason`), never borrowed. Purge-redacted events carry no revision, so a purged lifetime splits only on slug and deleted state. `remoteMayRead` applies history.ts's remote rule per interval.- `src/core/belief/preimages.ts` — the preimage invariant (BELIEF_LEDGER.md section 14 item 8): a revision-moving publication leaves a version of its `revision_before`. `missingPreimages` is the in-batch check `finalizeBeliefEvents` runs under `NODE_ENV=test` (off with `GBRAIN_BELIEF_PREIMAGE_CHECK=0`); `preimageGaps` is doctor's production scan (large and segmented pages exempt).- `src/core/belief/changes.ts` — W4 weekly change diff (BELIEF_LEDGER.md section 15): `beliefChanges` reads the window through `readBeliefHistory` (`recordedAfter`/`recordedUntil`, then `subjectKeys` up to `since` for each subject's value before), nets each subject end to end, reads a subject with no earlier event from the page body at `since` (`before_known: false` when no body answers), lists a page created in the window with its creation body's fence rows, flags a `dream`-inferred link end `upper_bound`, and skips backfill and baseline events. Remote callers get world fence rows only where `remoteMayRead` passes. Served by `delta {beliefs: true}` and `gbrain beliefs changes`.-- `src/core/ops/known-as-of.ts` — the op surface: `get_page {known_as_of}` and `get_versions {known_as_of, diff, source_id}` (full surface only). One target source (explicit, ambient, or the only granted source whose ledger names the slug); remote callers get only readable intervals of a page visible now at their trust floor, with sanitized bodies. `parseKnownAsOf` refuses a bare date `clock_mismatch`. Window selectors, `section`, `grep` and `context` do not combine with known_as_of (`invalid_params` naming the arguments to drop, with a read `fix` that keeps only what a recorded-time read takes).+- `src/core/ops/known-as-of.ts` — the op surface: `get_page {known_as_of}` and `get_versions {known_as_of, diff, source_id}` (full surface only). One target source (explicit, ambient, or the only granted source whose ledger names the slug); remote callers get only readable intervals of a page visible now at their trust floor, with sanitized bodies. `parseKnownAsOf` refuses a bare date `clock_mismatch`. A recorded-time read returns the whole page: arguments that shape a current read (window selectors, `section`, `grep`, `context`, `include_content`, `view` and the like; GST-2214, GPT-6.1 Sol fills them all) are ignored and named in the response's `set_aside {ignored, note}`. `body: outline` or `window` still refuses `invalid_params`, with a read `fix` that keeps only what a recorded-time read takes.- `src/core/engine-sql/pages.ts` `updateSlug` — versions the page before the move (the move advances the revision), so page-at-time has the body from before a rename.- `src/commands/beliefs.ts` — `gbrain beliefs enable|disable|status|changes|reconcile|backfill|replay-purges` (`--json`); an unknown source is `invalid_params`. Only `changes` routes on a thin client: `thin-client-routing.ts` calls the host's `delta {beliefs: true}` (so it lists the remote world view) and refuses `--source`; every other subcommand is host-only.- `src/commands/doctor/checks/belief-ledger.ts` — doctor `belief_ledger_coverage`: intervals and certification, baseline progress, drift (sampled; complete under `--tier deep`), orphan lifetimes, unmarked publications, and a restore whose purge replay was partial, unavailable or unverified (`ask_user`). `--fix` reconciles and fills marks; a brain without coverage is information with an `ask_user` enable.diff --git a/docs/architecture/key-files/core-services-2.md b/docs/architecture/key-files/core-services-2.mdindex 5222ef8947..979afdb188 100644--- a/docs/architecture/key-files/core-services-2.md+++ b/docs/architecture/key-files/core-services-2.md@@ -39,7 +39,7 @@ Fact and page purge modules (`src/core/facts/purge*.ts`, `deletion-inventory.ts`- `src/core/ops/insights.ts` — `find_contradictions` (`filtered`, takes `min_trust`) returns the stored report as written only to explicitly trusted, unscoped, unfloored local callers. Remote, source-scoped and floored callers get `eval-contradictions/scoped-read.ts` findings (both sides re-read live, `total_visible` instead of the run total); a remote context with no source scope gets an empty list and a note. Expert search threads page and holder policy and performs final authorized-page admission after enrichment.-- `src/core/ops/links.ts` — the link-domain op module (`add_link`, `remove_link`, `get_links`, `get_backlinks`, `list_link_sources`, `traverse_graph`); `get_backlinks`' `type`/`group`/`limit`/`cursor` live in `backlinks-paged.ts`. Three load-bearing behaviors. (1) Pack vocabulary at the write surface: an EXPLICIT `link_type` on `add_link` must be declared by the active schema pack when one resolves (`schema-pack/write-vocabulary.ts`; no resolvable pack = no enforcement; omitted/empty link_type is the untyped-edge default and stays unchecked; the check runs before the dry-run return so dry runs preview the rejection). (2) `traverse_graph` output shape: trusted local no-filter callers (`ctx.remote === false`, no `link_type`/`direction`) keep the legacy `GraphNode[]` shape that `gbrain graph` renders; remote callers default to `direction: 'both'` and always receive explicit `GraphPath[]` edges, so a page whose typed edges are all inbound does not read as edge absence. An explicit `direction` param wins for every caller. Depth: default 5 (`DEFAULT_TRAVERSE_DEPTH`), except a remote call that let direction default to `both` ALSO defaults depth to `REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH` (2) — bidirectional path enumeration is combinatorial on entity hubs and this is the per-agent-turn path; a `link_type`-only remote call still takes both/2; an explicit depth is honored up to `TRAVERSE_DEPTH_CAP` (10, clamped with a warn). The edge walk runs through `engine.traversePathsDetailed`, and a hit on `TRAVERSE_PATH_ROW_CAP` (`engine-constants.ts`) surfaces as a stderr warn naming the cap (shallowest edges kept) — the `GraphPath[]` wire shape stays unchanged. Pinned by `test/traverse-graph-op-default.test.ts` + `test/traverse-paths-row-cap.test.ts`. (3) Link-read source scope: the three read ops take `source_id` (`parseSourceIdParam`, `__all__` admitted) and `all_sources` (equivalent to `__all__`; both together is `invalid_params`). `resolveLinkReadScope` composes `federatedSearchScope` (grant check, #5081 admission, unqualified no-grant widening to `localFederatedSourceIds`; a grant never widens), then `assertExplicitSourceLive` (so an archived source outside the caller's admission answers `permission_denied`, not `unknown_source`), then `linkReadScopeOpts` (remote scalar promoted to `sourceIds[]` for the engine's all-endpoints branch), then `readPolicyOpts`. A trusted local unqualified read that comes back as the federated `sourceIds[]` runs the scalar read once per federated source (set order, resolved source first) and merges de-duplicated on link identity, keeping the scalar branch's cross-source far endpoints; `traverse_graph` walks the federated set in one query because its scalar walk already scopes every node. A trusted local unqualified link read that returns nothing prints a stderr rerun hint naming sources outside the read that hold links for the slug (quiet under `json`, never for remote callers). CLI names: `links` (alias `get_links`), `backlinks`, `graph`. (4) Row paging (#6876): rows are keyset-paged by `ops/link-paging.ts` (cap after the source/identity merge; see its header). Pinned by `test/link-read-paging.test.ts`. Pinned by `test/federated-link-reads-5827.test.ts`, `test/link-reads-thin-client-5827.serial.test.ts` and `test/e2e/federated-link-reads-postgres.test.ts`. `traverse_graph` `hops` (1-3 `{link_type, toward}`) runs a typed chain through `runRelationalChain` under the op's read scope, returns `{anchor, answers, paths, diagnostics}` with evidence edges (remote context sanitized), refuses `hops` combined with `depth`/`link_type`/`direction` and bad hops as `invalid_params` naming the parameter path, and emits a `relational_chain` notice with the next call when the chain finds nothing. Pinned by `test/traverse-graph-hops.test.ts`. `all_sources` is full-surface-only (starter passes `source_id: '__all__'`).+- `src/core/ops/links.ts` — the link-domain op module (`add_link`, `remove_link`, `get_links`, `get_backlinks`, `list_link_sources`, `traverse_graph`); `get_backlinks`' `type`/`group`/`limit`/`cursor` live in `backlinks-paged.ts`. Three load-bearing behaviors. (1) Pack vocabulary at the write surface: an EXPLICIT `link_type` on `add_link` must be declared by the active schema pack when one resolves (`schema-pack/write-vocabulary.ts`; no resolvable pack = no enforcement; omitted/empty link_type is the untyped-edge default and stays unchecked; the check runs before the dry-run return so dry runs preview the rejection). (2) `traverse_graph` output shape: trusted local no-filter callers (`ctx.remote === false`, no `link_type`/`direction`) keep the legacy `GraphNode[]` shape that `gbrain graph` renders; remote callers default to `direction: 'both'` and always receive explicit `GraphPath[]` edges, so a page whose typed edges are all inbound does not read as edge absence. An explicit `direction` param wins for every caller. Depth: default 5 (`DEFAULT_TRAVERSE_DEPTH`), except a remote call that let direction default to `both` ALSO defaults depth to `REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH` (2) — bidirectional path enumeration is combinatorial on entity hubs and this is the per-agent-turn path; a `link_type`-only remote call still takes both/2; an explicit depth is honored up to `TRAVERSE_DEPTH_CAP` (10, clamped with a warn). The edge walk runs through `engine.traversePathsDetailed`, and a hit on `TRAVERSE_PATH_ROW_CAP` (`engine-constants.ts`) surfaces as a stderr warn naming the cap (shallowest edges kept) — the `GraphPath[]` wire shape stays unchanged. Pinned by `test/traverse-graph-op-default.test.ts` + `test/traverse-paths-row-cap.test.ts`. (3) Link-read source scope: the three read ops take `source_id` (`parseSourceIdParam`, `__all__` admitted) and `all_sources` (equivalent to `__all__`; both together is `invalid_params`). `resolveLinkReadScope` composes `federatedSearchScope` (grant check, #5081 admission, unqualified no-grant widening to `localFederatedSourceIds`; a grant never widens), then `assertExplicitSourceLive` (so an archived source outside the caller's admission answers `permission_denied`, not `unknown_source`), then `linkReadScopeOpts` (remote scalar promoted to `sourceIds[]` for the engine's all-endpoints branch), then `readPolicyOpts`. A trusted local unqualified read that comes back as the federated `sourceIds[]` runs the scalar read once per federated source (set order, resolved source first) and merges de-duplicated on link identity, keeping the scalar branch's cross-source far endpoints; `traverse_graph` walks the federated set in one query because its scalar walk already scopes every node. A trusted local unqualified link read that returns nothing prints a stderr rerun hint naming sources outside the read that hold links for the slug (quiet under `json`, never for remote callers). CLI names: `links` (alias `get_links`), `backlinks`, `graph`. (4) Row paging (#6876): rows are keyset-paged by `ops/link-paging.ts` (cap after the source/identity merge; see its header). Pinned by `test/link-read-paging.test.ts`. Pinned by `test/federated-link-reads-5827.test.ts`, `test/link-reads-thin-client-5827.serial.test.ts` and `test/e2e/federated-link-reads-postgres.test.ts`. `traverse_graph` `hops` (1-3 `{link_type, toward}`) runs a typed chain through `runRelationalChain` under the op's read scope, returns `{anchor, answers, paths, diagnostics}` with evidence edges (remote context sanitized), sets `depth`/`link_type`/`direction` aside (`set_aside`), refuses bad hops as `invalid_params` naming the parameter path, and emits a `relational_chain` notice with the next call when the chain finds nothing. Pinned by `test/traverse-graph-hops.test.ts`. `all_sources` is full-surface-only (starter passes `source_id: '__all__'`).- `src/core/ops/pages.ts` — page operations share source validation and the persistence coordinator. Replacements require `expected_revision` or explicit `force`; omitted preconditions permit creation only. The put_page description keeps `Keep a request_id UUID; retry with identical arguments` within its schema budget (pinned by `test/mcp-schema-budget.test.ts` minimum guidance; the description and the content param both keep the get_page include_content:true read that `test/mcp-tool-defs.test.ts` pins). `get_page` and `fetch` use `page-state/snapshot.ts` for exact/alias resolution, content, tags, revision and withdrawal overlays in one SQL snapshot; fuzzy fallback uses a short repeatable-read transaction with the same visibility and source ceilings. `get_page` `content_only` (`ops/get-page-projection.ts`) returns slug, source_id, type, title, revision, tags, content and chars (keys pinned by `test/get-page-content-roundtrip-2225.test.ts`). A put_page `revision_conflict` (`ops/put-page-revision-source.ts`) whose expected_revision is the current revision of the same slug in another source the caller may read (grant via `federatedSearchScope`, private pages excluded for untrusted readers) names that source and gets a re-read fix; otherwise the refusal is unchanged. `get_page` adds `file_held` when sync holds the page's newer file (`persistence/held-reads.ts`; path for trusted local callers only). Missing migration dependencies and connection errors propagate. Capture freezes target/type/timestamp/provenance before admission and resolves same-ID replay first. `persistence/links-preparation.ts` prepares trusted automatic graph reconciliation outside locks, then installs it with canonical projections and the receipt; delayed oneshot reconciliation validates its originating revision. `persistence/page-advisories.ts` prepares bounded, content-free lint findings. Tests: source/alias ownership, concurrent graph replacements, stale delayed reconciliation, private fences, durable retries. `list_pages` passes `listColumnsOnly` so `engine-sql/pages.ts:listPages` projects identity, type, title and dates without reading page bodies or frontmatter (`list-pages-columns-5154.test.ts`). `delete_page` accepts a strict boolean `purge` only from trusted local callers. Immediate purge uses the same durable journal, observed revision (or explicit `force`), stored/current authority and exact request-ID replay as other page mutations. Owner preparation resolves the recorded file from a coherent snapshot, including tombstones; file removal precedes hard deletion and receipt commitment in the guarded publication transaction. Failed publication preserves the prior active row or existing tombstone and never overwrites unexpected file bytes. The receipt reports the actual filesystem/database persistence outcome and warns that repository history, synced copies, exports and derived artifacts may retain content. The `gbrain delete <slug> --purge` flag derives from the operation contract. `list_pages` probes `limit + 1` rows: a local CLI caller gets a stderr truncation notice; every dispatched caller gets `_meta.pagination` (`truncated`, `limit`, `clamped_from?`, `next?`) and a remote caller whose page was truncated also gets the model-visible `listing_truncated` notice whose `fix.mcp` is the next-page call (`ops/list-pages-pagination.ts`; `next` is the `updated_asc` keyset or an offset). Test: `test/list-pages-truncation.test.ts`. An `updated_after` the database cannot cast (SQLSTATE 22007/22008, the shared `isDatetimeInputError` in `core/utils.ts` that the hybrid lexical arms also use) is `invalid_params` with a read-only list_pages fix, never echoing the value; other SQLSTATEs pass through (`test/list-pages-timestamp-input.test.ts`). put_page (dry runs included) refuses a new `.md`/`.mdx`-suffixed slug (`persistence/suffixed-slug.ts`). #6212: `delete_page` and `restore_page` (dry runs included) go through `persistence/page-mutations.ts:validateMutationSlug`, which admits a legacy stored slug (`ops/context.ts:isLegacyStoredPageSlug`: refused by today's grammar, still accepted by `validateSlug`) only when an existing row in the target source holds it; every other operation keeps `validatePageSlug`, and remote purge stays denied by `assertPurgeParams`. Large pages: `get_page` resolves its body mode first (`parseBodyRequest`, `src/core/ops/get-page-body.ts`) and returns `readPartialBody` for none/outline/window/auto-above-256 KB, `assertFullReadFits` guarding whole remote reads; `fetch` of a page over the inline size returns `fetchWindowResult` (window around the id's chunk anchor, `metadata.next_id`); remote `put_page` runs `assertLargePageAdmission` before queueing. A committed segmented write's outcome records `searchable` (`true`, `'pending'` when its projection runs after commit, `false` when quarantined); `persistence/searchable.ts:liveSearchable` re-reads a pending one whenever the receipt is served (the put_page reply in `page-mutations.ts`, `get_write_request`) and adds `searchable_retry_after_ms` and a `searchable_fix` that reads the receipt again (`test/large-pages/segmented-create-searchable.test.ts`). Only writes load `page-mutations.ts` (`test/cold-read-module-graph.test.ts`). The starter list leaves out (`fullSurfaceOnly`, still accepted) get_page `fuzzy`/`content_only`/`include_deleted`/`include_timeline_entries`/`include_quarantined`, list_pages `offset`/`include_deleted`, put_page `allow_empty`/`drop_timeline` (refusals name them), the write ops' `reason` and the server-set provenance params, and capture `expected_revision`/`force`/`local_file`.diff --git a/docs/guides/multi-hop.md b/docs/guides/multi-hop.mdindex d9e63a790a..54b7abffde 100644--- a/docs/guides/multi-hop.md+++ b/docs/guides/multi-hop.md@@ -57,8 +57,9 @@ traverse_graph {"slug": "people/alice-example",written in: `object` walks subject → object (investor → company, person →employer), `subject` walks object → subject (company → founder). Chain linktypes: `founded`, `invested_in` (with `led_round`), `advises`, `works_at`,-`attended`, `yc_partner`. `hops` cannot be combined with `depth`, `link_type`-or `direction`; up to 3 hops. MCP advertises `hops` on the full surface (the+`attended`, `yc_partner`. Up to 3 hops. With `hops`, the chain sets the walk, so+`depth`, `link_type` and `direction` are ignored and the response names them in+`set_aside`. MCP advertises `hops` on the full surface (thedefault); the starter surface leaves it out to stay inside its size budget.## Try it keyless (about a minute)diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex 9368f567d1..f5c01d0265 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -1494,6 +1494,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.622.0', id: 'purge_cancels_deferred_write_gst1602', text: 'With `persistence.refresh_barrier` on, `gbrain forget <id> --purge` no longer refuses `purge_blocked_pending_recovery` while a write deferred behind a refresh holds the claim in its staged body: the deferred write was never claimed, so the purge cancels it with `purged_content`, as it does a queued one, and removes the content at once instead of up to 15 minutes later.' },{ since: '0.60.623.0', id: 'owner_reads_private_gst2059', text: 'A brain can now name its owner: `gbrain access owner set <member>` (config `access.owner_member`, an enabled member). Every remote credential or stdio server bound to that member reads the whole brain, `visibility: private` pages, privacy-alias pages (`access: private`, ...), derived and pinned-question pages included, through `get_page`, `search`, `query`, `recall` and the other page reads in the sources its grant reads, and `recall` returns its private facts. `readable_by` and folder rules still bind it, and it is not relaxed when it speaks for a shared-room audience. A page the owner\'s credential creates in `default` through `put_page` is not kept to the owner (no `readable_by: [member:<id>]`). Other members, unbound and public callers are unchanged. `_meta.access.relaxation` reads `owner` for such a call, and `gbrain access check --token <name>` reports it. `gbrain repair private-labels` (named runs only) previews the `access: private` labels stamped on ordinary pages with counts per category, keeps real restrictions, and clears the rest in reviewed batches (`--apply --expect <hash>`), recording each change so `--class restore` can put it back. The bulk-ingestion page template no longer writes an `access:` line; what each designation means is in docs/guides/access-designations.md.' },{ since: '0.60.626.0', id: 'record_origin_checkout_lockdown_8888', text: '`gbrain sources record-origin <id>... --remote --apply` now also turns git-lfs downloads and hooks off in each recorded source\'s existing checkout (its `.git/config`: `lfs.fetchexclude=*`, `core.hooksPath=/dev/null`, `lfs.locksverify=false`), not only on later reclones, in the repository\'s shared config, and refuses `write_failed` naming the key when a worktree-scoped or included setting still overrides one; a source already recorded as remote gets the lock-down on the next `--remote --apply` when its checkout lacks it, even when its files now use git-lfs, and a key that holds several values in that config is replaced by the one clone-time value. On a managed brain it takes the same worktree locks a reclone takes, refusing the id `source_busy` while a reclone, refresh or write holds them, and a reclone reads the record under its own locks. A write that fails is reported for its own id (`write_failed`) instead of ending the run. The git-lfs check reads a committed `.gitattributes` under a directory whose name holds a tab, ignores commented-out `filter=lfs` lines, says when a committed rule only declares an LFS filter, records a clone of an empty repository instead of refusing it, and names the cause of an `lfs_unknown` refusal.' },+ { since: 'TBD', id: 'recorded_read_view_args_gst2214', text: 'get_page with known_as_of beside arguments that shape a current read (lines, bytes, around_chunk_id, cursor, section, grep, context, include_content, include_timeline_entries, view, max_bytes and the like) now reads the whole page as recorded instead of refusing with invalid_params; the response\'s set_aside names what was ignored. body outline or window with known_as_of still refuses. traverse_graph with hops likewise walks the chain and sets depth, link_type and direction aside instead of refusing.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/ops/known-as-of.ts b/src/core/ops/known-as-of.tsindex 419a03adf5..a8e252e09c 100644--- a/src/core/ops/known-as-of.ts+++ b/src/core/ops/known-as-of.ts@@ -20,7 +20,7 @@ export const KNOWN_AS_OF_PARAM: ParamDef = { type: 'string', fullSurfaceOnly: trdescription: 'Recorded time: the page as this brain had recorded it at this ISO 8601 instant (2026-10-01T12:00:00Z), from the belief ledger. Not as_of, which is valid time (a date).' };export const VERSIONS_DIFF_PARAM: ParamDef = { type: 'boolean', actsWhenTrue: true, fullSurfaceOnly: true, description: 'With known_as_of: each version also carries a unified diff from the version before it.' };-/** get_page parameters that select a body window, a fuzzy match or an edit view, none of which a historical read serves. */+/** get_page parameters that select a body window, a fuzzy match or an edit view, none of which a historical read serves: a recorded-time read sets them aside and names them (GST-2214: GPT-6.1 Sol fills every one). */const GET_PAGE_UNSUPPORTED = ['fuzzy', 'include_content', 'content_only', 'include_timeline_entries', 'grammar_diagnostics', 'include_quarantined','lines', 'bytes', 'around_chunk_id', 'context_lines', 'cursor', 'max_bytes', 'view', 'outline_from', 'section', 'grep', 'context'] as const;@@ -102,14 +102,11 @@ function ledgerView(read: PageAtTime) {/** `get_page {known_as_of}`: the page at the slug as recorded at the instant, with the interval it was in and whether the ledger certifies it. */export async function getPageKnownAsOf(ctx: OperationContext, p: Record<string, unknown>): Promise<Record<string, unknown>> {const at = parseKnownAsOf(p.known_as_of);- const extra = GET_PAGE_UNSUPPORTED.filter(k => p[k] !== undefined && p[k] !== false);- const badBody = p.body !== undefined && p.body !== 'auto' && p.body !== 'full' && p.body !== 'none';- if (extra.length || badBody) {- const drop: string[] = badBody ? [...extra, 'body'] : extra;+ if (p.body !== undefined && p.body !== 'auto' && p.body !== 'full' && p.body !== 'none') {const name = (k: string) => opTransport(ctx) === 'cli' ? `--${k.replace(/_/g, '-')}` : `\`${k}\``;- const kept = Object.fromEntries(GET_PAGE_AS_OF_ARGS.filter(k => p[k] !== undefined && !drop.includes(k)).map(k => [k, p[k]]));- throw opError('invalid_params', `get_page: known_as_of does not combine with ${extra.length ? extra.join(', ') : `body: ${String(p.body)}`}.`,- `Drop ${drop.map(name).join(', ')} to read the page as recorded at known_as_of, or drop ${name('known_as_of')} for the current page. A recorded-time read takes only ${GET_PAGE_AS_OF_ARGS.slice(2).map(name).join(', ')} (auto, full or none).`,+ const kept = Object.fromEntries(GET_PAGE_AS_OF_ARGS.filter(k => p[k] !== undefined && k !== 'body').map(k => [k, p[k]]));+ throw opError('invalid_params', `get_page: known_as_of does not combine with body: ${String(p.body)}.`,+ `Drop ${name('body')} to read the page as recorded at known_as_of, or drop ${name('known_as_of')} for the current page. A recorded-time read takes only ${GET_PAGE_AS_OF_ARGS.slice(2).map(name).join(', ')} (auto, full or none).`,{ fix: readFix('The same call without the arguments that select a window or view of the current page, which a recorded-time read does not serve.',{ argv: ['gbrain', 'get', ...Object.entries(kept).filter(([k]) => k !== 'slug').flatMap(([k, v]) => v === true ? [`--${k.replace(/_/g, '-')}`] : v === false ? [] : [`--${k.replace(/_/g, '-')}`, String(v)]), '--', String(p.slug)],mcp: { tool: 'get_page', arguments: kept } }) });@@ -119,7 +116,9 @@ export async function getPageKnownAsOf(ctx: OperationContext, p: Record<string,const read = await readAsCaller(ctx, { sourceId, slug, at }, p.include_deleted === true);const current = read.current && (await readable(ctx, read, [read.current], p.min_trust))[0];if (!current || (current.deleted && p.include_deleted !== true)) throw pageNotFoundError(ctx, slug, { includeDeleted: p.include_deleted === true, sourceIdParam: sourceId });- return { ...intervalView(ctx, current, { body: p.body !== 'none', inlineMax: await inlineBodyBytes(ctx) }), ...ledgerView(read) };+ const ignored = GET_PAGE_UNSUPPORTED.filter(k => p[k] !== undefined && p[k] !== false);+ return { ...intervalView(ctx, current, { body: p.body !== 'none', inlineMax: await inlineBodyBytes(ctx) }), ...ledgerView(read),+ ...(ignored.length ? { set_aside: { ignored, note: `Read the whole page as recorded at known_as_of; ignored ${ignored.length > 1 ? `${ignored.slice(0, -1).join(', ')} and ${ignored[ignored.length - 1]}` : ignored[0]}, which read the current page. Drop known_as_of to read a window or view of the current page.` } } : {}) };}/** `get_versions {known_as_of}`: the page's validity intervals known at the instant, newest first; `diff` adds each one's change from the one before it. */diff --git a/src/core/ops/links.ts b/src/core/ops/links.tsindex bd1cd215e9..3bee77e2f5 100644--- a/src/core/ops/links.ts+++ b/src/core/ops/links.ts@@ -510,11 +510,6 @@ const DEFAULT_TRAVERSE_DEPTH = 5;* successful result carrying a `relational_chain` notice with the next call.*/async function traverseChain(ctx: OperationContext, p: Record<string, unknown>, slug: string) {- const conflicts = (['depth', 'link_type', 'direction'] as const).filter(k => p[k] !== undefined);- if (conflicts.length) {- throw opError('invalid_params', `traverse_graph: hops cannot be combined with ${conflicts.join(', ')}.`,- `Drop ${conflicts.map(k => paramUse(ctx, k)).join(' and ')}: each hop already names its link type and direction (toward), and the chain length is the number of hops.`);- }const parsed = validateChainHops(p.hops);if (!parsed.ok) {throw opError('invalid_params', `traverse_graph: ${parsed.path}: ${parsed.problem}.`,@@ -533,11 +528,13 @@ async function traverseChain(ctx: OperationContext, p: Record<string, unknown>,const status = diagnostics.status;const fix = chainFix(slug, status, rawHops, diagnostics.empty_hop);if (status !== 'fired' && fix) ctx.emitNotice?.({ code: 'relational_chain', kind: 'degraded', why: fix.why, fix });+ const ignored = (['depth', 'link_type', 'direction'] as const).filter(k => p[k] !== undefined);return {anchor: slug,answers: answers.map(r => ({ slug: r.slug, source_id: r.source_id, path_count: r.path_count, score: r.score })),paths: answers.map(r => ({ nodes: r.best_path.nodes, edges: r.best_path.edges.map(edge) })),diagnostics,+ ...(ignored.length ? { set_aside: { ignored, note: `Walked the hops chain; ignored ${ignored.length > 1 ? `${ignored.slice(0, -1).join(', ')} and ${ignored[ignored.length - 1]}` : ignored[0]}: each hop names its link type and direction (toward), and the chain length is the number of hops.` } } : {}),};}diff --git a/test/get-page-slices.test.ts b/test/get-page-slices.test.tsindex 69443b6449..2767c88031 100644--- a/test/get-page-slices.test.ts+++ b/test/get-page-slices.test.ts@@ -293,7 +293,7 @@ for (const kind of testBackends()) {expect({ extra, code: e.code }).toEqual({ extra, code: 'invalid_params' });}const historical = await refusal(get({ slug: 'notes/sections', section: 'Goals', known_as_of: '2026-01-01T00:00:00Z' }));- expect(historical.message).toContain('section');+ expect([historical.code, historical.message.includes('section')]).toEqual(['coverage_from', false]);});test('body auto or window with a slice still slices', async () => {diff --git a/test/tool-args-empty-optional-sol.test.ts b/test/tool-args-empty-optional-sol.test.tsindex 404f9b66e4..d184fd6669 100644--- a/test/tool-args-empty-optional-sol.test.ts+++ b/test/tool-args-empty-optional-sol.test.ts@@ -23,6 +23,7 @@ import { handleToolCall } from '../src/mcp/server.ts';import { runRollout } from '../src/core/skillopt/rollout.ts';import { buildWriteCaptureRegistry } from '../src/core/skillopt/write-capture.ts';import { buildBrainTools } from '../src/core/minions/tools/brain-allowlist.ts';+import { enableBeliefLedger } from '../src/core/belief/coverage.ts';import { operations, operationsByName, type Operation, type ParamDef } from '../src/core/operations.ts';import type { BenchmarkTask } from '../src/core/skillopt/types.ts';import type { ToolHandler } from '../src/core/ai/gateway.ts';@@ -97,6 +98,8 @@ function emptied(op: Operation, value: '' | null): Record<string, unknown> {}const summary = (o: Outcome) => (o.ok ? 'ok' : o.code);+/** The result object of an answered call; MCP paths append notice blocks after it. */+const resultJson = (o: Outcome) => JSON.parse(o.text.split('\n[gbrain ')[0]!) as Record<string, unknown>;/** The subagent registry reports a schema failure as a plain Error naming the param; every other path as invalid_params. */const refusal = (o: Outcome) => (!o.ok && (o.code === 'invalid_params' || /^brain_\w+: (Missing required parameter|Parameter ")/.test(o.text)) ? 'invalid_params' : summary(o));@@ -234,13 +237,20 @@ describe('GST-927: schema-ruled-out empty values (0, [], {}, false) read as omitrefusal(await call('get_page', { slug: SLUG, max_bytes: -5 })),refusal(await call('list_write_conflicts', { limit: 101 })),refusal(await call('get_page', { slug: SLUG, lines: { from: 0, count: 2 } })),- refusal(await call('traverse_graph', { slug: SLUG, depth: 1, hops: [{ link_type: 'founded', toward: 'object' }] })),refusal(await call('get_versions', { slug: SLUG, diff: true })),];}const refused = Object.fromEntries(Object.entries(outcomes).map(([k, v]) => [k, v.filter(o => o !== 'not_registered')]));expect(refused).toEqual(Object.fromEntries(Object.entries(outcomes).map(([k, v]) => [k, Array(v.filter(o => o !== 'not_registered').length).fill('invalid_params')])));- expect(refused['mcp remote (http)']).toHaveLength(6);+ expect(refused['mcp remote (http)']).toHaveLength(5);+ const kept: Record<string, string> = {};+ for (const [name, call] of Object.entries(paths)) {+ const out = await call('traverse_graph', { slug: SLUG, depth: 1, hops: [{ link_type: 'founded', toward: 'object' }] });+ kept[name] = out.ok ? JSON.stringify((resultJson(out) as { set_aside?: { ignored: string[] } }).set_aside?.ignored) : summary(out);+ }+ const registered = Object.entries(kept).filter(([, v]) => v !== 'not_registered');+ expect(Object.fromEntries(registered)).toEqual(Object.fromEntries(registered.map(([k]) => [k, '["depth"]'])));+ expect(kept['mcp remote (http)']).toBe('["depth"]');}, 120_000);});@@ -323,22 +333,42 @@ describe("GST-927: GBEV-3's replayed Sol shapes", () => {expect(op.params.context!.description).toContain('Applies only with grep');});- test('known_as_of beside read-view arguments refuses, naming each argument to drop, with a fix that keeps only recorded-time arguments', async () => {- const args = { slug: SLUG, ...SOL_GET_PAGE, known_as_of: '2026-10-01T12:00:00Z', max_bytes: 40000, view: 'read' };+ test("GST-2214: Sol's recorded-time reads with every read-view argument filled read the page as recorded on every entry point, naming what was set aside", async () => {+ await enableBeliefLedger(engine, 'default');+ const at = new Date(Date.now() + 1000).toISOString();+ await Bun.sleep(1100);+ const args = { slug: SLUG, ...SOL_GET_PAGE, known_as_of: at, lines: { from: 1, count: 1 }, bytes: { offset: 0, length: 1 }, include_timeline_entries: true, max_bytes: 40000, view: 'read' };+ const results: Record<string, string> = {};for (const [name, call] of Object.entries(paths)) {const out = await call('get_page', args);- expect([name, refusal(out)]).toEqual([name, 'invalid_params']);- expect(out.text).toContain('get_page: known_as_of does not combine with include_content');+ results[name] = out.ok && out.text.includes(BODY_MARKER) && out.text.includes('"set_aside"') ? 'read' : `${summary(out)}: ${out.text.slice(0, 200)}`;+ }+ expect(results).toEqual(Object.fromEntries(Object.keys(paths).map(k => [k, 'read'])));+ const r = JSON.parse((await paths['mcp remote (http)']!('get_page', args)).text) as { known_as_of: string; window?: unknown; set_aside: Record<string, unknown> };+ expect(r.known_as_of).toBe(at);+ expect(r.window).toBeUndefined();+ expect(r.set_aside).toEqual({ ignored: ['include_content', 'include_timeline_entries', 'lines', 'bytes', 'context_lines', 'max_bytes', 'view', 'outline_from'],+ note: 'Read the whole page as recorded at known_as_of; ignored include_content, include_timeline_entries, lines, bytes, context_lines, max_bytes, view and outline_from, which read the current page. Drop known_as_of to read a window or view of the current page.' });+ const plain = JSON.parse((await paths['mcp remote (http)']!('get_page', { slug: SLUG, known_as_of: at })).text) as Record<string, unknown>;+ expect(plain.set_aside).toBeUndefined();+ const { set_aside: _, ...served } = r;+ expect(served as Record<string, unknown>).toEqual(plain);+ });++ test('GST-2214: traverse_graph with hops beside depth, link_type and direction walks the chain on every entry point, naming what was set aside', async () => {+ const hops = [{ link_type: 'founded', toward: 'object' }];+ const results: Record<string, string> = {};+ for (const [name, call] of Object.entries(paths)) {+ const sol = await call('traverse_graph', { slug: SLUG, depth: 1, link_type: 'founded', direction: 'both', hops, source_id: 'default', all_sources: false });+ const chain = await call('traverse_graph', { slug: SLUG, hops, source_id: 'default', all_sources: false });+ if (summary(sol) === 'not_registered') continue;+ const { set_aside, ...rest } = sol.ok ? resultJson(sol) : {};+ results[name] = sol.ok && chain.ok && JSON.stringify(rest) === JSON.stringify(resultJson(chain)) ? JSON.stringify(set_aside) : `${summary(sol)}: ${sol.text.slice(0, 200)}`;}- expect((await paths['mcp remote (http)']!('get_page', args)).text).toContain('known_as_of does not combine with include_content, context_lines, max_bytes, view, outline_from.');- const remote = JSON.parse((await dispatchToolCall(engine, 'get_page', args, { remote: true, transport: 'http', sourceId: 'default' })).content[0]!.text) as { suggestion?: string };- expect(remote.suggestion).toContain('Drop `include_content`, `context_lines`, `max_bytes`, `view`, `outline_from` to read the page as recorded');- const local = await handleToolCall(engine, 'get_page', args).then(() => null, (e: { suggestion?: string; fix?: { mcp?: { tool: string; arguments: Record<string, unknown> } } }) => e);- expect(local?.suggestion).toContain('Drop --include-content, --context-lines, --max-bytes, --view, --outline-from to read the page as recorded');- expect((local as { fix?: { argv?: string[] } } | null)?.fix?.argv).toEqual(['gbrain', 'get', '--known-as-of', '2026-10-01T12:00:00Z', '--source-id', 'default', '--body', 'full', '--', SLUG]);- expect(local?.fix?.mcp).toEqual({ tool: 'get_page', arguments: { slug: SLUG, known_as_of: '2026-10-01T12:00:00Z', source_id: 'default', include_deleted: false, body: 'full' } });- const retried = await dispatchToolCall(engine, 'get_page', local!.fix!.mcp!.arguments, { remote: true, transport: 'http', sourceId: 'default' });- expect(retried.content[0]!.text).not.toContain('does not combine with');+ const want = JSON.stringify({ ignored: ['depth', 'link_type', 'direction'],+ note: 'Walked the hops chain; ignored depth, link_type and direction: each hop names its link type and direction (toward), and the chain length is the number of hops.' });+ expect(results['mcp remote (http)']).toBe(want);+ expect(results).toEqual(Object.fromEntries(Object.keys(results).map(k => [k, want])));});});diff --git a/test/traverse-graph-hops.test.ts b/test/traverse-graph-hops.test.tsindex d921bd6a33..f8acd3943f 100644--- a/test/traverse-graph-hops.test.ts+++ b/test/traverse-graph-hops.test.ts@@ -2,8 +2,9 @@* traverse_graph `hops` (agent-structured typed chains), through the real MCP* dispatcher for remote callers and the op handler for trusted local callers.*- * Protects: a 1-3 hop chain returns answers with evidence edges; bad hops and- * conflicting params are `invalid_params`, never silently ignored; a chain that+ * Protects: a 1-3 hop chain returns answers with evidence edges; bad hops are+ * `invalid_params`, and depth/link_type/direction beside hops are set aside and+ * named in `set_aside` (GST-2214), never silently ignored; a chain that* finds nothing distinguishes an invisible start page from missing edges and* names the next call; remote callers never see private pages or raw context* beyond the sanitized excerpt; a granted token cannot reach another source.@@ -83,15 +84,22 @@ describe('traverse_graph hops', () => {expect(ctx.length).toBeLessThanOrEqual(160);});- test('invalid hops and conflicting params are invalid_params with the exact problem', async () => {+ test('invalid hops are invalid_params with the exact problem', async () => {await expect(runLocal({ slug: 'people/alice-example', hops: [{ link_type: 'mentions', toward: 'object' }] })).rejects.toMatchObject({ code: 'invalid_params', message: expect.stringContaining('hops[0].link_type') });await expect(runLocal({ slug: 'people/alice-example', hops: [{ link_type: 'founded', toward: 'in' }] })).rejects.toMatchObject({ code: 'invalid_params', message: expect.stringContaining('hops[0].toward') });await expect(runLocal({ slug: 'people/alice-example', hops: [...HOPS, ...HOPS] })).rejects.toMatchObject({ code: 'invalid_params', message: expect.stringContaining('at most 3 hops') });- await expect(runLocal({ slug: 'people/alice-example', hops: HOPS, depth: 2, link_type: 'founded' }))- .rejects.toMatchObject({ code: 'invalid_params', message: expect.stringContaining('depth, link_type') });+ });++ test('depth and link_type beside hops walk the same chain and are named in set_aside, never silently dropped', async () => {+ const chain = await runLocal({ slug: 'people/alice-example', hops: HOPS });+ const { set_aside, ...rest } = await runLocal({ slug: 'people/alice-example', hops: HOPS, depth: 2, link_type: 'founded' });+ expect(rest).toEqual(chain);+ expect(chain.set_aside).toBeUndefined();+ expect(set_aside).toEqual({ ignored: ['depth', 'link_type'],+ note: 'Walked the hops chain; ignored depth and link_type: each hop names its link type and direction (toward), and the chain length is the number of hops.' });});test('anchor_not_found, no_edges and empty_hop each carry a notice with the next call', async () => {