fix(dream): gate cursor on run completion

This commit is contained in:
chengyongru
2026-08-22 02:05:40 +08:00
committed by chengyongru
parent d853ac239f
commit 1fe36d5dec
5 changed files with 73 additions and 168 deletions
+5 -5
View File
@@ -274,8 +274,8 @@ async def test_dream_keeps_cursor_when_incomplete_with_diff(tmp_path) -> None:
@pytest.mark.asyncio
async def test_dream_keeps_cursor_when_completed_after_tool_error(tmp_path) -> None:
"""A soft tool failure must not masquerade as a verified no-op."""
async def test_dream_advances_cursor_when_completed_after_tool_error(tmp_path) -> None:
"""A handled tool failure does not invalidate a normally completed run."""
ctx, store = _build_runnable_dream(
tmp_path,
initialized=True,
@@ -284,8 +284,8 @@ async def test_dream_keeps_cursor_when_completed_after_tool_error(tmp_path) -> N
)
await cmd_dream(ctx)
await asyncio.sleep(0)
assert store._last_dream_cursor == 5
assert "did not complete" in ctx.loop.bus.outbound[0].content
assert store._last_dream_cursor == 42
assert "no memory changes" in ctx.loop.bus.outbound[0].content
@pytest.mark.asyncio
@@ -339,7 +339,7 @@ async def test_dream_noop_batch_unlocks_following_history(tmp_path) -> None:
@pytest.mark.asyncio
async def test_dream_non_git_falls_back_to_completion_gate(tmp_path) -> None:
"""Non-git workspaces use the same clean-completion gate."""
"""Non-git workspaces use the same normal-completion gate."""
ctx, store = _build_runnable_dream(
tmp_path, initialized=False, content_diff="", stop_reason="completed",
)