Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(w12-w1): deterministic dubious-ownership case, new poll pin, serial rows and the quarantine help baseline (#6210, #6255, #6259)

time-attackae25fcb514a7
diff --git a/scripts/serial-files.tsv b/scripts/serial-files.tsv
index afe932a706..1e792d463a 100644
--- a/scripts/serial-files.tsv
+++ b/scripts/serial-files.tsv
@@ -166,6 +166,7 @@ test/extract-facts-embed-warn.serial.test.ts R2 R2: mock.module(../src/core/ai/g
test/extract-include-frontmatter-config.serial.test.ts global-state global-state: R3: constructs PGLiteEngine outside beforeAll; R4: PGLiteEngine without an afterAll disconnect
test/facts-backstop-outcome.serial.test.ts R1 R1: mutates process.env (GBRAIN_HOME, OPENAI_API_KEY, ANTHROPIC_API_KEY)
test/facts-context-injection.serial.test.ts global-state global-state: process-wide test seams __resetHotMemoryCacheForTests
+test/facts-embedding-bare-model.serial.test.ts global-state global-state: configures the process-wide AI gateway (configureGateway/resetGateway) to name the gateway provider in the refusal
test/facts-valid-from-context.serial.test.ts R2 R2: mock.module(../src/core/facts/extract.ts) replaces modules for every file in the process
test/filing-rules-resolution.serial.test.ts R1 R1: mutates process.env (HOME, GBRAIN_HOME, GBRAIN_GIT_ALLOW_FILE_TRANSPORT)
test/fix-wave-3-connector-loops.serial.test.ts global-state global-state: process-wide test seams __setChatTransportForTests; configureGateway changes the process-wide AI gateway
@@ -279,6 +280,7 @@ test/pglite-wal-repair.serial.test.ts global-state global-state: R3: constructs
test/physical-root-overlap-vanished-dir.serial.test.ts R2 R2: mock.module(node:fs) makes readdirSync throw ENOENT for one path
test/projections-drain-cli.serial.test.ts global-state global-state: R3: constructs PGLiteEngine outside beforeAll
test/put-page-push-reporting.serial.test.ts R1 R1: mutates process.env (GBRAIN_HOME)
+test/quarantine-override.serial.test.ts global-state global-state: replaces console.log, console.error and process.exit to capture the quarantine CLI, and patches a shared engine's readPageSnapshot for the revision race
test/query-cache-knobs-hash.serial.test.ts R1 R1: mutates process.env (GBRAIN_FTS_LANGUAGE)
test/query-image-date-readiness.serial.test.ts R2 R2: mock.module(../src/core/ai/gateway.ts) replaces modules for every file in the process
test/query-image-flag.serial.test.ts R2 R2: mock.module(../src/core/ai/gateway.ts) replaces modules for every file in the process
diff --git a/test/fixtures/cli-contract/help-baseline.json b/test/fixtures/cli-contract/help-baseline.json
index 9d844b07bd..f0c1a7d00a 100644
--- a/test/fixtures/cli-contract/help-baseline.json
+++ b/test/fixtures/cli-contract/help-baseline.json
@@ -13,7 +13,6 @@
"lint:stub",
"notability-eval:stub",
"publish:stub",
- "quarantine:stub",
"recall:stub",
"reconcile-links:stub",
"reindex-code:missing_yes",
diff --git a/test/pending-write-exit-owner.test.ts b/test/pending-write-exit-owner.test.ts
index 5b1b2ae05f..f4ab0fcc3f 100644
--- a/test/pending-write-exit-owner.test.ts
+++ b/test/pending-write-exit-owner.test.ts
@@ -76,7 +76,9 @@ describe('paused writers and the CLI exit contract', () => {
const pending = await cli(['put', 'notes/paused', '--request-id', id, '--wait', '1', '--json'], page('Paused body.'));
expect({ code: pending.code, stderr: pending.stderr }).toMatchObject({ code: PENDING_WRITE_EXIT_CODE });
expect(JSON.parse(pending.stdout).write_request).toMatchObject({ request_id: id });
- expect(pending.stderr).toContain('Poll: gbrain call get_write_request');
+ // #6255: the poll command is the envelope's receipt fix, pinned to the brain it ran against.
+ expect(pending.stderr).toContain(`Poll: gbrain write-request --brain host -- ${id}`);
+ expect(JSON.parse(pending.stdout).poll_command).toBe(JSON.parse(pending.stdout).fix.argv.join(' '));
const accepted = await cli(['call', 'put_page', JSON.stringify({ slug: 'notes/paused', content: page('Paused body.'), request_id: id }),
'--wait', '0', '--accept-pending']);
expect({ code: accepted.code, stderr: accepted.stderr }).toMatchObject({ code: 0 });
diff --git a/test/persistence-git-coalescing-5530.slow.test.ts b/test/persistence-git-coalescing-5530.slow.test.ts
index 4725a492b6..f1ada9e25f 100644
--- a/test/persistence-git-coalescing-5530.slow.test.ts
+++ b/test/persistence-git-coalescing-5530.slow.test.ts
@@ -348,8 +348,14 @@ for (const kind of testBackends()) describe(`#6210 native Git durability probe f
test.each([
['damaged HEAD', (repo: Repo) => { writeFileSync(join(repo.root, '.git', 'HEAD'), 'not a ref\n'); return {}; }],
- // Git's own switch for the "dubious ownership" refusal a checkout owned by another user gets.
- ['dubious ownership', () => ({ GIT_TEST_ASSUME_DIFFERENT_OWNER: '1' })],
+ // Git's own switch for the "dubious ownership" refusal a checkout owned by another user gets. A runner's
+ // global or system config can trust every directory (safe.directory=*, common in CI images), which
+ // suppresses the refusal, so this case reads an empty global config and no system config.
+ ['dubious ownership', (repo: Repo) => {
+ const empty = join(repo.root, '..', 'empty-gitconfig');
+ writeFileSync(empty, '');
+ return { GIT_TEST_ASSUME_DIFFERENT_OWNER: '1', GIT_CONFIG_GLOBAL: empty, GIT_CONFIG_NOSYSTEM: '1' };
+ }],
['a directory at the hook path', (repo: Repo) => { const hook = join(repo.root, '.git', 'custom-hooks', 'post-commit'); rmSync(hook); mkdirSync(hook); return {}; }],
] as Array<[string, (repo: Repo) => Record<string, string>]>)('%s keeps Git effects unfinished with git_unavailable', (_name, damage) => withBrain(kind, async ({ engine, home, ctx }) => {
const repo = makeRepo(home, 'content');
@@ -360,6 +366,14 @@ for (const kind of testBackends()) describe(`#6210 native Git durability probe f
const before = repo.commits();
try {
const env = damage(repo);
+ if (env.GIT_TEST_ASSUME_DIFFERENT_OWNER) {
+ // Precondition: this git build must refuse the checkout under that env, or the case proves nothing.
+ const probe = Bun.spawnSync(['git', '-C', repo.root, 'rev-parse', '--git-path', 'hooks'], { env: { ...process.env, ...env, LC_ALL: 'C' } });
+ if (probe.exitCode === 0 || !probe.stderr.toString().includes('dubious ownership')) {
+ console.warn(`[#6210] skipped: this git (${Bun.spawnSync(['git', '--version']).stdout.toString().trim()}) does not refuse a checkout under GIT_TEST_ASSUME_DIFFERENT_OWNER (exit ${probe.exitCode})`);
+ return;
+ }
+ }
await withEnv(env, async () => { await release(engine); await pass(engine); });
} finally { writeFileSync(join(repo.root, '.git', 'HEAD'), 'ref: refs/heads/main\n'); }
await expectUnfinished(engine, 2);