Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: quarantine the #6649 restore drill and the #6573 native test as serial files
garrytanb3700c318e1e
diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 66e13d813f..863dc56575 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -262,7 +262,7 @@ jobs:# under a non-ASCII profile path, with a 20-cycle bind/close stability probe (Bun Windows IPC crash class, #6462).- name: Long Windows PGLite IPC paths use the per-user run dir (#6573)if: runner.os == 'Windows'- run: bun test --timeout 120000 test/windows-ipc-long-path-6573.test.ts+ run: bun test --timeout 120000 test/windows-ipc-long-path-6573.serial.test.ts# bun audit blocks on pushes, schedules, manual runs, and pull requests or# merge-queue entries that change bun.lock, admin/bun.lock, patches/ or adiff --git a/docs/architecture/key-files/core-services-1-continued.md b/docs/architecture/key-files/core-services-1-continued.mdindex 7be23d9a01..054781bef1 100644--- a/docs/architecture/key-files/core-services-1-continued.md+++ b/docs/architecture/key-files/core-services-1-continued.md@@ -11,4 +11,4 @@ The content-repair judgment tier under `src/core/content-repair/`, then the Retr- `src/core/context/hook-heartbeat.ts` — the hooks telemetry plane under `<gbrain home>/integrations/hooks/` (`heartbeat.jsonl`, `status.json`, session receipts, the memorable relay log; directories 0700, appends 0600). Entries hold counters, durations and codes only: `HEARTBEAT_ALLOWED_KEYS` is the full key allowlist CI greps the fixture against, and includes `pattern` (scanner pattern name), `fingerprint` (`sha256:<16 hex>`) and `hint` (fixed text) for refusals. `near_duplicate` is the shadow count on the `writeback_dedup` event that `facts/capture-dedup.ts` appends (lane in `reason`, exact drops in `duplicate`). `relayRefusalHeartbeat(hit)` builds the line `context-engine.ts` writes when its high-entropy re-scan refuses a memorable relay (`event: relay`, `outcome: degraded`, `reason: secret_scan_refused`); the receipt and relay are skipped for that compaction window and the checkpoint is kept. `memorableGateAllowed` gates the relay lane; span redaction runs `redactFindings` with `highEntropy: true`. Tests: `test/context-engine-checkpoint.serial.test.ts`.- `src/core/context/seat.ts` — seat identity for captured sessions (#4618), engine-free. `resolveSeat` returns the lowercased `GBRAIN_SEAT` label when it matches `SEAT_LABEL_RE` (`^[a-z0-9][a-z0-9._-]{0,63}$`), else `home-<8 hex>` over the realpath of the harness home (Claude Code: the directory holding `projects/` in the transcript path, then `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, `~/.claude`; codex: `CODEX_HOME` or `~/.codex`; OpenClaw: the agent directory holding `sessions/`), so no raw path reaches frontmatter; `GBRAIN_SEAT=off` (the opt-out) resolves to null and nothing is recorded. `writeSeatSidecar` writes `<sessionId>.seat.json` (`{version: 1, seat, seat_source, hook_lane, harness, first_seen}`, 0600, tmp+rename) unless one exists, reporting `seat_conflict` when the existing seat differs; `readSeatSidecar` accepts only a valid v1 record. `SEAT_REASON_HINTS` holds the fixed heartbeat hints. The sidecar name and its GC live in `corpus-segments.ts` (`seatFileName`, `SEAT_SIDECAR_SUFFIX`).-- `src/core/context/ipc-path.ts` — engine-free local socket discovery and private Unix fallback when the complete role-specific address exceeds 103 UTF8 bytes. Hashes the physical parent plus basename under a fixed OS temporary root, verifies ownership/0700 directory/0600 client socket without following fallback symlinks, and retains a native binding claim through actual server close. Existing Unix socket accessibility is rechecked even when a runtime reports ENOENT; permission/resource probe failures never authorize stale takeover; on Windows a PGLite data-dir socket (`.gbrain-<kind>.sock`) over afunix's 107 UTF-8 bytes moves to `%USERPROFILE%\.gbrain\run\<kind>-<hash12(canonical data dir, case-folded)>.sock` (`windowsLocalIpcSocketPath`, the Postgres run-dir scheme; the secret stays in the data dir), and `localIpcPathTooLong` reports a resolved path still over the platform budget, which `ipc-path-too-long.ts` turns into the typed `ipc_path_too_long` serve log line and doctor `ipc_socket_path` warning (#6573; `test/ipc-path-windows-fallback-6573.test.ts` on every OS, the native bind and 20-cycle stability probe in `test/windows-ipc-long-path-6573.test.ts` on windows-latest); Windows named pipes retain a native Global mutex through actual close; `windows-ipc.ts` normalizes namespace prefixes while native Windows Unicode casing defines the mutex identity. `test/local-ipc-path.test.ts` covers concurrent real processes, SIGKILL recovery, active-connection shutdown, aliases and unsafe paths. The published CLI smoke also uses a long Unicode datastore path.+- `src/core/context/ipc-path.ts` — engine-free local socket discovery and private Unix fallback when the complete role-specific address exceeds 103 UTF8 bytes. Hashes the physical parent plus basename under a fixed OS temporary root, verifies ownership/0700 directory/0600 client socket without following fallback symlinks, and retains a native binding claim through actual server close. Existing Unix socket accessibility is rechecked even when a runtime reports ENOENT; permission/resource probe failures never authorize stale takeover; on Windows a PGLite data-dir socket (`.gbrain-<kind>.sock`) over afunix's 107 UTF-8 bytes moves to `%USERPROFILE%\.gbrain\run\<kind>-<hash12(canonical data dir, case-folded)>.sock` (`windowsLocalIpcSocketPath`, the Postgres run-dir scheme; the secret stays in the data dir), and `localIpcPathTooLong` reports a resolved path still over the platform budget, which `ipc-path-too-long.ts` turns into the typed `ipc_path_too_long` serve log line and doctor `ipc_socket_path` warning (#6573; `test/ipc-path-windows-fallback-6573.test.ts` on every OS, the native bind and 20-cycle stability probe in `test/windows-ipc-long-path-6573.serial.test.ts` on windows-latest); Windows named pipes retain a native Global mutex through actual close; `windows-ipc.ts` normalizes namespace prefixes while native Windows Unicode casing defines the mutex identity. `test/local-ipc-path.test.ts` covers concurrent real processes, SIGKILL recovery, active-connection shutdown, aliases and unsafe paths. The published CLI smoke also uses a long Unicode datastore path.diff --git a/docs/architecture/key-files/google-and-loops.md b/docs/architecture/key-files/google-and-loops.mdindex f74f4ca8ae..f225f2e411 100644--- a/docs/architecture/key-files/google-and-loops.md+++ b/docs/architecture/key-files/google-and-loops.md@@ -39,7 +39,7 @@ Historical Gmail repair selects explicit nested MIME metadata fields, excluding- `src/core/agent-install/` + `scripts/setup-in-agent.sh` — Package-versioned non-root installation into a verified persistent root. Absolute launchers isolate ambient routing and credentials; local launchers pin the host brain and installed source, while thin-client launchers leave unqualified routing to the remote grant and preserve explicit CLI arguments. Receipts track ownership, pending enablement, non-secret failure codes, and an exact repair command, and repair retains database contents. Upgrades journal pending schema migrations before switching runtime metadata; retries use schema-only initialization without invoking host orchestration. Busy results remain structured and retryable without deleting live locks. Native instructions/routines remain pending until observed in the actual harness.- `src/core/backup/{archive,snapshot,quarantine,private-path}.ts` — bounded full-PGLite snapshots with checksums, credential-reference exclusions and fresh-root restoration. Portable entry validation rejects traversal, Windows aliases and case/normalization/file-directory collisions independently of native confinement. Recorded path flavor controls nested managed-path rebasing; unrecognized absolute page origins stay unchanged with reconnect guidance. Hold the database lock, detect changing inventories, detach external roots and quarantine unfinished jobs without deleting spending evidence. Windows uses direct .NET file/directory security APIs through bounded built-in PowerShell, without cmdlets, to protect new empty work/root/archive-temp paths before payload writes. Readback requires the current owner, protected DACL and exact deduplicated owner-plus-SYSTEM full-control rules, inheritance and propagation; unavailable enforcement refuses without changing existing parents or source data. Never replace the source installation. `backup-portability-native.serial.test.ts` checks real restore, fresh-process reopen, failure preservation and platform-native access controls with an independent read-only ACL inspector.-- `src/core/backup/preflight.ts` — #6649: before `createPgliteBackup` takes the lock, `pgliteBackupPreflight` refuses a flat or symlinked data dir (`unmanaged_database_path`) and an estimated archive over `BACKUP_ARCHIVE_MAX_BYTES` (`backup_too_large`: `estimatedTarBytes` counts tar headers and padding, plus managed files), both with the ask-user physical-copy runbook fix. `backup.ts` renders those two codes as their own envelope (legacy `reason` kept) instead of `storage_error`. Doctor's `pglite_data_dir` (`backupSizeCheck` in `checks/db-connection.ts`) warns on a healthy PGLite brain from 75% of the cap. `test/backup-preflight-6649.test.ts` uses sparse files and runs the restore drill.+- `src/core/backup/preflight.ts` — #6649: before `createPgliteBackup` takes the lock, `pgliteBackupPreflight` refuses a flat or symlinked data dir (`unmanaged_database_path`) and an estimated archive over `BACKUP_ARCHIVE_MAX_BYTES` (`backup_too_large`: `estimatedTarBytes` counts tar headers and padding, plus managed files), both with the ask-user physical-copy runbook fix. `backup.ts` renders those two codes as their own envelope (legacy `reason` kept) instead of `storage_error`. Doctor's `pglite_data_dir` (`backupSizeCheck` in `checks/db-connection.ts`) warns on a healthy PGLite brain from 75% of the cap. `test/backup-preflight-6649.serial.test.ts` uses sparse files and runs the restore drill.- `src/core/harness/registry.ts` — Canonical adapter identities, supported transports, credential-delivery mechanisms, guide links and dated evidence; legacy connection/register vocabularies derive their facts here. `scripts/build-harness-docs.ts` emits the user-facing adapter reference. A `manual` adapter such as `hermes` (stdio, `docs/mcp/HERMES.md`) installs as `pending` with its guide; no adapter claims a runtime-tested session without dated evidence.- `src/core/harness/credentials.ts` + `delivery.ts` + `install.ts` — Private credential handoff and host delivery journal, ownership-preserving native configuration and isolated thin launchers. A committed active client and matching current secret are prerequisites for recovery. Machine handoffs preserve optional POST/Basic authentication methods. Native setup is a distinct nested-client artifact; metadata reads never access journals or SDK client objects containing hashes. Configuration removal and server revocation are separate actions.diff --git a/docs/guides/in-agent-setup.md b/docs/guides/in-agent-setup.mdindex 56515524c7..a857f7bfa0 100644--- a/docs/guides/in-agent-setup.md+++ b/docs/guides/in-agent-setup.md@@ -257,7 +257,7 @@ user before step 1: it stops their memory service.managed layout, so while it is under the cap, `GBRAIN_HOME=<new-home>gbrain backup create --output <new archive>` also archives it.-The restore drill in `test/backup-preflight-6649.test.ts` runs these steps on a+The restore drill in `test/backup-preflight-6649.serial.test.ts` runs these steps on a`.gbrain` alias to another directory: it copies the stopped brain, opens thecopy in its own home with the data intact, archives the copy and restores thatarchive into a third root. Archives over 8 GiB are not supported yet; thisdiff --git a/scripts/serial-files.tsv b/scripts/serial-files.tsvindex 087bc71d22..e1f49244c0 100644--- a/scripts/serial-files.tsv+++ b/scripts/serial-files.tsv@@ -418,3 +418,5 @@ test/write-path-zero-llm.serial.test.ts R1 R1: mutates process.env (ANTHROPIC_APtest/writeback-nudge.serial.test.ts global-state global-state: patches process stdout/stderr/consoletest/writeback-review-fixes.serial.test.ts global-state global-state: process-wide test seams __resetCheckpointHarvestForTests; patches process stdout/stderr/consoletest/resolve-ipc-rebind.serial.test.ts global-state global-state: binds real Unix sockets and spawns a child serve that is SIGKILLed; withEnv scopes GBRAIN_HOME+test/backup-preflight-6649.serial.test.ts global-state global-state: R3: constructs PGLiteEngine inside the restore-drill and fixture-brain steps (each disconnected in finally); creates symlinked homes and 8 GiB sparse files+test/windows-ipc-long-path-6573.serial.test.ts R1 R1: mutates process.env (USERPROFILE) to place the per-user run dir under a non-ASCII profile path; native windows-latest onlydiff --git a/test/ipc-path-windows-fallback-6573.test.ts b/test/ipc-path-windows-fallback-6573.test.tsindex 0f3ffaf04b..5e870873d2 100644--- a/test/ipc-path-windows-fallback-6573.test.ts+++ b/test/ipc-path-windows-fallback-6573.test.ts@@ -8,7 +8,7 @@* short-in-characters but long-in-bytes non-ASCII path move; the key is the canonical data dir, case-folded, per kind;* the turn_context secret stays in the data dir. Off Windows the end-to-end cases force `process.platform` to win32* (the platform is read per call); the native bind, round trip and stability probe live in- * test/windows-ipc-long-path-6573.test.ts on the windows-latest row. Fails on master: the win32 branch returned the+ * test/windows-ipc-long-path-6573.serial.test.ts on the windows-latest row. Fails on master: the win32 branch returned the* data-dir path unchanged, so every listen() on a long data dir failed and only GBRAIN_DEBUG said why.*/import { afterEach, describe, expect, test } from 'bun:test';