test: defang two flaky tests on main CI

agent.integration "creates an autonomous live turn" — the prompt asked
Claude to use a `Task` tool that doesn't exist in the SDK (Paseo
synthesizes Task entries from sidechain notifications, but Claude can't
invoke it). Haiku non-deterministically refused or complied. Switch to
Bash with run_in_background, matching the deterministic
claude-autonomous-wake-simple.real.e2e variant — same autonomous-wake
mechanism is exercised.

schedule/service "defaults new-agent modeId to provider's unattended
mode" — afterEach raced AgentStorage's background snapshot persist,
producing intermittent ENOTEMPTY rmdirs. Drain pending writes with
agentStorage.flush() before rm.
This commit is contained in:
Mohamed Boudra
2026-05-09 20:46:20 +07:00
parent d88af28e93
commit 5fb6e0e74d
2 changed files with 6 additions and 3 deletions

View File

@@ -378,9 +378,9 @@ describe("ClaudeAgentSession integration", () => {
streamSession(
handle.session,
[
"Use the Task tool to start a background sub-agent.",
"In that task, run the Bash command exactly: sleep 3 && echo BACKGROUND_DONE",
"Do not wait for task completion.",
"Use the Bash tool with run_in_background.",
"Run exactly: sleep 3",
"Do not wait for the task result.",
"Reply immediately with exactly: SPAWNED",
`When the background task completes later, reply with exactly: ${autonomousWakeToken}`,
].join(" "),

View File

@@ -27,6 +27,9 @@ describe("ScheduleService", () => {
});
afterEach(async () => {
// Drain pending background persists before deleting the dir to avoid
// ENOTEMPTY races when AgentManager flushes a snapshot mid-cleanup.
await agentStorage.flush();
await rm(tempDir, { recursive: true, force: true });
});