Fix parallel worker chat log orphans

Skip persisted tool-result files for BACKGROUND contexts, remove ephemeral direct parallel worker chat folders during cleanup, and ignore chat directories without chat.json during startup loading.

Add focused regressions for background output persistence, parallel worker cleanup, and orphan directory loading.
This commit is contained in:
Alessandro 2026-06-19 08:11:28 +02:00
parent 77552b9394
commit 78a50e1431
9 changed files with 84 additions and 1 deletions

View file

@ -262,6 +262,19 @@ async def test_parallel_cancel_still_stops_and_removes_running_jobs() -> None:
assert job.id not in agent.context.get_data(parallel_tools.PARALLEL_JOBS_KEY)
@pytest.mark.asyncio
async def test_parallel_remove_context_deletes_persisted_worker_chat(monkeypatch) -> None:
removed = []
from helpers import persist_chat
monkeypatch.setattr(persist_chat, "remove_chat", removed.append)
await parallel_tools._remove_context("missing-worker")
assert removed == ["missing-worker"]
@pytest.mark.asyncio
async def test_parallel_recursion_guard_allows_subordinate_children_but_blocks_tool_workers() -> None:
from extensions.python.tool_execute_before._20_block_parallel_recursion import (