Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs(key-files): crash-robot entry for the fixed schedule list, within the 60000-byte cap; regenerate structural suites
garrytan9524943419be
diff --git a/docs/architecture/key-files/tooling-and-tests.md b/docs/architecture/key-files/tooling-and-tests.mdindex a22b923444..787bbf917f 100644--- a/docs/architecture/key-files/tooling-and-tests.md+++ b/docs/architecture/key-files/tooling-and-tests.md@@ -63,7 +63,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL- `scripts/persistence/{harness,schedules,worker,validate,failure-diagnostics}.ts` — executable concurrency gate using real journal/coordinator APIs: 1,000 seeded schedules per engine, eight actual process-kill publication boundaries, and 10,000 writes from four producer processes. Each phase owns a temporary disk PGLite datastore or a fresh test Postgres database. Independent accounting queries verify conservation; every soak receipt is compared to its canonical snapshot and file. JSON manifests separate actual counts and latency measurements from the configured Linux/Bun CI matrix. Failed runs preserve private fixtures and collect bounded, allowlisted request/queue/owner diagnostics without changing deadlines or hiding the original error. Cleanup commands read the existing test URL from the environment. The PGLite loopback endpoint is a fixture transport, not production authentication coverage. Contract and commands: `scripts/persistence/README.md`; smoke entries: `test/persistence-chaos.slow.test.ts`, `test/e2e/persistence-chaos.test.ts`; diagnostic/retention contracts: `test/persistence-failure-diagnostics.test.ts`.-- `scripts/persistence/{ops,generator,model,crash-robot,robot-driver,shrink,lock-order,history-fixture,would-have-caught}.ts` — the crash robot, a phase of `validate.ts` (`--robot-seconds` is a ceiling the run fails past, default 960 on PGLite and 1600 on Postgres; `--robot-scope=pr|full`; `--explore-day=<UTC day>` adds that night's exploration seeds; CI runs it as its own `persistence-validation.yml` job). `ops.ts` is the JSON op-descriptor protocol between driver and workers: each descriptor names an op kind (put/edit/delete/restore page, remember/forget, takes add/supersede, timeline add, sync, connector publish, revoke access), an actor (the local CLI principal or a remote agent whose bearer token the production `verifyAccessToken` resolves), a source, a fixed request id and arguments whose `{ $ref }` values come from earlier observations; workers run every op through its registered operation handler. Its `retryingRead` runs the robot's own reads across a session drop the `SessionDrops` ledger shows it injected (the pooler disconnect fault); any other closed connection fails the run. `generator.ts` builds seeded schedules: the fixed cross-boundary sequences (withdrawal then stale republication, overlapping slugs across two sources, competing writers, caller-bound replay, authority revoked with effects pending, sync and connector publish racing direct writes) plus random sequences with concurrent groups. `model.ts` is the temporal oracle: receipts and revisions at the observation point, legal later transitions, late receipts against page history, withdrawal permanence on recall/get_page/facts, source isolation, caller-bound replay, takes/facts fence projections, attribution, orphans, drain and wedge bounds; `EFFECT_SEAMS` maps every `EffectKind` to its trigger op and seam (typecheck-exhaustive). `crash-robot.ts` runs a schedule in-process or as a worker role (`count`, `run` frozen at a `fault-points.ts` seam and SIGKILLed by the driver, `recover`), plus process faults (stale `index.lock`, a hung git commit holding `index.lock`, Postgres session drops, the owner killed after a `facts-absorb` job's extraction commits and the job re-run). `robot-driver.ts` runs a fixed schedule list on every event, so a passed run of a tree stands for any run of it (master-push reuse): it crashes each seam the cross-boundary sequences reach (every seam of every sequence on a full PGLite run), then counts and crashes once each random sequence in `ROBOT_RANDOM_SEEDS` (5105–5109, 5113, 5115, 5116; Postgres avoids the lease-bound seams there), plus `explorationSeeds(day)` on the nightly (one of `ROBOT_ROTATION_SEEDS` 5110–5112, 5114 each night, and 5117 + day); the manifest's `over_budget` makes `validate.ts` fail past `--robot-seconds` instead of covering less. Postgres connects through `GBRAIN_PGBOUNCER_URL` when set and, in the `pr` scope, skips the seams and the pooler disconnect fault that can wait out a dead owner's claim lease (`effect:*`, `consumer:prepared`, three publication seams), listed in the manifest as `lease_bound_seams_skipped` and `lease_bound_faults_skipped`. `shrink.ts` is dependency-preserving ddmin accepted on 3/3 reproduction; `--replay`/`--shrink` re-run a manifest's failing runs. `lock-order.ts` traces each transaction's row locks (worktrees before sources, sources by id, no exclusive brain lock in a publication). `history-fixture.ts` exports `buildHistoryFixture(engine, { pages, seed, sources, worktrees })` (a managed brain with real persistence history up to 10k pages, used by engine graduation and attribution backfill) and `prepareTopology`. `would-have-caught.ts` reverts each fix in `would-have-caught.json` in a scratch worktree and runs the pre-robot gate and the robot against it. Tests: `test/persistence-crash-robot.test.ts`, `test/persistence-crash-robot.slow.test.ts` (shrunk regressions in `test/fixtures/crash-robot/`), `test/persistence-history-fixture.test.ts`.+- `scripts/persistence/{ops,generator,model,crash-robot,robot-driver,shrink,lock-order,history-fixture,would-have-caught}.ts` — the crash robot, a phase of `validate.ts` (`--robot-seconds` ceiling, default 960 PGLite, 1600 Postgres; `--robot-scope=pr|full`, `--explore-day`; CI: `persistence-validation.yml`). `ops.ts` is the JSON op-descriptor protocol between driver and workers: each descriptor names an op kind (put/edit/delete/restore page, remember/forget, takes add/supersede, timeline add, sync, connector publish, revoke access), an actor (the local CLI principal or a remote agent `verifyAccessToken` resolves), a source, a fixed request id and arguments whose `{ $ref }` values come from earlier observations; workers run each op through its registered handler. Its `retryingRead` retries the robot's reads only across a session drop the `SessionDrops` ledger shows it injected; any other closed connection fails the run. `generator.ts` builds seeded schedules: the fixed cross-boundary sequences (`crossBoundarySequences`: withdrawal then republication, overlapping slugs, competing writers, caller-bound replay, revoked authority, sync/connector races) plus random sequences with concurrent groups. `model.ts` is the temporal oracle: receipts and revisions at the observation point, legal later transitions, late receipts against page history, withdrawal permanence on recall/get_page/facts, source isolation, caller-bound replay, takes/facts fence projections, attribution, orphans, drain and wedge bounds; `EFFECT_SEAMS` maps every `EffectKind` to its trigger op and seam (typecheck-exhaustive). `crash-robot.ts` runs a schedule in-process or as a worker role (`count`, `run` frozen at a `fault-points.ts` seam and SIGKILLed by the driver, `recover`), plus process faults (stale `index.lock`, a hung git commit holding it, Postgres session drops, the owner killed after a `facts-absorb` extraction commits, then the job re-run). `robot-driver.ts` runs one fixed list on every event (a passed run is reusable): each seam the fixed sequences reach (all of them on full PGLite), `ROBOT_RANDOM_SEEDS`, nightly `explorationSeeds(day)`; `over_budget` fails it past the ceiling. Postgres connects through `GBRAIN_PGBOUNCER_URL` when set and, in the `pr` scope, skips the seams and the pooler disconnect fault that can wait out a dead owner's claim lease (`effect:*`, `consumer:prepared`, three publication seams), listed in the manifest as `lease_bound_seams_skipped` and `lease_bound_faults_skipped`. `shrink.ts` is dependency-preserving ddmin accepted on 3/3 reproduction; `--replay`/`--shrink` re-run a manifest's failing runs. `lock-order.ts` traces each transaction's row locks (worktrees before sources, sources by id, no exclusive brain lock in a publication). `history-fixture.ts` exports `buildHistoryFixture(engine, { pages, seed, sources, worktrees })` (real persistence history up to 10k pages; engine graduation, attribution backfill) and `prepareTopology`. `would-have-caught.ts` reverts each fix in `would-have-caught.json` in a scratch worktree and runs the pre-robot gate and robot on it. Tests: `test/persistence-crash-robot.test.ts`, `test/persistence-crash-robot.slow.test.ts` (shrunk regressions in `test/fixtures/crash-robot/`), `test/persistence-history-fixture.test.ts`.- `scripts/persistence/{graduation-fixture,graduation-process,graduation-ttv}.ts` — engine graduation test inputs and measurements. `graduation-fixture.ts` builds the 1k/10k history brains (`buildHistoryFixture` plus deterministic chunk vectors) or the hand-built legacy brain (`test/fixtures/graduation/`) in a keyless child process, caches each as a tarball keyed by its source files, schema version, seed and size, and re-homes a restore (database paths, managed-root records, owner stamps re-stamped with the new inode and birth time; sources marked synced). Its report lists bytes, chunks, versions, requests, effects and embeddings. `graduation-process.ts` spawns the real CLI or an older release with an isolated home and no provider keys, with optional boundary hooks, plus MCP stdio/HTTP clients and the JSON contract accessors. `graduation-ttv.ts` times plan to green doctor (five-minute gate at 1k pages; exit 1 under `--enforce`, 3 on a harness crash). Owners: `test/scripts/graduation-fixture.test.ts`, `test/graduation-legacy-fixture.test.ts`, `test/e2e/graduation-{crash,faults,clients,cli}.test.ts`, `tests/heavy/graduation_10k.sh`.diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsvindex b04779111f..c3e3c97bb6 100644--- a/scripts/structural-suites.tsv+++ b/scripts/structural-suites.tsv@@ -305,7 +305,7 @@ test/scripts/ci-runner-routing.test.ts CI runner routing 7 readFileSynctest/scripts/classify-tests.test.ts classify-tests detectors 23 bun-file,doctor-source-helper,exec-scan,readFileSync,source-surface-helpertest/scripts/classify-tests.test.ts structural-suites manifest 1 readFileSynctest/scripts/coverage-diff-gate.test.ts exemptions 3 readFileSync-test/scripts/data-safety-native-workflow.test.ts data-safety native CI coverage 19 readFileSync+test/scripts/data-safety-native-workflow.test.ts data-safety native CI coverage 20 readFileSynctest/scripts/e2e-backend-matrix.test.ts scripts/e2e-backend-matrix.txt 3 readFileSynctest/scripts/e2e-live-key-only.test.ts shared live-key E2E exclusion list 4 readFileSynctest/scripts/e2e-matrix.test.ts frozen E2E matrix 9 readFileSync