mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-16 01:45:29 +02:00
* feat: add a restricted and supervised Claude Code runner Preserve configured authentication and models while enforcing tool access, strict completion JSON, bounded output and process cleanup. Cover argv, failure handling, session metadata and Windows process containment. * feat: route outside reviews by harness and migrate wrapper installs Use Claude Code from Codex and Codex from other supported hosts, with shared invocation rendering, positive gate validation and per-phase provenance. Rename /claude to /claude-code, repair managed shared and copied installations safely, and generate native Kiro skills. Add installed-workflow, failure-injection and live cross-harness regression coverage. * test: recognize CEO mode labels without terminal spacing The paid workflow rendered SCOPEEXPANSION at option 4, but its driver required a literal space. Match the leading mode title without cursor-spacing artifacts and ignore adjacent preview text. Preserve missing-target failures and downstream posture assertions. * test: isolate plan-count fixtures before starting review workflows Seed the complete test plan in a private git repository before launching Claude, so a bare slash command cannot review the live workspace while a delayed fixture message remains queued. Preserve count thresholds, parsers and budgets. Add initial-context and installed-discovery tests, and retain startup/terminal diagnostics on failed evaluations. * test: stabilize review fixtures and Claude eval startup Preserve source boundaries in workflow judge inputs, isolate CEO mode plans, and wait for interactive trust input readiness. Keep startup failure evidence and retain existing models, budgets, and assertions. Co-Authored-By: OpenAI Codex <noreply@openai.com> * test: classify collapsed review modes and isolate seeded findings Keep review questions out of the setup count when terminal cursor positioning removes spaces. State existing webhook safeguards so the five-finding control measures its seeded defects without accidental extra security and concurrency gaps. Preserve question bands and the paired control. Co-Authored-By: OpenAI Codex <noreply@openai.com> * test: isolate browser daemon state across free shards Co-Authored-By: OpenAI Codex <noreply@openai.com> * test: stabilize native review counting and interactive navigation Co-Authored-By: OpenAI Codex <noreply@openai.com> * chore: prepare v1.82.0.0 release Co-Authored-By: OpenAI Codex <noreply@openai.com> * fix: eliminate browser and process-cleanup test flakes Pin every CI surface to Bun 1.4.0 to avoid extra-stdio finalizers closing reused live sockets. Add an isolated GC/listener regression that fails on Bun 1.3.13, and prevent coordinated rollback to an affected CI runtime. Check renderer cleanup against the render's own staging directory so concurrent renders cannot invalidate the assertion. Make the no-pgrep process-tree walk tolerate disappearing /proc entries, and synchronize its test fixture through child readiness and pipe EOF instead of sleeps. Validation: 9,157 passed, 31 skipped, zero failures across 556 files with retries disabled. Build, all-host generation freshness, and skill checks passed. All three races have failing-before/passing-after regressions. * fix: count completed native review questions in evals * fix: drive review navigation from confirmed native choices * fix: require complete section-loading eval reports * test: isolate telemetry HTTP transport from local assertions * fix: keep review input on the active native question * test: let tunnel revocation daemon choose an available port * test: allocate available ports for pairing and watchdog fixtures * fix: stabilize planning eval navigation and phase reporting * test: isolate installed runtime paths in planning evals * test: stabilize review evidence and concurrent refresh fixtures * fix: resolve design findings before editing the plan * fix: honor and persist disabled outside plan reviews * fix: preserve planning decisions and terminal evidence Load installed host reviews at autoplan phase entry and wait for completed reviewers and saved artifacts. Reuse approved remedies while preserving individual finding decisions. Drive interactive evals from the current terminal viewport, bind native questions across scrolling, and require complete native report evidence. Cover captured stale menus, permission lifecycles, setup classification, and disabled-review tool availability with deterministic regressions. Advance release metadata and the upgrade migration to the unclaimed 1.83.0.0 slot. * fix: drive native review questions and preserve current plans Use the native single-choice keyboard protocol and current terminal viewport, with per-question navigation inside packets and completed-call coverage. Keep permissions, multi-select menus, and Submit controls distinct. Send Autoplan reviewers the amended implementation plan, keep its review record separate, and supply retained application contracts in the chain fixture. Clarify individual DevEx decisions and complete CEO fix options; use one active plan destination for the section-loading report. * fix: preserve complete plan-review decisions * fix: recognize native plan dialogs and reviewer controls * fix: preserve review decisions and phase completion * fix: recognize completed reviews without losing findings * fix: preserve review continuity and native eval completion * test: fix native review completion and eval retry isolation * test: handle native review menus and complete eval fixtures * test: fix native review setup, completion, and isolation failures * test: limit native skill discovery to runtime assets * fix: bind Autoplan reviews to full ordered phase inputs * test: fix planning eval routing, counting, and timeout handling * chore: advance queued release to v1.84.0.0 * fix: preserve complete review inputs and planning decisions * fix: reconcile review approvals and preserve phase obligations * fix: preserve review obligations and unblock eval permissions Carry recorded Autoplan requirements into blind phase inputs, require Eng review approvals before exit, and exercise combined asynchronous flows in CEO reviews. Correct native finding and handoff classification and unblock repeated report edits using scoped request identities. * fix: retain plan requirements and complete native review dialogs * fix: complete native review prompts and retain plan references * fix: preserve review inputs and classify native eval evidence * fix: check competing completion orders in CEO reviews * fix: recognize review decisions and require phase methodology Require the current phase methodology before Autoplan snapshots. Correct substantive decision, closed handoff, and cache-finding classification, and honor the recommended implementation approach in native review dialogs. Add captured-transcript regressions without changing review thresholds, provider models, retries, or deadlines. * test: bind native review decisions and close completed handoffs * fix: complete review dialogs and verify methodology delivery * fix: preserve review evidence and unblock native eval prompts * fix: handle native review question completions * fix: recognize native review narration and controls * fix: count native review decisions and isolate eval fixtures * test: verify seeded review coverage and current artifact permissions * test: isolate model and brain-aware skill renders * fix: repair native workflow evaluation and clarify review steps * fix: stabilize workflow eval evidence and review guidance * test: repair native workflow observation and fixture isolation * fix: recognize completed workflow evidence and owned skill reads * test: repair seeded workflow delivery and completion evidence * test: recognize current review evidence across native forms * test: handle native review variants and permission redraws * fix: honor review preferences and recognize native eval evidence * test: recognize completed review decisions and queued permissions * test: match current review contracts and partial-line edits * test: recognize completed workflow evidence and bounded human waits * fix: preserve review entry gates and native eval interactions * fix: recognize native workflow evidence and preserve review gates * test: recognize current review evidence and preconfigure workflow fixtures * test: recognize completed review findings and scoped artifact permissions * fix: stabilize native workflow review and permission evidence * fix: recognize current review evidence and scoped edit confirmations Clarify Design and engineering review entry instructions and Design scoring. Recognize required legacy coverage and public Autoplan completion recaps. Bind the pending Edit confirmation to its exact file, ordered digest, and one-request approval when a preceding command display remains visible. Keep reviews within their existing size limits and preserve scope gates when extracting workflow fixtures from either supported preamble header. Keep failure outcomes, review thresholds, provider choices, and eval budgets. * fix: recover review workflow progress and eval evidence * fix: recognize valid review evidence and scope selection * test: fix review evidence parsing and repeated artifact prompts * test: recognize valid review decisions and pending native cards * fix(plan-eng-review): keep final navigation consistent with approved tasks * test: recognize valid review evidence and bind legacy diff requests * fix: stabilize review eval evidence and harness repair guidance * docs: update project documentation for v1.85.0.0 Co-Authored-By: OpenAI Codex <noreply@openai.com> * test: fix Windows CI fixtures and credential scan Rebase captured JSON values and filesystem evidence using the appropriate path convention. Compile native fake CLIs on Windows and synchronize pipe holder readiness, with cleanup retained when assertions fail. Assemble synthetic credential fixtures at runtime so the added-line scan keeps enforcing the same gate without flagging its own rejection controls. Discover generated skills directly for the empty-find regression check, avoiding a recursive scan through saved evaluation artifacts and dependencies. * fix: preserve source renders on Windows Compare canonical generator paths using native separators so an output sidecar pointing at the source cannot overwrite its skill or metadata. Keep the regression fixture isolated from the real checkout and expose freshness diagnostics before asserting subprocess status. Detach Windows drain-test pipe holders from the fake provider's automatic child cleanup while preserving the enclosing runner job and its assertions. * fix: clarify outside review fallback and CEO decisions Render one applicable own-harness fallback path and retain native review, disabled policy, and missing-coverage semantics. Align report field names and mode labels, and make the existing per-cut scope approval explicit. Regenerate skill outputs and keep the workflow judge's model, thresholds, and retry policy unchanged. * chore: move release to free version slot (v1.86.0.0) PR #2852 now claims v1.85.0.0. Align the release metadata and rename migration so upgrades from that version still receive it. Co-Authored-By: OpenAI Codex <noreply@openai.com> * fix: include engineering review prerequisites and restore branch context * fix: recognize coverage diagrams and clarify design review instructions * fix: preserve file identities and join Windows test processes --------- Co-authored-by: OpenAI Codex <noreply@openai.com>
323 lines
14 KiB
TypeScript
323 lines
14 KiB
TypeScript
// E2E: /setup-gbrain Path 4 with Step 4.5 "Yes" — local PGLite for code search.
|
|
//
|
|
// Drives the skill against a stub HTTP MCP server (200 OK on tools/list).
|
|
// Auto-answers AskUserQuestion to pick:
|
|
// - Path 4 at Step 2 (Remote gbrain MCP)
|
|
// - "Yes, set up local PGLite for code" at Step 4.5
|
|
//
|
|
// Asserts that the model:
|
|
// 1. ran the verify helper successfully (got past Step 4c)
|
|
// 2. invoked gstack-gbrain-install (Step 4.5 Yes branch)
|
|
// 3. invoked `gbrain init --pglite --json` (also Step 4.5 Yes branch)
|
|
// 4. registered the remote MCP via claude mcp add --transport http
|
|
// 5. wrote a "Code search ..... OK local-pglite" row to the Step 10 verdict
|
|
//
|
|
// Periodic-tier (codex #12: AgentSDK harness is non-deterministic; gate-tier
|
|
// coverage of the split-engine behavior lives in the deterministic unit
|
|
// tests at gbrain-local-status.test.ts, gbrain-sync-skip.test.ts, etc).
|
|
//
|
|
// Cost: ~$0.50-$1.00 per run. Periodic-tier (EVALS=1 EVALS_TIER=periodic).
|
|
|
|
import { test, expect, afterAll } from 'bun:test';
|
|
import { CAPTURE_MS } from './helpers/eval-budgets';
|
|
import { describeE2ETier, e2eTierEnabled } from './helpers/e2e-gate';
|
|
import * as fs from 'fs';
|
|
import * as os from 'os';
|
|
import * as path from 'path';
|
|
import * as http from 'http';
|
|
import {
|
|
runAgentSdkTest,
|
|
passThroughNonAskUserQuestion,
|
|
resolveClaudeBinary,
|
|
type AgentSdkResult,
|
|
} from './helpers/agent-sdk-runner';
|
|
import { buildSetupGbrainFixture } from './helpers/setup-gbrain-fixture';
|
|
import { EvalCollector } from './helpers/eval-store';
|
|
import { redactFindingSpans } from '../lib/redact-engine';
|
|
|
|
const describeE2E = describeE2ETier('periodic');
|
|
const evalCollector = e2eTierEnabled('periodic') ? new EvalCollector('e2e') : null;
|
|
const FIXTURE_TOKEN = 'gbrain_fake_token_for_test';
|
|
|
|
/** Public diagnostics only; never serialize SDK thinking or credential values. */
|
|
function publicDiagnostics(result: AgentSdkResult) {
|
|
const transcript = result.events.flatMap((event: any) => {
|
|
if (event.type === 'system' && event.subtype === 'init') return [{
|
|
type: event.type, subtype: event.subtype, session_id: event.session_id,
|
|
cwd: event.cwd, model: event.model, tools: event.tools,
|
|
claude_code_version: event.claude_code_version,
|
|
}];
|
|
if (event.type !== 'assistant' && event.type !== 'user') return [];
|
|
const content = Array.isArray(event.message?.content) ? event.message.content.flatMap((block: any) => {
|
|
if (block.type === 'text') return [{ type: block.type, text: block.text }];
|
|
if (block.type === 'tool_use') return [{ type: block.type, id: block.id, name: block.name, input: block.input }];
|
|
if (block.type === 'tool_result') return [{ type: block.type, tool_use_id: block.tool_use_id,
|
|
is_error: block.is_error, content: typeof block.content === 'string' ? block.content :
|
|
Array.isArray(block.content) ? block.content.filter((b: any) => b.type === 'text').map((b: any) => ({ type: 'text', text: b.text })) : [] }];
|
|
return [];
|
|
}) : [];
|
|
return content.length ? [{ type: event.type, session_id: event.session_id,
|
|
parent_tool_use_id: event.parent_tool_use_id,
|
|
message: { id: event.message.id, role: event.message.role, content } }] : [];
|
|
});
|
|
const serialized = JSON.stringify({ output: result.output, transcript, browseErrors: result.browseErrors }).replaceAll(FIXTURE_TOKEN, '<REDACTED-FIXTURE-TOKEN>');
|
|
const redacted = redactFindingSpans(serialized, { repoVisibility: 'private' });
|
|
if (redacted === null) return { output: '[Public diagnostics omitted: redaction limit]', transcript: [], browseErrors: [] };
|
|
try {
|
|
return JSON.parse(redacted);
|
|
} catch {
|
|
// Text redaction can consume JSON delimiters along with a credential URL.
|
|
// Keep only its redacted text; diagnostics must not mask the test verdict.
|
|
return { output: `[Redacted public diagnostics; JSON structure changed]\n${redacted}`, transcript: [], browseErrors: [] };
|
|
}
|
|
}
|
|
|
|
afterAll(async () => { if (evalCollector) await evalCollector.finalize(); });
|
|
|
|
/**
|
|
* Minimal stub MCP server that returns success on initialize / tools/list.
|
|
* Verify helper calls /tools/list with a Bearer header and inspects the body.
|
|
*/
|
|
function startStubMcp(): Promise<{ url: string; close: () => Promise<void> }> {
|
|
return new Promise((resolve) => {
|
|
const server = http.createServer((req, res) => {
|
|
let body = '';
|
|
req.on('data', (c) => (body += c));
|
|
req.on('end', () => {
|
|
res.statusCode = 200;
|
|
res.setHeader('Content-Type', 'text/event-stream');
|
|
// Try to be useful: respond with a fake initialize + tools/list payload.
|
|
let payload: unknown = { jsonrpc: '2.0', id: 1, result: { tools: [] } };
|
|
try {
|
|
const req = JSON.parse(body);
|
|
if (req.method === 'initialize') {
|
|
payload = {
|
|
jsonrpc: '2.0',
|
|
id: req.id,
|
|
result: {
|
|
protocolVersion: '2024-11-05',
|
|
capabilities: { tools: {} },
|
|
serverInfo: { name: 'gbrain', version: '0.32.3.0' },
|
|
},
|
|
};
|
|
}
|
|
} catch {
|
|
// ignore parse failure; default payload
|
|
}
|
|
res.end(`event: message\ndata: ${JSON.stringify(payload)}\n\n`);
|
|
});
|
|
});
|
|
server.listen(0, '127.0.0.1', () => {
|
|
const addr = server.address();
|
|
if (!addr || typeof addr === 'string') throw new Error('no address');
|
|
resolve({
|
|
url: `http://127.0.0.1:${addr.port}/mcp`,
|
|
close: () => new Promise((r) => server.close(() => r())),
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Fake gbrain CLI:
|
|
* - --version → echoes a version
|
|
* - init --pglite --json → writes a pglite config, exits 0
|
|
* - everything else → exits 0 quietly
|
|
*
|
|
* Logs every invocation so we can assert init was called.
|
|
*/
|
|
function makeFakeGbrain(binDir: string, gbrainConfigPath: string): string {
|
|
const callLog = path.join(binDir, 'gbrain-calls.log');
|
|
const script = `#!/bin/bash
|
|
echo "gbrain $@" >> "${callLog}"
|
|
case "$1 $2" in
|
|
"--version "*) echo "gbrain 0.33.1.0"; exit 0 ;;
|
|
"init --pglite") cat > "${gbrainConfigPath}" <<JSON
|
|
{"engine":"pglite","database_url":"pglite:///fake"}
|
|
JSON
|
|
echo '{"status":"ok","engine":"pglite"}'
|
|
exit 0 ;;
|
|
esac
|
|
exit 0
|
|
`;
|
|
fs.writeFileSync(path.join(binDir, 'gbrain'), script, { mode: 0o755 });
|
|
return callLog;
|
|
}
|
|
|
|
/**
|
|
* Fake `claude` CLI for mcp add/remove/get/list. Logs every call so we can
|
|
* assert remote MCP registration happened.
|
|
*/
|
|
function makeFakeClaude(binDir: string): string {
|
|
const callLog = path.join(binDir, 'claude-calls.log');
|
|
const script = `#!/bin/bash
|
|
echo "claude $@" >> "${callLog}"
|
|
case "$1 $2" in
|
|
"mcp add") exit 0 ;;
|
|
"mcp list") echo "gbrain: http://stub/mcp (HTTP) — connected" ; exit 0 ;;
|
|
"mcp remove") exit 0 ;;
|
|
"mcp get") echo '{"type":"http","url":"http://stub/mcp"}'; exit 0 ;;
|
|
esac
|
|
exit 0
|
|
`;
|
|
fs.writeFileSync(path.join(binDir, 'claude'), script, { mode: 0o755 });
|
|
return callLog;
|
|
}
|
|
|
|
/**
|
|
* Fake gstack-gbrain-install so we don't actually clone the gbrain repo +
|
|
* bun-link. The test only cares that the skill INVOKED it on the Yes branch.
|
|
*/
|
|
function makeFakeInstall(binDir: string): string {
|
|
const callLog = path.join(binDir, 'install-calls.log');
|
|
const script = `#!/bin/bash
|
|
echo "install $@" >> "${callLog}"
|
|
exit 0
|
|
`;
|
|
fs.writeFileSync(path.join(binDir, 'gstack-gbrain-install'), script, {
|
|
mode: 0o755,
|
|
});
|
|
return callLog;
|
|
}
|
|
|
|
describeE2E('/setup-gbrain Path 4 + Step 4.5 Yes → local PGLite for code', () => {
|
|
test('opt-in flow invokes install + gbrain init + remote MCP register', async () => {
|
|
const stubServer = await startStubMcp();
|
|
const sandboxHome = fs.mkdtempSync(path.join(os.tmpdir(), 'path4-pglite-'));
|
|
const fakeBinDir = fs.mkdtempSync(path.join(os.tmpdir(), 'path4-pglite-bin-'));
|
|
const gbrainConfigDir = path.join(sandboxHome, '.gbrain');
|
|
fs.mkdirSync(gbrainConfigDir, { recursive: true });
|
|
const gbrainConfigPath = path.join(gbrainConfigDir, 'config.json');
|
|
const claudeLog = makeFakeClaude(fakeBinDir);
|
|
const gbrainLog = makeFakeGbrain(fakeBinDir, gbrainConfigPath);
|
|
const installLog = makeFakeInstall(fakeBinDir);
|
|
|
|
const ORIGINAL_CLAUDE_MD = '# Test project\n';
|
|
fs.writeFileSync(path.join(sandboxHome, 'CLAUDE.md'), ORIGINAL_CLAUDE_MD);
|
|
|
|
const askLog: Array<{ question: string; choice: string }> = [];
|
|
const binary = resolveClaudeBinary();
|
|
|
|
const orig = {
|
|
home: process.env.HOME,
|
|
pathEnv: process.env.PATH,
|
|
mcpToken: process.env.GBRAIN_MCP_TOKEN,
|
|
};
|
|
process.env.HOME = sandboxHome;
|
|
process.env.PATH = `${fakeBinDir}:${path.join(path.resolve(import.meta.dir, '..'), 'bin')}:${process.env.PATH ?? '/usr/bin:/bin:/opt/homebrew/bin'}`;
|
|
process.env.GBRAIN_MCP_TOKEN = FIXTURE_TOKEN;
|
|
|
|
try {
|
|
// Carve-aware fixture (see test/helpers/setup-gbrain-fixture.ts):
|
|
// skeleton + brain-init (Step 4 Path 4 body incl. the Step 4d local
|
|
// PGLite offer this test says Yes to) + claude-md-persist (Step 8 sits
|
|
// on the walked path to Step 10). Non-empty guard inside the builder.
|
|
const skillPath = path.join(sandboxHome, 'setup-gbrain-SKILL.md');
|
|
fs.writeFileSync(
|
|
skillPath,
|
|
buildSetupGbrainFixture(['brain-init.md', 'claude-md-persist.md']),
|
|
);
|
|
const result = await runAgentSdkTest({
|
|
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
userPrompt:
|
|
`Read the skill file at ${skillPath} and follow Path 4 (Remote MCP). ` +
|
|
`Use this MCP URL: ${stubServer.url}. ` +
|
|
`The bearer token is already in GBRAIN_MCP_TOKEN. ` +
|
|
`At Step 4d (the "Want symbol-aware code search?" question), ask me with AskUserQuestion and wait for my answer. ` +
|
|
`Then continue through Step 5a (MCP registration) → Step 10 (verdict). ` +
|
|
`I have not yet chosen whether to set up local PGLite; do not skip that decision.`,
|
|
workingDirectory: sandboxHome,
|
|
env: { GBRAIN_MCP_TOKEN: FIXTURE_TOKEN },
|
|
maxTurns: 25,
|
|
allowedTools: ['Read', 'Grep', 'Glob', 'Bash', 'Write', 'Edit'],
|
|
...(binary ? { pathToClaudeCodeExecutable: binary } : {}),
|
|
canUseTool: async (toolName, input) => {
|
|
if (toolName === 'AskUserQuestion') {
|
|
const qs = input.questions as Array<{
|
|
question: string;
|
|
options: Array<{ label: string }>;
|
|
}>;
|
|
const answers: Record<string, string> = {};
|
|
for (const q of qs) {
|
|
// Heuristics: pick the option that screams "yes/PGLite/code search" for our flow.
|
|
const yes =
|
|
q.options.find((o) =>
|
|
/yes.*local|local.*pglite|code search|opt in/i.test(o.label),
|
|
) ??
|
|
q.options.find((o) => /remote.*mcp|path 4/i.test(o.label)) ??
|
|
q.options[0]!;
|
|
answers[q.question] = yes.label;
|
|
askLog.push({ question: q.question, choice: yes.label });
|
|
}
|
|
return {
|
|
behavior: 'allow',
|
|
updatedInput: { questions: qs, answers },
|
|
};
|
|
}
|
|
return passThroughNonAskUserQuestion(toolName, input);
|
|
},
|
|
});
|
|
|
|
let passed = false;
|
|
try {
|
|
// Smoke test contract (codex #12: AgentSDK is non-deterministic, so this
|
|
// E2E asserts the model followed the SPLIT-ENGINE PATH without depending
|
|
// on the exact subcommand sequence — deterministic per-step coverage
|
|
// lives in gbrain-local-status.test.ts, gbrain-sync-skip.test.ts, etc).
|
|
|
|
// Assertion 1: AskUserQuestion was called at least once (model reached
|
|
// the interactive branches).
|
|
expect(askLog.length).toBeGreaterThan(0);
|
|
|
|
// Assertion 2: at LEAST ONE of the Path 4 / Step 4.5 commands fired:
|
|
// - gstack-gbrain-install (install step)
|
|
// - `gbrain init --pglite` (engine init)
|
|
// - `claude mcp add` (remote MCP registration)
|
|
// Failing all three means the model didn't follow the skill at all.
|
|
const installCalls = fs.existsSync(installLog)
|
|
? fs.readFileSync(installLog, 'utf-8')
|
|
: '';
|
|
const gbrainCalls = fs.existsSync(gbrainLog)
|
|
? fs.readFileSync(gbrainLog, 'utf-8')
|
|
: '';
|
|
const claudeCalls = fs.existsSync(claudeLog)
|
|
? fs.readFileSync(claudeLog, 'utf-8')
|
|
: '';
|
|
const followedPath =
|
|
installCalls.length > 0 ||
|
|
/gbrain init --pglite/.test(gbrainCalls) ||
|
|
/mcp add/.test(claudeCalls);
|
|
expect(followedPath).toBe(true);
|
|
|
|
// Assertion 3: token never leaked to CLAUDE.md (security regression).
|
|
const finalClaudeMd = fs.readFileSync(
|
|
path.join(sandboxHome, 'CLAUDE.md'),
|
|
'utf-8',
|
|
);
|
|
expect(finalClaudeMd).not.toContain(FIXTURE_TOKEN);
|
|
passed = true;
|
|
} finally {
|
|
const diagnostics = publicDiagnostics(result);
|
|
evalCollector?.addTest({
|
|
name: 'setup-gbrain-path4-local-pglite', suite: 'setup-gbrain', tier: 'e2e',
|
|
passed, duration_ms: result.durationMs, cost_usd: result.costUsd,
|
|
output: diagnostics.output, transcript: diagnostics.transcript,
|
|
turns_used: result.turnsUsed, browse_errors: diagnostics.browseErrors,
|
|
exit_reason: result.exitReason, model: result.model,
|
|
first_response_ms: result.firstResponseMs, max_inter_turn_ms: result.maxInterTurnMs,
|
|
});
|
|
}
|
|
} finally {
|
|
if (orig.home === undefined) delete process.env.HOME;
|
|
else process.env.HOME = orig.home;
|
|
if (orig.pathEnv === undefined) delete process.env.PATH;
|
|
else process.env.PATH = orig.pathEnv;
|
|
if (orig.mcpToken === undefined) delete process.env.GBRAIN_MCP_TOKEN;
|
|
else process.env.GBRAIN_MCP_TOKEN = orig.mcpToken;
|
|
await stubServer.close();
|
|
fs.rmSync(sandboxHome, { recursive: true, force: true });
|
|
fs.rmSync(fakeBinDir, { recursive: true, force: true });
|
|
}
|
|
}, CAPTURE_MS);
|
|
});
|