Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/capy/6278-lane-c' into capy/6278-preparation-deadline
garrytand329dd730ee4
diff --cc docs/guides/write-refusals.mdindex db8c43ed86,2e5c9b1a56..38f13826b5--- a/docs/guides/write-refusals.md+++ b/docs/guides/write-refusals.md@@@ -155,8 -154,8 +155,9 @@@ with each file and fix the ones that ne| <a id="rename_held"></a><a id="rename_held-rename_source_changed"></a>`rename_held` (`rename_source_changed`) | A renamed file's hold cleared, but the page it was renamed from changed after the rename was recorded, so the page did not move. | `gbrain repair frontmatter --source <source> --include-ambiguous` proposes re-binding the rename to the old page's current revision; apply after the user agrees. Or restore the old file name. || <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. A conflict no such request explains still blocks with `revision_conflict`. | `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="parser_regression"></a>`parser_regression` | With `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="preparation_stalled"></a>`preparation_stalled` | On a managed brain, the write for this file could not finish *preparing* within its attempt limit (`persistence.max_preparation_attempts`, default 2, each attempt bounded by `persistence.sync_preparation_ms`, default 120 s): its owner gave it up and finished the request `failed` with this code, and the sync held the file instead of re-entering it (#6278). The file itself is fine: this is the write owner stalling (a database or pool wait, a hung step), never a frontmatter or fence problem, so no repair applies. The hold's `message` names the request and, when the owner stamped it, the step it was stuck on; a held deletion keeps its page until it is retried. A stalled hold re-screens by itself only when the gbrain version changes; a run that stalls many files in a row stops with [`preparation_systemic`](#preparation_systemic) instead of holding them all. | `gbrain sources writer status --source <source> --json` (read-only) shows the owner process, its gbrain version and the `claim.stall` of any write still stuck (step, `waiting_on`, budget). Fix what it names (restart or upgrade an owner that predates deadlines, free the pool, let the lock holder finish), then `gbrain sources retry-held <source>` and the same sync with its options (the hold's `fix.then.then` and `retry-held` print it, for example `gbrain sync --source <source> --no-pull --no-embed`). Runbook: [catch-up stuck / held N files](troubleshooting.md#catch-up-stuck). || <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 `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 --retry-failed`. To keep syncing meanwhile, `gbrain config set sync.parser_regression hold` (ask the user). |+ | <a id="fence_unrenderable"></a>`fence_unrenderable` | A legacy fact row (an active `facts` row with no fence row number) was not adopted into its page's `## Facts` fence because the fence codec reads the rendered row back as something other than the stored fact: a whitespace-only claim comes back empty, `~~x~~` comes back struck, a literal `<br>` comes back as a line break, or another column changes. Surrounding whitespace and CRLF line endings are the one accepted difference: such a row is adopted and `facts.fact` takes the fence's text. A second legacy row whose normalized claim and source the page already carries is left too (`duplicate_claim`). The cycle and the v0.32.2 migration print `FACTS_FENCE_FAILED: <slug> (fence_unrenderable: N row(s), <class>)`; doctor `fence_integrity` lists the pages, fact ids and reason classes under `unrenderable_legacy_facts` (never the claim text). The same code refuses a planned adoption whose rendered fence does not read back as its facts; that is a gbrain planning defect, not caller input. | Nothing to fix in the page: the rows stay active and searchable, nothing is lost, and their pages skip destructive fact reconciliation until the rows are adopted. Report the pages and reason classes with the gbrain version. Never `forget_fact` a row to clear the count. || <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>`) 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 frontmatter, show the user the new diff first; a fence repair needs no extra consent ([fence reason](#fence-changed_since_preview)). |<a id="invalid_fence"></a>diff --cc src/core/behavior-change-notice.tsindex a670298614,e05d306848..19eb624410--- a/src/core/behavior-change-notice.ts+++ b/src/core/behavior-change-notice.ts@@@ -306,10 -306,7 +306,11 @@@ export const BEHAVIOR_CHANGES: Readonly{ since: '0.60.107.0', text: 'Search-hiding and other gate-owned frontmatter keys (`quarantine`, `content_flag`, `embed_skip`, `atoms_scan_hash`, `quarantine_override`) in a local `put_page`, a connector, an ingest event or any other non-owner write are now stripped instead of kept; sync and import of your own files, reindex, repair and `gbrain quarantine clear` keep them.' },{ since: '0.60.107.0', text: 'A quarantined page is no longer offered to automatic fact extraction (`facts_backstop.skipped: quarantined`) and its facts and takes fences are not projected; rows projected before it was quarantined stay.' },{ since: '0.60.107.0', text: '`get_page` and `fetch` of a quarantined page carry `quarantined` (fetch: `metadata.quarantined`) and a `page_quarantined` notice, and remote callers get no body or text unless an admin-scoped caller passes `include_quarantined: true`; a quarantined `put_page` now reports `quarantined: { reason, detail }`.' },+ // #6278 (the integrator restamps `since` to the release that ships it).+ { since: '0.60.107.0', text: 'Managed sync and maintenance writes now have a preparation deadline: a write that cannot finish preparing is released at its budget and retried once, and a second expiry finishes it `failed` with `preparation_stalled`. A managed sync holds such a file (`preparation_stalled`, listed by `gbrain sources status`) and keeps going; held content stays out of the index until `gbrain sources retry-held <id>` and the same sync re-import it. Many such stalls in one run stop it with `preparation_systemic` instead of holding every file.' },+ { since: '0.60.107.0', text: 'A foreground or maintenance write (`put_page`, `remember`, fact-fence adoption) whose preparation stalls twice now gets a terminal `preparation_stalled` receipt instead of staying `running` forever; `gbrain sources writer status` shows the step a stuck write reached (`claim.stall`).' },+ { since: '0.60.107.0', text: 'New keys `persistence.sync_preparation_ms` (120000), `persistence.maintenance_preparation_ms` (120000), `persistence.preparation_ceiling_ms` (600000) and `persistence.max_preparation_attempts` (2) bound write preparation; the `preparation_deadlines` write switch (`gbrain config set persistence.preparation_deadlines false`) turns all of it off. `persistence.max_claim_ms` keeps its doctor meaning.' },+ { since: '0.60.107.0', text: 'Fact-fence adoption (the extract_facts cycle phase and the v0.32.2 backfill) now writes the fence\'s parsed text back into `facts.fact`: a legacy claim with surrounding whitespace or CRLF line endings is adopted with that whitespace trimmed and its line endings folded to LF (the row keeps its id, vectors and provenance), a claim the fence codec would change further (whitespace-only, `~~x~~`, a literal `<br>`) or one the page already carries stays a legacy row and is reported as `FACTS_FENCE_FAILED: <slug> (fence_unrenderable: …)` and under doctor fence_integrity `unrenderable_legacy_facts`, and only the pages still holding such rows skip destructive fact reconciliation instead of the whole source.' },];/** The newest disclosed change's release: the notice id moves only when a release adds rows. */diff --cc src/core/persistence/types.tsindex 9de644e4dd,e08a5dfed3..8a196de996--- a/src/core/persistence/types.ts+++ b/src/core/persistence/types.ts@@@ -18,7 -18,8 +18,9 @@@ export const WRITE_ERROR_CODES ='connector_account_changed', 'connector_intent_outdated', 'checkpoint_validation_timeout','invalid_connector_text', 'connector_holds_exhausted', 'connector_fence_below_timeline','core_budget_exceeded', 'core_mark_owner_only', 'core_remote_edit_refused', 'core_delete_owner_only',+ 'timeline_rows_would_be_removed', 'preparation_stalled',+ 'timeline_rows_would_be_removed',+ 'fence_unrenderable',] as const;export type WriteErrorCode = typeof WRITE_ERROR_CODES[number];