Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/capy/gbra130-p2-cursors' into capy/gbra130-p2
garrytanf448b16da111
diff --cc src/core/item-failure.tsindex fd878fe25f,c1978f944f..923d388f1e--- a/src/core/item-failure.ts+++ b/src/core/item-failure.ts@@@ -43,11 -44,9 +44,14 @@@ export const ISOLATE_SITES ='repair.all_kinds': 'A-45','repair.content_lane_kinds': 'A-46','migration.credential_reseal': 'A-27',+ 'transcripts.ingest_session': 'A-2',+ 'google.contact': 'A-3',+ 'google.calendar_event': 'A-3',+ 'migrate_engine.loop_rows': 'A-31',+ 'effects.derived_retry_budget': 'A-11',+ 'propose_takes.pages': 'A-25',+ 'sync.import_files': 'A-18',+ 'extract_facts.phantom_redirect': 'A-24',} as const satisfies Record<string, string>;export type IsolateSite = keyof typeof ISOLATE_SITES;diff --cc test/pathological/catalogue.tsindex 6214bc7fe1,45125b2d18..f87d1748a5--- a/test/pathological/catalogue.ts+++ b/test/pathological/catalogue.ts@@@ -63,17 -63,10 +63,23 @@@ export const CATALOGUE: Record<IsolateS'repair.all_kinds': { file: 'test/pathological/a45-repair-all-kinds.test.ts', item: 'item case: a kind whose plan throws', run: 'run case: a run-scoped' },'repair.content_lane_kinds': { file: 'test/pathological/a46-content-lane-kinds.test.ts', item: 'item case: fences throwing is recorded', run: 'run case: a run-scoped' },'migration.credential_reseal': { file: 'test/pathological/a27-credential-reseal.test.ts', item: 'item case: the unbuildable page is held', run: 'run case: a run-scoped' },+ 'transcripts.ingest_session': { file: 'test/pathological/a2-transcripts-ingest.test.ts',+ item: 'item: a session the coordinator refuses is reported with its code and the other sessions land',+ run: 'run: a run-scoped failure inside a session stops the ingest' },+ 'google.contact': { file: 'test/pathological/a3-google-items.test.ts',+ item: 'a failing contact and a failing event are counted, then held',+ run: 'run: a run-scoped failure inside a contact stops the sweep and records no hold' },+ 'google.calendar_event': { file: 'test/pathological/a3-google-items.test.ts',+ item: 'a failing contact and a failing event are counted, then held',+ run: 'run: a run-scoped failure inside an event stops the sweep and records no hold' },+ 'migrate_engine.loop_rows': { file: 'test/pathological/a31-migrate-loop-rows.serial.test.ts',+ item: 'A-31 item: a refused open_loops row is printed with its id and code and blocks the switch', run: 'A-31 run: a run-scoped error' },+ 'effects.derived_retry_budget': { file: 'test/pathological/a11-effect-retry-budget.test.ts',+ item: 'A-11 item: a links and a facts-backstop effect failing every attempt', run: 'A-11 run: a run-scoped failure (' },+ 'sync.import_files': { file: 'test/pathological/a18-ledger-path-text.test.ts',+ item: 'A-18 item: billing/q3.md (mode 000) is PERMISSION_DENIED', run: 'A-18 run: a run-scoped' },+ 'propose_takes.pages': { file: 'test/pathological/a25-propose-takes-poison-pages.test.ts',+ item: 'A-25 item: the 5 newest pages fail every run', run: 'A-25 run: a run-scoped' },+ 'extract_facts.phantom_redirect': { file: 'test/pathological/a24-phantom-redirect-cursor.test.ts',+ item: 'A-24 item: a phantom whose redirect throws is reported with its code and fix', run: 'A-24 run: a run-scoped' },};diff --cc test/pathological/inventory-deferred.test.tsindex deed3fd101,0000000000..c970c26b8cmode 100644,000000..100644--- a/test/pathological/inventory-deferred.test.ts+++ b/test/pathological/inventory-deferred.test.ts@@@ -1,95 -1,0 +1,92 @@@+/**+ * GBRA-130: every inventory row not fixed in this suite yet is a named+ * test.todo here (reports/GBRA-130-inventory.md in the crew drive), so a row+ * can't drop out of sight. When a row is fixed, delete it from DEFERRED and add+ * its probe file; ./sites.test.ts and the guard below keep the two lists apart.+ */+import { describe, expect, test } from 'bun:test';+import { ISOLATE_SITES } from '../../src/core/item-failure.ts';++/** [row id, owner or disposition, what goes wrong] */+export const DEFERRED: ReadonlyArray<readonly [string, string, string]> = [+ ['A-5', 'GBRA-101 (4b)', 'A publication whose transaction **always** hits 57014 or 55P03 is released as database_contention without charging an attempt'],+ ['A-6', 'GBRA-101 (4b)', 'Managed sync drain'],+ ['A-7', 'GBRA-101 (4b)', 'Managed freeze of one entry'],+ ['A-8', 'GBRA-129', 'Managed discovery: two pages claim one source_path, or the page at the file\'s slug records another origin'],+ ['A-14', 'GBRA-101 (journal.ts is 4b-touched)', 'Compaction selects the 100 oldest eligible receipts, but it does not filter out each worktree\'s newest committed sync receipt there'],+ ['A-16', 'next wave (effect variant fixed with C-1)', 'A staging-bytes recovery, or a terminal request that still holds a recovery record, has no preview-bound exit (only the withdrawal-mirror effect variant is fixed)'],+ ['A-17', 'GBRA-101 (4b)', 'Managed discovery'],- ['A-18', 'GBRA-130 PR 2', 'Legacy incremental/full sync gate'],+ ['A-19', 'deferred (intentional gate; narrow later)', 'Legacy rename reconcile'],+ ['A-20', 'GBRA-101 (4b)', 'Managed screen'],- ['A-24', 'GBRA-130 PR 2', 'extract_facts phantom pass'],- ['A-25', 'GBRA-130 PR 2', 'propose_takes'],+ ['A-28', 'GBRA-101 (4b)', 'gbrain sync unblock --source <id> --apply (the documented operator exit for held files) calls runContentLane for fence and slug-conflict holds with...'],+ ['A-29', 'deferred (intentional gate; narrow later)', 'One live job (waiting/active/delayed/waiting-children/paused) whose submission_authority is SQL NULL, malformed, or a future version written by a n...'],+ ['A-32', 'deferred: next wave (test.todo)', 'Legacy un-syncable sweep'],+ ['A-33', 'deferred: next wave (test.todo)', 'Full sync reconcile delete'],+ ['A-34', 'GBRA-101 (4b)', 'Owner-startup refresh recovery: rows ordered by created_at LIMIT 16 with no rotation'],+ ['A-35', 'deferred: next wave (test.todo)', 'drainEffects runs the noop-settle loop first'],+ ['A-36', 'GBRA-60', 'A facts batch with one entity request that ended terminal on a code other than source_changed or withdrawal (revision_conflict, invalid_fence, page...'],+ ['A-37', 'deferred: next wave (test.todo)', 'extract_atoms, unmanaged'],+ ['A-38', 'deferred: next wave (test.todo)', 'Managed extract_facts on a connector source (always windowed by sourceChangedSince)'],+ ['A-39', 'deferred: next wave (test.todo)', 'chronicle'],+ ['A-40', 'deferred: next wave (test.todo)', 'edge_contradictions with dream.single_value.mode=apply'],+ ['A-42', 'GBRA-60', 'Managed extract_atoms: one atom titled .example '],+ ['A-43', 'deferred (intentional gate; narrow later)', 'synthesize'],+ ['A-47b', 'next wave (found by the A-47 lane)', 'Orchestrator v0.29.1 backfill_effective_date (src/core/backfill-effective-date.ts) runs each batch in one transaction with no per-row isolation, the shape A-47 fixed in backfill-base'],+ ['A-48', 'deferred: next wave (test.todo)', 'gbrain repair-jsonb / orchestrator v0.12.2: for the five non-jsonPayloadOnly targets (pages.frontmatter, raw_data.data, ingest_log.pages_updated, f...'],+ ['A-51', 'GBRA-60', 'Managed conversation-facts publication sends a batch of pages as one request'],+ ['A-52', 'deferred: next wave (test.todo)', 'Unmanaged extraction (cycle incremental pass and full fs walk)'],+ ['A-53', 'GBRA-101 (4b)', 'Managed import batches (IMPORT_BATCH_MAX_PAGES) admit every member in one transaction'],+ ['A-54', 'deferred: next wave (test.todo)', 'One link whose addLink throws on the target (a target page absent for any reason other than a known failed/vanished page, or a link-type constraint...'],+ ['A-55', 'deferred: next wave (test.todo)', 'Full sync re-export of DB-only pages: one try around the loop, so the first writePageThrough throw stops re-export of all remaining pages, silently...'],+ ['A-56', 'deferred: next wave (test.todo)', 'Legacy facts backstop per page: catch { /* per-page enqueue is best-effort */ } with no counter'],+ ['A-57', 'GBRA-101 (4b)', 'Managed per-file prepare/screen: loadActivePackForEngine(...).catch(() => null)'],+ ['A-58', 'deferred: next wave (test.todo)', 'Legacy import, file gone from disk branch: clearLegacyHold is outside any try, so a DB error there escapes importOnePath and aborts the whole drain...'],+ ['A-59', 'GBRA-101 (4b)', 'If the movement read fails, writer status shows movement: [], which looks the same as "no movement"'],+ ['A-60', 'GBRA-60', 'A failed belief-commit mark is swallowed with no counter or receipt'],+ ['A-61', 'deferred: next wave (test.todo)', 'The comment says "the next settlement retries"'],+ ['A-62', 'deferred: next wave (test.todo)', 'doctor --remediate --resume with pending_embed_sources from a budget-exhausted checkpoint: one source\'s embed error aborts the run before any job s...'],+ ['A-63', 'deferred: next wave (test.todo)', 'gbrain repair file-drift --source <id> --all-drifted preview: a plain Error for one slug (fs EACCES/ENAMETOOLONG on the canonical path, a YAML or d...'],+ ['A-64', 'deferred: next wave (test.todo)', 'Fences\' managed write rethrows codes other than the changed/sync_in_progress set'],+ ['A-65', 'GBRA-60', 'repair captured-facts classifies paste-only facts by reading the session corpus'],+ ['A-66', 'GBRA-101 (4b)', 'In the per-file catch branch, await opts.onFileResult?.(…) sits outside any try, so a throw from sync\'s ledger callback escapes and aborts the whol...'],+ ['A-67', 'deferred (intentional gate; narrow later)', 'Jobs fail as a whole when any single page or file was refused (#5904, #6273 intent: never report success over unwritten rows)'],+ ['B-1', 'GBRA-129', 'Two live pages record one source_path'],+ ['B-2', 'GBRA-101 (4b)', 'One page in the source whose stored source_path is empty, absolute or contains ../'],+ ['B-3', 'GBRA-101 (4b)', 'Two origins for one slug differ only by case or backslash spelling (People/X.md recorded, plus a new people/x.md in the tree)'],+ ['B-4', 'GBRA-101 (4b)', 'A file takes over the page at its slug whose explicit frontmatter id differs'],+ ['B-7', 'GBRA-60', 'Facts are minted on an entity_slug that has no page'],+ ['B-8', 'deferred: next wave (test.todo)', 'Rename A→B leaves alias A→B; a later put_page, import, restore or sync creates a live page at A'],+ ['B-9', 'GBRA-60', 'A retired alias page (canonical: false, superseded_by) gets enrichment timeline entries and backlinks'],+ ['B-10', 'GBRA-60', 'Re-keying entity_slug (rename, phantom redirect, relink) does not dedupe ontology rows'],+ ['B-11', 'deferred: next wave (test.todo)', 'NFD and NFC spellings are accepted as two different slugs (probe: validateSlug of people/jose + U+0301 is not equal to the NFC people/josé)'],+ ['B-13', 'deferred: next wave (test.todo)', 'Frontmatter id is not unique per source'],+ ['B-14', 'GBRA-95', 'Streamed (segmented) sync refuses revision_conflict "A different page already owns this file identity"'],+ ['B-15', 'GBRA-129', 'sources reconcile refuses per page when several live pages claim the recorded file'],+ ['B-16', 'GBRA-101 (4b)', 'legacy_slug_conflict (#6727): several legacy pages fold to one file slug'],+ ['C-8', 'deferred (intentional gate; narrow later)', 'One live job row with a missing or unsupported submission_authority (a pre-v0.50 row, or one written by a newer build) stops every worker from star...'],+ ['C-9', 'GBRA-60', 'A put_page\'s facts-absorb job dies after 5 attempts (provider outage, or bad config as in #6113)'],+ ['C-10', 'deferred: next wave (test.todo)', 'A projection job that fails deterministically (a code page missing source_path, an unreadable segment) is retried every 30 s forever'],+ ['C-11', 'deferred: next wave (test.todo)', 'One transcript with real drift keeps --since last from ever advancing, so every run rescans all sessions'],+ ['C-12', 'deferred: next wave (test.todo)', 'A crash during writeState truncates .github-source.json'],+ ['C-13', 'deferred: next wave (test.todo)', 'A crashed skillpack install leaves .gbrain-skillpack.lock behind'],+ ['C-14', 'deferred: next wave (test.todo)', 'A holder hung inside its body (awaiting a statement the pooler never returns, the #6366 shape) keeps refreshing, so the TTL, the steal grace and --...'],+ ['C-15', 'deferred: next wave (test.todo)', 'When the vault lock is busy for more than 5 s, the writer proceeds without it (the code comment admits a deleted credential can be resurrected)'],+ ['C-16', 'GBRA-129', 'Duplicate-origin twins abort all managed sync'],+ ['C-17', 'GBRA-128', 'A 0-byte index.lock parks every git effect'],+ ['C-18', 'GBRA-101 (4b)', 'One resolved page write leaves the run blocked_by_failures, and every autopilot sync job "completes" with the parked result'],+ ['C-19', 'GBRA-101 (4b)', 'Generic invalid_params refusal, and a writer queue with a null heartbeat'],+ ['C-20', 'GBRA-101 (4b)', 'Holds survive an authorized DB-only delete (#6600)'],+ ['C-21', 'GBRA-101 (4b)', 'On macOS, case-colliding paths: refresh_dirty has no safe recovery'],+ ['C-22', 'GBRA-95', 'stuck-recovery refuses a large-file recovery: "resolve it by hand"'],+ ['C-23', 'GBRA-60', 'quarantine clear --force and an owner confirm are stripped by the next working-tree sync (#6919)'],+];++describe('GBRA-130 inventory rows not yet fixed here', () => {+ test('row ids are unique and none is already fixed at an ISOLATE_SITES site', () => {+ const ids = DEFERRED.map(([id]) => id);+ expect(new Set(ids).size).toBe(ids.length);+ const fixed = new Set<string>(Object.values(ISOLATE_SITES));+ expect(ids.filter((id) => fixed.has(id))).toEqual([]);+ });+ for (const [id, owner, what] of DEFERRED) test.todo(`${id} (${owner}): ${what}`, () => {});+});diff --cc test/postgres-unit-arms.txtindex 98f69027be,3dbd5d6818..7fb388a371--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@@ -220,26 -218,16 +220,29 @@@ test/page-prepare-shared-origin-6517.tetest/page-purge-batch-sweep-6884.test.tstest/page-purge-journal-timeout-6511.test.tstest/page-state-engine.test.ts+test/pathological/a-36-facts-batch-partial-refusal.test.ts+test/pathological/a-42-atom-dot-led-slug.test.ts+test/pathological/a-51-conversation-batch-booking.test.ts+test/pathological/a-60-belief-commit-mark.test.ts+test/pathological/a-65-captured-facts-unreadable-corpus.test.tstest/pathological/a1-links-extract.test.tstest/pathological/a10-global-maintenance-stamp.test.ts+test/pathological/a11-effect-retry-budget.test.ts+test/pathological/a12-withdrawal-mirror-gate.test.ts+test/pathological/a13-embedding-target-park.test.ts+test/pathological/a15-deactivate-exits.test.ts+ test/pathological/a18-ledger-path-text.test.ts+test/pathological/a2-transcripts-ingest.test.tstest/pathological/a21-facts-expire-deleted.test.tstest/pathological/a22-consolidate-buckets.test.tstest/pathological/a23-patterns-grounding.test.ts+ test/pathological/a24-phantom-redirect-cursor.test.ts+ test/pathological/a25-propose-takes-poison-pages.test.tstest/pathological/a26-safe-chunks-reseal.test.tstest/pathological/a27-credential-reseal.test.ts+test/pathological/a3-google-items.test.ts+test/pathological/a30-watchdog-attribution.test.ts+test/pathological/a31-migrate-loop-rows.serial.test.tstest/pathological/a4-synthesize-postprocess.test.tstest/pathological/a41-maintain-sources.test.tstest/pathological/a44-slug-conflicts-rotation.test.ts