Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(#6712 PR 4b): a parser regression holds the file by default (GBRA-108 default flip)
garrytanfd74b78e0e40
diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 18ca058d42..a6d424e016 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -2620,7 +2620,7 @@ More: [docs/guides/windowed-reads.md#page_too_large_for_inline](../../docs/guide| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable ||---|---|---|---|---|---|---|-| A file whose exact bytes imported before is now refused by gbrain's frontmatter reader. | The same bytes imported under an earlier gbrain version, so only gbrain changed; with `GBRAIN_SYNC_PARSER_REGRESSION=hold` for the process that syncs, such a file is held and the rest of the sync continues. | Report it as a gbrain bug with the gbrain version, the file and the code; upgrade or pin the last good version, then sync again. | host_admin | `gbrain doctor --json` | 1 | no |+| A file whose exact bytes imported before is now refused by gbrain's frontmatter reader. | The same bytes imported under an earlier gbrain version, so only gbrain changed; such a file is held and the rest of the sync continues (`GBRAIN_SYNC_PARSER_REGRESSION=stop` for the process that syncs stops the run instead). | Report it as a gbrain bug with the gbrain version, the file and the code; upgrade or pin the last good version, then sync again. | host_admin | `gbrain doctor --json` | 1 | no |### pasted_wrong_url@@ -3736,7 +3736,7 @@ Reasons: `content_directory`.| Meaning | Why | Next step | Who acts · consent | Verify | Exit | Retryable ||---|---|---|---|---|---|---|-| Sync stopped because gbrain would hold a file whose exact bytes imported before; this is a gbrain bug. | The upgrade invariant says a newer reader never refuses bytes an older one imported, so the run stops without advancing rather than hide a regression. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then run gbrain sync --source <id> --no-pull. | host_admin | `gbrain doctor --json` | 1 | no |+| Sync stopped because gbrain would hold a file whose exact bytes imported before; this is a gbrain bug. | The upgrade invariant says a newer reader never refuses bytes an older one imported; with `GBRAIN_SYNC_PARSER_REGRESSION=stop` set for the process that syncs (the default holds the file), the run stops without advancing rather than hide a regression. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then run gbrain sync --source <id> --no-pull. | host_admin | `gbrain doctor --json` | 1 | no |### tail_exposure_approvaldiff --git a/docs/guides/live-sync.md b/docs/guides/live-sync.mdindex edfa7047e2..ee4ca734df 100644--- a/docs/guides/live-sync.md+++ b/docs/guides/live-sync.md@@ -155,7 +155,7 @@ Timing knobs the drain uses:| `sync.hold_cap` | `GBRAIN_SYNC_HOLD_CAP` | 500 || `sync.hold_escalate_count` | `GBRAIN_SYNC_HOLD_ESCALATE_COUNT` | 50 || `sync.hold_escalate_pct` | `GBRAIN_SYNC_HOLD_ESCALATE_PCT` | 5 |-| `sync.parser_regression` | `GBRAIN_SYNC_PARSER_REGRESSION` | stop |+| `sync.parser_regression` | `GBRAIN_SYNC_PARSER_REGRESSION` | hold || `sync.knock_on_refreeze_limit`, `sync.knock_on_run_limit` | none (removed with the knock-on re-freeze in 0.60.255.0) | — |`gbrain config set` of a retired key warns, names the variable and writes nothing. `gbrain config get <key>` printsdiff --git a/docs/guides/repair.md b/docs/guides/repair.mdindex 406f484590..86a75d416d 100644--- a/docs/guides/repair.md+++ b/docs/guides/repair.md@@ -2137,7 +2137,7 @@ environment of the process that syncs and replace the `sync.hold_*` and `sync.pa| `sync.holds` | `hold` | `fail` makes sync fail closed: a content refusal blocks the sync. || `GBRAIN_SYNC_HOLD_CAP` | `500` | How many holds a sync result lists in detail; storage is never capped and valid files always import. || `GBRAIN_SYNC_HOLD_ESCALATE_COUNT` / `GBRAIN_SYNC_HOLD_ESCALATE_PCT` | `50` / `5` | A source holding more files, or a run holding more than that share of at least 40 screened imports, reports `holds_escalated` and doctor `git_held_files` fails. A run whose `preparation_stalled` holds would cross it stops as `preparation_systemic` instead of holding them. |-| `GBRAIN_SYNC_PARSER_REGRESSION` | `stop` | `hold` holds a file whose exact bytes imported under an earlier gbrain (`parser_regression`) instead of stopping the run with `sync_parser_regression`. |+| `GBRAIN_SYNC_PARSER_REGRESSION` | `hold` | A file whose exact bytes imported under an earlier gbrain is held (`parser_regression`) and the rest syncs; `stop` stops the run with `sync_parser_regression` instead. |To prevent new broken files, write brain files through `put_page`/`capture`or a YAML serializer, check generated content withdiff --git a/docs/guides/write-refusals.md b/docs/guides/write-refusals.mdindex 81f0047976..fe8e48cd69 100644--- a/docs/guides/write-refusals.md+++ b/docs/guides/write-refusals.md@@ -212,12 +212,12 @@ with each file and fix the ones that need no guessing."*| <a id="concurrent_write"></a>`concurrent_write` | Managed sync was importing a newer Git version of the file while a database-only write (write-through off, a sandboxed or derived write) committed a different version of the same page, so the two diverge (#6194). The proof is the page's revision itself: it was written by a committed non-sync request for that page. Neither version was overwritten: the page keeps the database version, the file is held and the rest of the source syncs. Since #6340 a page that moved with no such request to name is held the same way (the hold records `page_revision` and `expected_revision` instead of a competing request), and so is a page that changed, was deleted or was re-bound in the database between the manifest freeze and the entry's turn; a page that still holds exactly what the file would import is re-bound to its new revision and passed. | `gbrain sources status <source>` names the page and the competing request. Preview with `gbrain sources reconcile <source> <slug> --preview`, decide with the user which content wins, apply the resolved preview, then `gbrain sources retry-held <source>` and `gbrain sync --source <source> --no-pull` re-screen the file. A new commit of the file re-screens it too. || <a id="file_drift"></a>`file_drift` | Managed sync would have imported a file over a database version of its page that sync never saw (#6712). Every import records its provenance (the bytes left on disk, the page revision it wrote, the parser); a page that moved since that record (a database-only write, write-through off) while its file did not change, or, in a tree walk (first sync, `--full`, an unreachable checkpoint), a page whose file and revision both moved or that has no usable record (an upgraded brain: none, a pre-PR 0 record, a partial one), is imported only when the import changes nothing, a sync request wrote its current revision, or its writer's write-through wrote that revision to the file. Otherwise the file is held, the page keeps the database version and the rest of the source syncs. The hold names `sides` (`database`, `both`, `unknown`) and the database request that wrote the page when there was one; a hold the live pass writes also names its Decision, `side` (`both`, `unknown`, `deleted`) and, for a deleted side, `state` (`tombstone_edited`, `purged_differs`, `file_gone`). Pages under `storage.keep_db` prefixes whose file is clean in committed mode are not held: the pass writes the database copy back to the file (at most 200 per pass, the rest the next pass); an uncommitted edit there is held. Holds of this code never escalate; with `sync.holds=fail` the run stops with `file_drift` instead of holding. | `gbrain sources status <source>` names the page. Preview `gbrain repair file-drift --source <source> --slug <slug> --prefer database` (keep the database copy, rewrite the file) or `--prefer file` (import the file), decide with the user, apply it with the plan hash, then `gbrain sync --source <source> --no-pull`. Held pages of one Decision resolve together with [`--held --side <side> [--state <state>]`](repair.md#file-drift-held). A changed file or page revision re-screens the hold by itself. || <a id="frontmatter_alias_limit"></a>`frontmatter_alias_limit` | A file whose exact bytes an older gbrain imported and validated nests YAML aliases in its frontmatter that expand past the size limit (#7018). This release refuses them on purpose, so only that file is held (its page keeps the last imported version) and the rest of the source syncs; it is never a parser regression. | Reduce the alias nesting in the frontmatter (or write the values out), or remove the file, then commit and `gbrain sync --source <source> --no-pull`. The hold re-screens when the file changes. Before 4b such a file stopped the source as `sync_parser_regression`; the workaround there was `GBRAIN_SYNC_PARSER_REGRESSION=hold` for the process that syncs. |-| <a id="parser_regression"></a>`parser_regression` | With `GBRAIN_SYNC_PARSER_REGRESSION=hold`, a file whose exact bytes imported under an earlier gbrain is now refused. This is a gbrain bug. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version. After a fixed gbrain is installed, `gbrain sources retry-held <source>` and then `gbrain sync --source <source> --no-pull` re-screen it. |+| <a id="parser_regression"></a>`parser_regression` | A file whose exact bytes imported under an earlier gbrain is now refused. It is held and the rest of the source syncs (the default; `GBRAIN_SYNC_PARSER_REGRESSION=stop` stops the run instead). This is a gbrain bug. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version. After a fixed gbrain is installed, `gbrain sources retry-held <source>` and then `gbrain sync --source <source> --no-pull` re-screen it. || <a id="settle_mismatch"></a>`settle_mismatch` | A live managed sync pass settled this file at the same level in three consecutive passes, but the next round never classified it settled (#6712). Instead of re-importing it every pass, sync held it at that level and stamped the rest of the source. The hold records the level and `meta.mismatch_streak`. The file is usually fine: a path that keeps coming back unsettled points to a broken writer, a stuck effect or a damaged record. | Run `gbrain doctor --json` and `gbrain sources writer status --source <source> --json` (both read-only), fix or report what they name with the gbrain version, then `gbrain sources retry-held <source>` and `gbrain sync --source <source> --no-pull`. A mismatch that comes back is held again after three passes. || <a id="write_interrupted-hold"></a>`write_interrupted` | The database ended this file's statements (a statement timeout or cancel) at every attempt, so the sync held the file and kept going. The file is fine: no repair applies, and it is not imported until it is retried. Full reference: [`write_interrupted`](#write_interrupted). | `gbrain sources writer status --source <source> --json` (read-only) names the load on the write owner; reduce it, then `gbrain sources retry-held <source>` and the same sync with its options. || <a id="preparation_stalled-hold"></a>`preparation_stalled` | The write for this file could not finish *preparing* within its attempt limit, so the sync held the file and kept going. The file is fine: no repair applies, and it is not imported until it is retried. Full reference: [`preparation_stalled`](#preparation_stalled). | `gbrain sources writer status --source <source> --json` (read-only), fix what it names, then `gbrain sources retry-held <source>` and the same sync with its options. Runbook: [catch-up stuck / held N files](troubleshooting.md#catch-up-stuck). || <a id="worktree_dirty"></a>`worktree_dirty` | The working tree holds uncommitted bytes for this file that match neither the pinned commit nor the current page (an agent mid-edit on a live checkout), and importing the pinned version would discard them (#6340). Before this release the refusal (`source_changed` / `pinned_git_worktree_conflict`) stopped the whole run; now the file is held, the local edit is untouched and the rest of the source syncs. The hold keeps the pinned blob (`meta.blob_oid`) and a hash of the working bytes, counts `meta.attempts` each time the same file is held again, and a page held three times is reported `needs_human` by `gbrain sync status`. Bytes that are **committed at HEAD** past the pinned target are not a conflict at all: sync imports them as HEAD has them and the later pin..HEAD diff re-imports the same bytes as a no-op. Since 0.60.179.0 (#6513) the same hold covers a pinned import whose canonical correction (a fixable fence, reflowed frontmatter) would rewrite a file that holds newer uncommitted bytes: that refusal used to block the cursor with no exit, because `--retry-failed` replays the same pin against the same bytes, `sources refresh` refuses `sync_in_progress` on the unfinished cursor and `--acknowledge-managed` refuses `cursor_unfinished`. Working-tree bytes that already *are* the correction (gbrain's own writeback, published before the request that carried it settled) are not a conflict either: the page imports and the file is left as it is. | Commit the edit (or restore the file), then `gbrain sync unblock --source <source> --apply` re-screens every held file that is now committed and prints the sync to run (`gbrain sources retry-held <source>` does the same for all holds). A later commit that changes the file re-screens it on its own. Never discard or normalize the local bytes. Runbook: [sync unblock](sync-unblock-runbook.md). |-| <a id="sync_parser_regression"></a>`sync_parser_regression` | Sync stopped without advancing because it would hold a file whose exact bytes imported before (default `GBRAIN_SYNC_PARSER_REGRESSION=stop`). This is a gbrain bug, not a content problem. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then `gbrain sync --source <source> --no-pull`. To keep syncing meanwhile, `gbrain config set sync.parser_regression hold` (ask the user). |+| <a id="sync_parser_regression"></a>`sync_parser_regression` | Sync stopped without advancing because it would hold a file whose exact bytes imported before, and `GBRAIN_SYNC_PARSER_REGRESSION=stop` (opt-in; the default holds the file) is set for the process that syncs. This is a gbrain bug, not a content problem. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then `gbrain sync --source <source> --no-pull`. To keep syncing meanwhile, unset `GBRAIN_SYNC_PARSER_REGRESSION` for the process that syncs (ask the user). || <a id="takes_holder_invalid"></a>takes holder (`invalid_params`) | `takes_add`, or `takes_supersede` with an explicit `holder`, was given a holder the takes fence cannot carry: empty, whitespace, or not `world`, `brain`, `people/<slug>` or `companies/<slug>` (a legacy bare slug is accepted). The value is trimmed first, so `" world "` is stored as `world`. Nothing was written: before this release such a holder was published into the fence and every later takes write on that page was refused `target_fence_malformed`. A supersede without an override keeps the row's stored holder. A page whose stored holder is already malformed still refuses every takes write (`invalid_fence`); `gbrain repair fences` is the way out. | Resend with a holder in that grammar (`holder: me` on the brain host resolves the owner's holder). For a page already carrying a malformed holder, preview `gbrain repair fences --slug <slug>` and apply it, or edit the `who` cell by hand. Format: [holders](fence-format.md#holders). || <a id="changed_since_preview"></a>`changed_since_preview` | A hash-bound repair apply (`gbrain repair frontmatter --apply --expect <hash>`, `gbrain repair fences --apply --expect <hash>`, `gbrain repair content --apply --expect <h1>[,<h2>]`) found a file, its proposed change or its page different from what the preview showed, so that item was not written; the rest of the approved set still applied. | Preview again with the same selection and apply the new hash (for the content lane, one hash per kind in lane order). For frontmatter, show the user the new diff first; a fence repair needs no extra consent ([fence reason](#fence-changed_since_preview)). |diff --git a/llms-full.txt b/llms-full.txtindex 1f98f13fd8..a1251d9b86 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -6916,7 +6916,7 @@ Timing knobs the drain uses:| `sync.hold_cap` | `GBRAIN_SYNC_HOLD_CAP` | 500 || `sync.hold_escalate_count` | `GBRAIN_SYNC_HOLD_ESCALATE_COUNT` | 50 || `sync.hold_escalate_pct` | `GBRAIN_SYNC_HOLD_ESCALATE_PCT` | 5 |-| `sync.parser_regression` | `GBRAIN_SYNC_PARSER_REGRESSION` | stop |+| `sync.parser_regression` | `GBRAIN_SYNC_PARSER_REGRESSION` | hold || `sync.knock_on_refreeze_limit`, `sync.knock_on_run_limit` | none (removed with the knock-on re-freeze in 0.60.255.0) | — |`gbrain config set` of a retired key warns, names the variable and writes nothing. `gbrain config get <key>` printsdiff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.tsindex b94077f59d..94fa3d53d2 100644--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@ -928,6 +928,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;{ since: '0.60.300.0', text: 'A managed sync pass that runs 4 rounds without the source settling (another writer keeps changing it) stops `not_converged`: outcome `resumable`, exit 0, everything it admitted stands, and `next` reruns the same sync. After 3 such passes in a row, `next` switches to a report: `gbrain sync status --source <id> --json` with `safe_to_loop: false` and `fix.next: report`, and a sync job ends needing an operator, so an agent loop stops instead of retrying. The count resets when a pass converges.' },{ since: '0.60.300.0', text: 'New explicit repair `gbrain repair legacy-twins --source <id>` (#6885) merges the page pairs syncs before #6857 forked: a legacy page with no recorded file whose slug spells the file\'s name differently from today\'s slug rules, and the twin at today\'s slug that records the file. The read-only preview lists each pair (both pages\' ids, slugs and revisions, the file, whether the contents match) and lists as decisions, never merged, pairs whose contents differ, several legacy pages for one twin, twins whose file is missing or drifted, and twins holding a link, relationship date, timeline entry or raw data row the legacy page holds differently (`twin_evidence_conflicts`). `--apply --expect <hash> --yes` merges exactly the approved pairs: the legacy page takes over the file and keeps its id, links and history, the twin\'s links and their dated transitions, timeline, raw data, user-added tags, aliases and the facts other pages state about it move over through the same twin merge as `gbrain repair origin-twins` (#6948), its slug becomes an alias, and the twin is soft-deleted (its file untouched) and purged after 72 hours. It refuses off the owner host (`not_owner_host`), when the checkout cannot be read (`legacy_twins_storage_unknown`), and when the pairs are more than half of a source\'s file-backed pages (`legacy_twin_mass_merge_refused`, unless `GBRAIN_ALLOW_MASS_RECONCILE=1`). Nothing changes on upgrade; it runs only when named.' },{ since: '0.60.300.0', text: 'A managed sync of a non-company source that cannot decide which page a file is no longer stops the whole source with `page_identity_changed`: the file alone is held `page_identity_changed` (it needs a person; `meta.reason` names why) and the rest of the source syncs. `several_tombstones`: several deleted pages record the file as their origin; `spelling`: files differing only by letter case or separator (both are held); `identity_differs`: a file whose frontmatter id differs from the page at its slug, which keeps its id, body and slug while its old file\'s deletion waits. A dry run (and a company source) still refuses the source as before, so `gbrain sync --dry-run` reports a refusal where the sync itself holds one file; a remote sync leaves such files for the owner\'s sync to hold.' },+ { since: '0.60.300.0', text: 'A file whose exact bytes an earlier gbrain imported and validated, and which this release refuses (a parser regression), no longer stops the sync by default: it is held `parser_regression` alone (a gbrain bug to report; it needs a person) and the rest of the source syncs. `GBRAIN_SYNC_PARSER_REGRESSION=stop` for the process that syncs restores the old stop (`sync_parser_regression`, the checkpoint does not advance). A refusal this release makes on purpose, such as the YAML alias bound (`frontmatter_alias_limit`), is held as before under either setting.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 88905767a3..fdc902e100 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -451,7 +451,7 @@ export const CODES = {page_too_large_for_inline: { class: 'caller', summary: "The whole page does not fit one result on this connection, so get_page did not return its body.", why: "A result is measured as the complete encoded frame; a body over the connection's cap (mcp.max_result_bytes_stdio, 4 MiB; mcp.max_result_bytes_http, 1 MiB) would be cut or rejected by the client. Nothing was truncated: windowed reads cover the whole page in pieces.", docs: 'docs/guides/windowed-reads.md#page_too_large_for_inline', legacy_error: 'invalid_params', suggestion: "Read the outline (body: 'outline'), then windows (body: 'window' with lines, bytes, around_chunk_id or the returned next_cursor). To replace the page, edit it with edit_page and the revision from body: 'none'.", fix: { argv: ['gbrain', 'get', '--source', '{source_id}', '--', '{slug}'], mcp: { tool: 'get_page', arguments: { slug: '{slug}', source_id: '{source_id}', body: 'outline' } }, consent: [], actor: 'agent', why: "Returns the page's size, revision and outline; each entry names the lines to read with body: 'window'.", requires_exclusive: false, verify: { mcp: { tool: 'get_page', arguments: { slug: '{slug}', source_id: '{source_id}', body: 'none' } } } } },parse_error: { class: 'caller', summary: "The request body is not valid JSON." },frontmatter_alias_limit: { class: 'caller', summary: "A file an older gbrain imported nests YAML aliases in its frontmatter that expand past the size limit, so sync holds it alone.", why: "#7018 bounds YAML alias expansion on purpose (a few hundred bytes of nested anchors expand into gigabytes), so refusing bytes an older gbrain imported is intended, not a parser regression: the page keeps its last imported version and the rest of the source syncs.", suggestion: 'Reduce the alias nesting in the frontmatter (or write the values out), or remove the file, then commit and sync again.' },- parser_regression: { class: 'server', summary: "A file whose exact bytes imported before is now refused by gbrain's frontmatter reader.", why: "The same bytes imported under an earlier gbrain version, so only gbrain changed; with `GBRAIN_SYNC_PARSER_REGRESSION=hold` for the process that syncs, such a file is held and the rest of the sync continues.", suggestion: 'Report it as a gbrain bug with the gbrain version, the file and the code; upgrade or pin the last good version, then sync again.' },+ parser_regression: { class: 'server', summary: "A file whose exact bytes imported before is now refused by gbrain's frontmatter reader.", why: "The same bytes imported under an earlier gbrain version, so only gbrain changed; such a file is held and the rest of the sync continues (`GBRAIN_SYNC_PARSER_REGRESSION=stop` for the process that syncs stops the run instead).", suggestion: 'Report it as a gbrain bug with the gbrain version, the file and the code; upgrade or pin the last good version, then sync again.' },pasted_wrong_url: { class: 'caller', summary: "Google connect credential error: pasted wrong url.", docs: 'docs/guides/google-connect.md#troubleshooting' },payload_too_large: { class: 'caller', summary: "The payload exceeds the configured size cap." },pattern_claims_pending: { class: 'retryable', summary: "An existing pattern page is waiting on the rewrite that de-duplicates its claim sources, so no patterns child was submitted this run.", why: "The patterns child reads existing pattern pages; until their claim records reference one shared reflection list, the pages can overflow the model's window and the run pays for nothing.", fix: { argv: ['gbrain', 'write-requests', '--source', '{source_id}'], consent: [], actor: 'agent', why: 'Lists the write receipts of the source, newest first, so the held rewrites show, read-only.', requires_exclusive: false } },@@ -654,7 +654,7 @@ export const CODES = {sync_cursor_replaced: { class: 'caller', summary: "Another sync run of the source replaced the managed-sync cursor before this checkpoint published, so the checkpoint had nothing left to publish.",why: "The replacing run (a rediscovery that retried a recorded failure, or a newer sync of the source) covers the source from its own discovery; the superseded checkpoint's receipt is a conflict, no managed-sync failure is recorded for it, and the run that awaited it goes on with the winning cursor. A same-run index lag still reports revision_conflict.",suggestion: 'Nothing to repair: let the current sync finish. gbrain sync status --source <id> --json shows the cursor that now covers the source.' },- sync_parser_regression: { class: 'server', summary: "Sync stopped because gbrain would hold a file whose exact bytes imported before; this is a gbrain bug.", why: "The upgrade invariant says a newer reader never refuses bytes an older one imported, so the run stops without advancing rather than hide a regression.", suggestion: 'Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then run gbrain sync --source <id> --no-pull.' },+ sync_parser_regression: { class: 'server', summary: "Sync stopped because gbrain would hold a file whose exact bytes imported before; this is a gbrain bug.", why: "The upgrade invariant says a newer reader never refuses bytes an older one imported; with `GBRAIN_SYNC_PARSER_REGRESSION=stop` set for the process that syncs (the default holds the file), the run stops without advancing rather than hide a regression.", suggestion: 'Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then run gbrain sync --source <id> --no-pull.' },tail_exposure_approval: { class: 'caller', summary: "A fence on a world-visible page has no end marker and prose follows its table; closing it after the last row is safe for the table but makes those lines visible to remote readers, so the content-repair lane previews the close and waits for a hash-bound approval instead of applying it unattended.", why: "Everything after an unpaired begin marker is hidden by the privacy boundary. The repair model read the tail as prose (not rows), so the only judgment left is whether those exact lines may become visible, and that is the user's: the preview prints them and the hash binds them. On a private page nothing new is disclosed and the lane closes the fence by itself.", actor: 'user', docs: 'docs/guides/write-refusals.md#tail_exposure_approval', suggestion: 'Show the user the preview\'s exposed lines (gbrain repair content --source <id> --only <path>, read-only), then run the printed gbrain repair content --source <id> --only <path> --apply --expect <hash> only after they agree; a changed tail invalidates the hash. By hand: add the end marker directly after the last table row and move the trailing text where it belongs, commit, then gbrain sync --source <id> --no-pull.' },take_row_collision: { class: 'caller', summary: "A takes fence row number is already used by a different take that is not in this page's canonical fence." },target_escape: { class: 'caller', summary: "The skill target must remain within its selected root." },diff --git a/src/core/persistence/sync-holds.ts b/src/core/persistence/sync-holds.tsindex 6eb5a646a4..e833e876ea 100644--- a/src/core/persistence/sync-holds.ts+++ b/src/core/persistence/sync-holds.ts@@ -985,7 +985,7 @@ export interface SyncHoldPolicy {cap: number;escalateCount: number;escalatePct: number;- /** What a refusal of bytes that imported before does: stop the run (default) or hold it as `parser_regression`. */+ /** What a refusal of bytes that imported before does: hold it as `parser_regression` (default) or, with `GBRAIN_SYNC_PARSER_REGRESSION=stop`, stop the run. */parserRegression: 'stop' | 'hold';}@@ -1001,7 +1001,7 @@ export async function readSyncHoldPolicy(engine: Pick<BrainEngine, 'getConfig'>,return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;};return { mode: mode === 'fail' ? 'fail' : 'hold', cap: Math.floor(number('sync.hold_cap', GIT_HOLD_CAP)), escalateCount: number('sync.hold_escalate_count', GIT_HOLD_ESCALATE_COUNT),- escalatePct: number('sync.hold_escalate_pct', GIT_HOLD_ESCALATE_PCT), parserRegression: retiredSyncSetting('sync.parser_regression', env).toLowerCase() === 'hold' ? 'hold' : 'stop' };+ escalatePct: number('sync.hold_escalate_pct', GIT_HOLD_ESCALATE_PCT), parserRegression: retiredSyncSetting('sync.parser_regression', env).toLowerCase() === 'stop' ? 'stop' : 'hold' };}/** More holds than the source should carry, or too large a share of this run's screened imports. */@@ -1012,8 +1012,9 @@ export function holdsEscalated(policy: Pick<SyncHoldPolicy, 'escalateCount' | 'e/*** Import provenance of a page synced from a file: the exact bytes it imported- * and the gbrain that validated them. The parser-regression stop fires only- * when a newer gbrain refuses bytes this record says imported validated.+ * and the gbrain that validated them. A parser regression (held by default,+ * stopped under GBRAIN_SYNC_PARSER_REGRESSION=stop) is only a newer gbrain+ * refusing bytes this record says imported validated.*/export interface SyncImportProvenance {source_id: string;diff --git a/src/core/persistence/sync-screen.ts b/src/core/persistence/sync-screen.tsindex 348f8c6fb0..ef76358bfc 100644--- a/src/core/persistence/sync-screen.ts+++ b/src/core/persistence/sync-screen.ts@@ -3,10 +3,11 @@* sync screen (`screenSyncImport`) would refuse is held instead of admitted:* the caller writes the hold and advances the cursor in one transaction. A* pinned Git blob over the sync read bound is held by its size before its- * content is loaded. `sync_parser_regression` stops the run only when the- * page's import provenance proves the exact bytes imported validated before- * and the refusal is not one this release makes on purpose (an intended- * refusal, such as #7018's alias bound, holds that page alone).+ * content is loaded. A parser regression is a refusal of bytes the page's+ * import provenance proves imported validated before that this release does+ * not make on purpose (an intended refusal, such as #7018's alias bound, holds+ * that page alone): it is held `parser_regression` by default, and stops the run+ * with `sync_parser_regression` only under GBRAIN_SYNC_PARSER_REGRESSION=stop.* Dry runs screen every pending import read-only with batched Git reads.* #6188: the screen runs with `fences: 'coordinated'` (see `screenSyncImport`):* a fence Tier 1 rewrites losslessly is admitted (publication commits the@@ -307,8 +308,8 @@ export async function screenFrozenContent(screenInput: SyncImportScreenInput, ru/*** The hold a frozen import earns, or null to admit it. Throws- * `sync_parser_regression` (policy `stop`) when gbrain would hold bytes the- * page's provenance says a validating gbrain imported.+ * `sync_parser_regression` (policy `stop`, opt-in) when gbrain would hold bytes+ * the page's provenance says a validating gbrain imported.*/export async function screenFrozenImport(engine: BrainEngine, input: FrozenImportScreen, run: SyncScreenRun): Promise<HeldEntry | null> {const { entry, slug, pageId, snapshot, content, blob } = input;@@ -344,10 +345,10 @@ export async function screenFrozenImport(engine: BrainEngine, input: FrozenImpor+ `imported these exact bytes. ${intended.fix} The rest of the source keeps syncing.` }, content, blob);}const why = `gbrain ${VERSION} refuses ${entry.path} (${refusal.reason ?? 'yaml_parse'}${refusal.line !== undefined ? `, line ${refusal.line}` : ''}), but gbrain ${provenance.gbrain_version} imported these exact bytes and validated them.`;- if (run.policy.parserRegression === 'hold') return heldEntry(entry, slug, pageId, { code: 'parser_regression', message: `${why} Held under GBRAIN_SYNC_PARSER_REGRESSION=hold.` }, content, blob);+ if (run.policy.parserRegression === 'hold') return heldEntry(entry, slug, pageId, { code: 'parser_regression', message: `${why} Held; the rest of the source keeps syncing.` }, content, blob);throw opError('sync_parser_regression', `Sync stopped: ${why}`,`This is a gbrain bug. Report it with the gbrain version (${VERSION}), the file (${entry.path}) and the code (${refusal.code}${refusal.reason ? `/${refusal.reason}` : ''}). `- + `Upgrade, or pin the last good version (${provenance.gbrain_version}), then run: ${input.retryCommand}. To hold such files and let the rest sync meanwhile, the user can set GBRAIN_SYNC_PARSER_REGRESSION=hold for the process that syncs.`,+ + `Upgrade, or pin the last good version (${provenance.gbrain_version}), then run: ${input.retryCommand}. Sync stopped because GBRAIN_SYNC_PARSER_REGRESSION=stop is set for the process that syncs; without it (the default) such a file is held and the rest syncs.`,{ fix: { argv: ['gbrain', 'doctor', '--json'], consent: [], actor: 'agent', requires_exclusive: false,why: 'Collects the gbrain version and brain health to attach to the bug report; the sync checkpoint did not advance past this file.' } });}diff --git a/src/core/sync-config-keys.ts b/src/core/sync-config-keys.tsindex 7b0751d902..e963a48226 100644--- a/src/core/sync-config-keys.ts+++ b/src/core/sync-config-keys.ts@@ -42,8 +42,8 @@ export const RETIRED_SYNC_KEYS = {replacement: { env: 'GBRAIN_SYNC_HOLD_ESCALATE_COUNT', default: '50' } },'sync.hold_escalate_pct': { key: 'sync.hold_escalate_pct', retired_in: '0.60.266.0', tuned: 'the share of a run\'s screened imports above which it escalates, in percent',replacement: { env: 'GBRAIN_SYNC_HOLD_ESCALATE_PCT', default: '5' } },- 'sync.parser_regression': { key: 'sync.parser_regression', retired_in: '0.60.266.0', tuned: 'whether sync stops (stop) or holds the file (hold) when bytes that imported before are refused',- replacement: { env: 'GBRAIN_SYNC_PARSER_REGRESSION', default: 'stop' } },+ 'sync.parser_regression': { key: 'sync.parser_regression', retired_in: '0.60.266.0', tuned: 'whether sync holds the file (hold) or stops (stop) when bytes that imported before are refused',+ replacement: { env: 'GBRAIN_SYNC_PARSER_REGRESSION', default: 'hold' } },'sync.knock_on_refreeze_limit': { key: 'sync.knock_on_refreeze_limit', retired_in: '0.60.255.0', tuned: 'the knock-on re-freeze budget', replacement: null },'sync.knock_on_run_limit': { key: 'sync.knock_on_run_limit', retired_in: '0.60.255.0', tuned: 'the knock-on re-freeze budget per run', replacement: null },} as const satisfies Record<string, RetiredSyncKey>;diff --git a/test/behavior-change-notice-6712-block.test.ts b/test/behavior-change-notice-6712-block.test.tsindex 1964939d8e..c6a883d091 100644--- a/test/behavior-change-notice-6712-block.test.ts+++ b/test/behavior-change-notice-6712-block.test.ts@@ -12,7 +12,7 @@ import { join } from 'node:path';import { BEHAVIOR_CHANGES, compareReleases } from '../src/core/behavior-change-notice.ts';const MARKER = '// #6712 PR 4b (the level-triggered sync pass';-const ROWS = 24;+const ROWS = 25;const NOTICE_CAP = 2_000;/** The array literal's row lines in order, and where the block's rows start and how many there are. */diff --git a/test/persistence-sync-holds.test.ts b/test/persistence-sync-holds.test.tsindex f5bd957131..b768cb6745 100644--- a/test/persistence-sync-holds.test.ts+++ b/test/persistence-sync-holds.test.ts@@ -422,7 +422,7 @@ test('a flagless pass inherits a blocked --no-embed pass\'s options from its epiexpect((await t.holds()).map(hold => [hold.path, hold.code, hold.meta.attempts])).toEqual([['notes/z.md', 'worktree_dirty', 1]]);}), 240_000);-test('parser regression: stops only when provenance proves the same bytes imported validated; hold policy continues; no provenance holds normally', () => each(async engine => {+test('parser regression: GBRAIN_SYNC_PARSER_REGRESSION=stop stops only when provenance proves the same bytes imported validated; the default holds and continues; no provenance holds normally', () => each(async engine => {const s = await source(engine, { 'notes/a.md': note('A'), 'notes/ok.md': note('Ok') });await s.sync();const page = (await engine.getPage('notes/a', { sourceId: s.id }))!;@@ -434,14 +434,16 @@ test('parser regression: stops only when provenance proves the same bytes importawait engine.executeRaw(`UPDATE op_checkpoints SET completed_keys=jsonb_set(completed_keys,'{0,raw_sha256}',to_jsonb($3::text)) WHERE op=$1 AND fingerprint LIKE $2`,[SYNC_IMPORT_PROVENANCE_OP, `${s.id}:%:${page.id}`, sha256(FOLDED)]);const head = await s.lastCommit();- await expect(s.sync()).rejects.toMatchObject({ code: 'sync_parser_regression' });+ await withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: 'stop' }, () => expect(s.sync()).rejects.toMatchObject({ code: 'sync_parser_regression' }));expect(await s.lastCommit()).toBe(head);// #6712 PR 2: a stored sync.parser_regression (retired) is not applied; the process's GBRAIN_SYNC_PARSER_REGRESSION is.await engine.setConfig('sync.parser_regression', 'hold');- await expect(s.sync({ retryFailed: true })).rejects.toMatchObject({ code: 'sync_parser_regression' });+ await withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: 'stop' }, () => expect(s.sync({ retryFailed: true })).rejects.toMatchObject({ code: 'sync_parser_regression' }));expect(await s.lastCommit()).toBe(head);+ await engine.setConfig('sync.parser_regression', 'stop');+ // GBRA-108: with the variable unset the default holds (and a stored stop is not applied either).+ const held = await withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: undefined }, () => s.sync({ retryFailed: true }));await engine.unsetConfig('sync.parser_regression');- const held = await withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: 'hold' }, () => s.sync({ retryFailed: true }));expect(held.held?.[0]).toMatchObject({ path: 'notes/a.md', code: 'parser_regression' });expect(await s.lastCommit()).not.toBe(head);diff --git a/test/sync-alias-limit-hold-6712.test.ts b/test/sync-alias-limit-hold-6712.test.tsindex 6b4abc4566..6ea2e90efc 100644--- a/test/sync-alias-limit-hold-6712.test.ts+++ b/test/sync-alias-limit-hold-6712.test.ts@@ -8,9 +8,12 @@* Protects:* - an alias bomb whose provenance says a validating older gbrain imported those exact bytes, re-screened on a full* listing: held `frontmatter_alias_limit` alone, the other files import, the run is not stopped, nothing is expanded;+ * - the alias hold takes precedence over the parser-regression policy: held the same way under the default and under+ * `GBRAIN_SYNC_PARSER_REGRESSION=stop`;* - regression guard: an ordinary `invalid_frontmatter` refusal (no marker, still refused when screened without a schema- * pack) under a provenance from a different gbrain version still stops the run with `sync_parser_regression` under the- * default policy.+ * pack) under a provenance from a different gbrain version still stops the run with `sync_parser_regression` under+ * `GBRAIN_SYNC_PARSER_REGRESSION=stop`, and (GBRA-108 default flip) is held `parser_regression` alone with nothing set,+ * while the rest syncs.** Six-level bomb only (~530k nodes once expanded, refused before anything walks it); never build a nine-level value.* PGLite here; Postgres through test/e2e/sync-alias-limit-hold-6712-postgres.test.ts.@@ -26,6 +29,7 @@ import { sha256 } from '../src/core/persistence/digest.ts';import { performManagedSync } from '../src/core/persistence/sync-run.ts';import { managedBrain } from './helpers/managed-brain.ts';import { testBackends } from './helpers/test-backends.ts';+import { withEnv } from './helpers/with-env.ts';const git = (root: string, ...args: string[]) => execFileSync('git', ['-C', root, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();const commit = (root: string, message: string) => { git(root, 'add', '-A'); git(root, '-c', 'user.name=Example', '-c', '[email protected]', 'commit', '-qm', message); };@@ -58,7 +62,7 @@ for (const backend of testBackends()) {const brain = (run: Parameters<typeof managedBrain>[0]) => managedBrain(run, { ...(databaseUrl ? { databaseUrl } : {}), setup });describe(`#6712 PR 4b alias-limit refusals of validated bytes (${backend})`, () => {- test('a stored alias bomb a validating older gbrain imported is held frontmatter_alias_limit alone on a full re-screen; the rest syncs', () => brain(async ({ engine, root }) => {+ for (const policy of [undefined, 'stop'] as const) test(`a stored alias bomb a validating older gbrain imported is held frontmatter_alias_limit alone on a full re-screen; the rest syncs${policy ? ` (GBRAIN_SYNC_PARSER_REGRESSION=${policy})` : ''}`, () => brain(async ({ engine, root }) => withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: policy }, async () => {expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');writeFileSync(join(root, 'notes/target.md'), BOMB_6); writeFileSync(join(root, 'notes/new.md'), note('New')); commit(root, 'bomb and new');await provenanceClaims(engine, 'notes/target', BOMB_6);@@ -69,9 +73,9 @@ for (const backend of testBackends()) {expect((await engine.getPage('notes/new', { sourceId: 'default' }))?.compiled_truth).toContain('Body of New.');expect((await engine.getPage('notes/target', { sourceId: 'default' }))?.compiled_truth).toContain('Body of Target.');expect(await largestFrontmatter(engine)).toBeLessThan(10_000);- }), 180_000);+ })), 180_000);- test('regression guard (a different version, no marker, refused without the pack): validated bytes refused invalid_frontmatter still stop the run with sync_parser_regression', () => brain(async ({ engine, root }) => {+ test('regression guard (a different version, no marker, refused without the pack): validated bytes refused invalid_frontmatter still stop the run with sync_parser_regression under GBRAIN_SYNC_PARSER_REGRESSION=stop', () => brain(async ({ engine, root }) => withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: 'stop' }, async () => {const bare = screenImportContent({ content: FOLDED, path: 'notes/target.md' });expect(bare.status === 'refused' ? { code: bare.refusal.code, intended: bare.refusal.intended ?? null } : bare).toEqual({ code: 'invalid_frontmatter', intended: null });expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');@@ -80,6 +84,18 @@ for (const backend of testBackends()) {const before = await lastCommit(engine);await expect(performManagedSync(engine, { ...OPTS, full: true })).rejects.toMatchObject({ code: 'sync_parser_regression' });expect(await lastCommit(engine)).toBe(before);- }), 180_000);+ })), 180_000);++ test('GBRA-108 default flip: with GBRAIN_SYNC_PARSER_REGRESSION unset, the same regression is held parser_regression alone and the rest syncs', () => brain(async ({ engine, root }) => withEnv({ GBRAIN_SYNC_PARSER_REGRESSION: undefined }, async () => {+ expect((await performManagedSync(engine, OPTS)).status).toBe('first_sync');+ writeFileSync(join(root, 'notes/target.md'), FOLDED); writeFileSync(join(root, 'notes/new.md'), note('New')); commit(root, 'fold target and new');+ await provenanceClaims(engine, 'notes/target', FOLDED);+ const result = await performManagedSync(engine, { ...OPTS, full: true });+ expect(result.held?.map(hold => ({ path: hold.path, code: hold.code }))).toEqual([{ path: 'notes/target.md', code: 'parser_regression' }]);+ expect(await holds(engine)).toEqual([{ path: 'notes/target.md', code: 'parser_regression' }]);+ expect(await lastCommit(engine)).toBe(git(root, 'rev-parse', 'HEAD'));+ expect((await engine.getPage('notes/new', { sourceId: 'default' }))?.compiled_truth).toContain('Body of New.');+ expect((await engine.getPage('notes/target', { sourceId: 'default' }))?.compiled_truth).toContain('Body of Target.');+ })), 180_000);});}diff --git a/test/sync-config-keys-6712.test.ts b/test/sync-config-keys-6712.test.tsindex 2a0ac6e707..97949590a9 100644--- a/test/sync-config-keys-6712.test.ts+++ b/test/sync-config-keys-6712.test.ts@@ -74,12 +74,12 @@ test('config set of a retired key warns, names its replacement and writes nothintest('config get of a retired key prints the value in effect, and a stored value is reported and not applied', async () => withEnv(CLEAR, async () => {await engine.setConfig('sync.hold_cap', '200');- await engine.setConfig('sync.parser_regression', 'hold');+ await engine.setConfig('sync.parser_regression', 'stop');const got = await config(['get', 'sync.hold_cap']);expect(got.out).toBe('500');expect(got.err).toContain('built-in default (GBRAIN_SYNC_HOLD_CAP unset)');expect(got.err).toContain('The stored sync.hold_cap=200 is not applied.');- expect(await readSyncHoldPolicy(engine)).toMatchObject({ cap: 500, parserRegression: 'stop' });+ expect(await readSyncHoldPolicy(engine)).toMatchObject({ cap: 500, parserRegression: 'hold' });await withEnv({ GBRAIN_SYNC_HOLD_CAP: '7' }, async () => {const env = await config(['get', 'sync.hold_cap']);expect(env.out).toBe('7');diff --git a/test/sync-holds-store.test.ts b/test/sync-holds-store.test.tsindex 2f0e91feff..136fdbf6e6 100644--- a/test/sync-holds-store.test.ts+++ b/test/sync-holds-store.test.ts@@ -102,14 +102,14 @@ describe('git hold store', () => {});test('policy defaults, overrides and escalation thresholds (count, and percentage only from 40 screened)', async () => {- expect(await readSyncHoldPolicy(engine)).toEqual({ mode: 'hold', cap: 500, escalateCount: 50, escalatePct: 5, parserRegression: 'stop' });+ expect(await readSyncHoldPolicy(engine)).toEqual({ mode: 'hold', cap: 500, escalateCount: 50, escalatePct: 5, parserRegression: 'hold' });// #6712 PR 2: sync.holds stays a brain key; the cap, the thresholds and the parser-regression stop are tuned by their// GBRAIN_SYNC_* environment variables, and the retired keys stored on a brain are not applied.- await engine.setConfig('sync.holds', 'fail'); await engine.setConfig('sync.hold_cap', '2'); await engine.setConfig('sync.parser_regression', 'hold');+ await engine.setConfig('sync.holds', 'fail'); await engine.setConfig('sync.hold_cap', '2'); await engine.setConfig('sync.parser_regression', 'stop');await engine.setConfig('sync.hold_escalate_count', '10'); await engine.setConfig('sync.hold_escalate_pct', '20');- expect(await readSyncHoldPolicy(engine, {})).toEqual({ mode: 'fail', cap: 500, escalateCount: 50, escalatePct: 5, parserRegression: 'stop' });- expect(await readSyncHoldPolicy(engine, { GBRAIN_SYNC_HOLD_CAP: '2', GBRAIN_SYNC_PARSER_REGRESSION: 'hold', GBRAIN_SYNC_HOLD_ESCALATE_COUNT: '10', GBRAIN_SYNC_HOLD_ESCALATE_PCT: '20' }))- .toEqual({ mode: 'fail', cap: 2, escalateCount: 10, escalatePct: 20, parserRegression: 'hold' });+ expect(await readSyncHoldPolicy(engine, {})).toEqual({ mode: 'fail', cap: 500, escalateCount: 50, escalatePct: 5, parserRegression: 'hold' });+ expect(await readSyncHoldPolicy(engine, { GBRAIN_SYNC_HOLD_CAP: '2', GBRAIN_SYNC_PARSER_REGRESSION: 'stop', GBRAIN_SYNC_HOLD_ESCALATE_COUNT: '10', GBRAIN_SYNC_HOLD_ESCALATE_PCT: '20' }))+ .toEqual({ mode: 'fail', cap: 2, escalateCount: 10, escalatePct: 20, parserRegression: 'stop' });const defaults = { escalateCount: 50, escalatePct: 5 };expect(holdsEscalated(defaults, 51, { held: 0, screened: 0 })).toBe(true);expect(holdsEscalated(defaults, 50, { held: 0, screened: 0 })).toBe(false);