Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(docker): bootstrap e2e expects the registration surface stdio registrations pin (#6049)

garrytan0eceda7acbb9
diff --git a/test/check-bootstrap-guards.test.ts b/test/check-bootstrap-guards.test.ts
index 8cbbc86b01..ae8e7d2817 100644
--- a/test/check-bootstrap-guards.test.ts
+++ b/test/check-bootstrap-guards.test.ts
@@ -474,6 +474,18 @@ describe('verify + workflow wiring', () => {
);
expect(wf).toContain('tests/docker/bootstrap-e2e.sh');
});
+
+ test('the nightly-only Docker e2e expects the surface stdio registrations actually pin (#6049)', async () => {
+ const { REGISTRATION_SURFACE, stdioServeArgv } = await import('../src/core/mcp-registration.ts');
+ const { registerCodexMcp } = await import('../src/core/bootstrap/hooks.ts');
+ const inner = require('node:fs').readFileSync(join(ROOT, 'tests/docker/bootstrap-e2e-inner.sh'), 'utf8');
+ const expected = /^EXPECTED_SURFACE=(\S+)$/m.exec(inner)?.[1];
+ expect(expected).toBe(REGISTRATION_SURFACE);
+ expect(inner).toContain('grep -Fq "serve --surface $EXPECTED_SURFACE" "$GB_CODEX_STATE"');
+ const [argv] = registerCodexMcp({ gbrainBin: '/opt/gbrain/bin/gbrain', sourceId: 'workspace' });
+ expect(argv!.join(' ')).toContain(`serve --surface ${expected}`);
+ expect(argv!.slice(-4)).toEqual(stdioServeArgv('/opt/gbrain/bin/gbrain'));
+ });
});
// ── check-grok-pin.sh ────────────────────────────────────────────────────────
diff --git a/tests/docker/bootstrap-e2e-inner.sh b/tests/docker/bootstrap-e2e-inner.sh
index 2169e97759..b0c0f7838a 100644
--- a/tests/docker/bootstrap-e2e-inner.sh
+++ b/tests/docker/bootstrap-e2e-inner.sh
@@ -253,7 +253,12 @@ printf '%s\n' "$codex_out" | grep -Fq "verified targeting this workspace" \
|| fail "codex MCP registration was not verified as targeting this workspace"
[ -f "$WS/.claude/settings.local.json" ] && fail "codex path must not write Claude hooks"
grep -Fq "GBRAIN_SOURCE=" "$GB_CODEX_STATE" || fail "codex registration did not bind GBRAIN_SOURCE"
-grep -Fq "serve --surface full" "$GB_CODEX_STATE" || fail "codex registration did not pin the full op surface"
+# Every stdio registration gbrain writes pins REGISTRATION_SURFACE
+# (src/core/mcp-registration.ts); test/check-bootstrap-guards.test.ts keeps
+# this literal equal to it so a surface change fails on the PR, not nightly.
+EXPECTED_SURFACE=starter
+grep -Fq "serve --surface $EXPECTED_SURFACE" "$GB_CODEX_STATE" \
+ || fail "codex registration did not pin the registration surface '$EXPECTED_SURFACE' (registered: $(cat "$GB_CODEX_STATE")). Why: bootstrap hooks builds the serve argv from stdioServeArgv/REGISTRATION_SURFACE in src/core/mcp-registration.ts. Next: if REGISTRATION_SURFACE changed on purpose, update EXPECTED_SURFACE here; otherwise fix registerCodexMcp in src/core/bootstrap/hooks.ts, then run bash tests/docker/bootstrap-e2e.sh"
# ── opencode door: direct-writer registration, NO binary at all ─────────────
# The opencode lane needs no CLI (the JSONC writer is the registration), so
@@ -263,7 +268,7 @@ grep -Fq "serve --surface full" "$GB_CODEX_STATE" || fail "codex registration di
# below prove the sharing-safe inversion: user-global is the DEFAULT, not
# an echo of a recorded 'project' choice (WS has one; #4293). Asserts:
# user-global default scope, the entry shape (absolute binary,
-# GBRAIN_SOURCE bound, full surface), and no Claude hooks written.
+# GBRAIN_SOURCE bound, a pinned surface), and no Claude hooks written.
step "opencode MCP registration (direct JSONC writer, no binary)"
export XDG_CONFIG_HOME="$SCRATCH/xdg-config"
opencode_out="$(gbrain bootstrap hooks --workspace "$WS2" --harness opencode --gbrain-bin "$FAKE_GBRAIN" 2>&1)"