test(plan): cover the final-state tails and refresh the TUI golden

The idle /plan and /plan off command paths pin the immediate-commit copy;
the chip's dead leaving/locked guard is deleted (both states disable the
button, so no click reaches the handler); the multi-turn TUI golden is
re-recorded keyless over the idle-commit wording and the standalone
plan/mode narration ordering.
This commit is contained in:
imccyu
2026-07-28 23:49:38 +08:00
parent a39bd9035e
commit cb8968c80e
3 changed files with 26 additions and 12 deletions

View File

@@ -607,6 +607,20 @@ describe('/plan', () => {
expect(ctx.planMode.get(active)).toEqual({ active: false })
})
it('idle sessions get the immediate-commit copy on both /plan and /plan off', async () => {
const ctx = await setup()
await ctx.plugin(CommandService)
await new Promise(resolve => setImmediate(resolve))
const signal = new AbortController().signal
const agent = await agentWithSession(ctx, 'idle-plan-command', { status: 'idle' })
expect((await ctx.commands.execute(agent, '/plan', signal))?.result)
.toEqual({ kind: 'success', text: 'Plan mode on. Use /plan off to leave.' })
expect(foldPlanMode(agent.session.events)).toBe(true)
expect((await ctx.commands.execute(agent, '/plan off', signal))?.result)
.toEqual({ kind: 'success', text: 'Plan mode off.' })
expect(foldPlanMode(agent.session.events)).toBe(false)
})
it('removes the contributed command when the plan-mode plugin is disposed', async () => {
const ctx = new Context()
await ctx.plugin(SystemPrompt)