From 63e99ee2bf099344257f34150b31f756e276e06b Mon Sep 17 00:00:00 2001 From: Yichen Jiang Date: Thu, 15 Oct 2026 14:56:55 +0800 Subject: [PATCH] test(goal): disarm the seeded goal in the Loader e2e The goal domain e2e runs over the shipped headless profile, whose base bundle mounts goal-round-driver. GoalService.create() arms the goal the fixture seeds, so the driver queued round 1 when the task turn went idle and the test's headless driver disposed the context mid-round. The assertions held only while the aborted round's turn/end missed the log before disposal; an extra await in the agent loop's pre-step path (#6024) let it land and the test failed deterministically. Disarm the goal right after creating it. Activation is process-local, so the persisted goal/change snapshot is unchanged and the driver starts no round. Also assert a single turn/start, which records a started round even when disposal aborts it before its turn/end is persisted. --- packages/goal/goal/tests/fixtures/domain/seed-goal.ts | 6 +++++- packages/goal/goal/tests/goal.e2e.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/goal/goal/tests/fixtures/domain/seed-goal.ts b/packages/goal/goal/tests/fixtures/domain/seed-goal.ts index 9776438079..9cc4cd8c2c 100644 --- a/packages/goal/goal/tests/fixtures/domain/seed-goal.ts +++ b/packages/goal/goal/tests/fixtures/domain/seed-goal.ts @@ -1,4 +1,4 @@ -/** Test-only Loader plugin that creates a goal at the first real step edge. */ +/** Test-only Loader plugin that creates a disarmed goal at the first real step edge. */ import type { Context } from '@deepseek-ai/cordis' import type {} from '@deepseek-ai/dsh-goal' @@ -13,6 +13,10 @@ export function apply(ctx: Context): void { objective: 'Prove the composed goal survives in the session log', maxGoalRounds: 7, }) + // An armed goal makes the shipped goal-round-driver start a round at + // idle, racing the test driver's disposal. Activation is process-local, + // so disarming leaves the persisted snapshot unchanged. + ctx.goals.disarm(agent) } return next() }) diff --git a/packages/goal/goal/tests/goal.e2e.ts b/packages/goal/goal/tests/goal.e2e.ts index b3f1f4e3c0..7a902ac5b3 100644 --- a/packages/goal/goal/tests/goal.e2e.ts +++ b/packages/goal/goal/tests/goal.e2e.ts @@ -48,6 +48,7 @@ describe('goal domain through the production headless profile and process', () = }) expect(result['output']).toBeTypeOf('string') expect(result['output']).toContain('CLI tool round trip complete') + expect(events.filter(event => event.type === 'turn/start')).toHaveLength(1) expect(events.filter(event => event.type === 'turn/end')).toHaveLength(1) const changes = events.filter(event => event.type === 'goal/change')