Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.
test(cli): await the async git header read before removing Mercury Code temp dirs
Salman Qureshi54d86177b670
diff --git a/src/channels/choice-prompt-timeout.test.ts b/src/channels/choice-prompt-timeout.test.tsindex d24f74aa..5ce0fb82 100644--- a/src/channels/choice-prompt-timeout.test.ts+++ b/src/channels/choice-prompt-timeout.test.ts@@ -79,7 +79,9 @@ describe('choice prompt timeout / dismissal', () => {expect(messages.some(m => m.role === 'agent' && m.content === 'visible reply')).toBe(true);} finally {// enterMercuryCode kicks off an async `git` read with cwd=tmpDir; on- // Windows the directory stays locked until that child exits.+ // Windows the directory stays locked until that child exits, so wait+ // for the in-flight refresh before removing it.+ await channel.refreshMercuryCodeGit();rmSync(tmpDir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });}});diff --git a/src/channels/cli-mercury-code-exit.test.ts b/src/channels/cli-mercury-code-exit.test.tsindex 7cc28be6..ba6abf66 100644--- a/src/channels/cli-mercury-code-exit.test.ts+++ b/src/channels/cli-mercury-code-exit.test.ts@@ -14,7 +14,7 @@ describe('Mercury Code exit paths', () => {vi.restoreAllMocks();});- it('exitMercuryCode tears down Mercury Code state and returns to chat', () => {+ it('exitMercuryCode tears down Mercury Code state and returns to chat', async () => {const channel = new CLIChannel();const dir = mkdtempSync(join(tmpdir(), 'mercury-code-exit-'));try {@@ -33,7 +33,10 @@ describe('Mercury Code exit paths', () => {expect(state.programmingMode).toBe('off');expect(state.exitEscArmed).toBe(false);} finally {- rmSync(dir, { recursive: true, force: true });+ // Wait for the async git header read started by enterMercuryCode;+ // Windows keeps the directory locked while that child runs.+ await channel.refreshMercuryCodeGit();+ rmSync(dir, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });}});