Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(ci): unit-lane PostgreSQL arms run one process per file; deactivate test attaches its rejection handler first

garrytand380c57fb9ba
diff --git a/.github/workflows/persistence-validation.yml b/.github/workflows/persistence-validation.yml
index bbf20441ea..845484140d 100644
--- a/.github/workflows/persistence-validation.yml
+++ b/.github/workflows/persistence-validation.yml
@@ -265,7 +265,21 @@ jobs:
) ;;
*) echo "::error::unknown shard $SHARD" >&2; exit 1 ;;
esac
- bun --no-env-file test --timeout=120000 "${files[@]}"
+ # One bun process per file: *.serial.test.ts files require their own
+ # process, and a test that fails while its body keeps running would
+ # otherwise leak process.env into every later file (one such leak
+ # deleted DATABASE_URL for the rest of a shard and silently dropped
+ # those files' PostgreSQL arms).
+ failed=()
+ for file in "${files[@]}"; do
+ echo "::group::$file"
+ bun --no-env-file test --timeout=120000 "$file" || failed+=("$file")
+ echo "::endgroup::"
+ done
+ for file in ${failed[@]+"${failed[@]}"}; do
+ echo "::error file=$file::PostgreSQL arm failed. Reproduce: DATABASE_URL=<pgvector test database> GBRAIN_TEST_ALLOW_DATABASE_URL=1 bun test $file"
+ done
+ [ "${#failed[@]}" -eq 0 ]
invariants:
name: ${{ matrix.engine }} / Bun ${{ matrix.bun }}
diff --git a/test/persistence-deactivate.test.ts b/test/persistence-deactivate.test.ts
index 37a7e48033..859f85e760 100644
--- a/test/persistence-deactivate.test.ts
+++ b/test/persistence-deactivate.test.ts
@@ -66,8 +66,9 @@ for (const databaseUrl of process.env.DATABASE_URL ? [undefined, process.env.DAT
suggestion: expect.stringContaining(`gbrain cancel-write-request ${request.request_id}`) });
await protocol(engine, "UPDATE persistence_requests SET state='committed' WHERE id=$1::uuid", [request.id]);
+ const current = await writerAdminState(engine);
await expect(admin(engine, 'writer_deactivate', { admin_intent: 'writer_deactivate', expected_state: 'f'.repeat(64) }))
- .rejects.toMatchObject({ code: 'writer_admin_state_changed', suggestion: expect.stringContaining(`The current admin_state is ${await writerAdminState(engine)}`) });
+ .rejects.toMatchObject({ code: 'writer_admin_state_changed', suggestion: expect.stringContaining(`The current admin_state is ${current}`) });
await expect(admin(engine, 'writer_deactivate', { source_id: 'default', dry_run: true })).rejects.toMatchObject({ code: 'invalid_params',
message: expect.stringContaining('brain-wide') });
const stdio = await registerLocalWriter(engine, 'stdio');