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

@ -12,6 +12,7 @@
- Preserve tool result traceability without leaking secrets.
- Keep file artifacts inside expected runtime/user-owned paths.
- Skip BACKGROUND contexts; background workers must remain ephemeral and must not create chat message files.
## Work Guidance

View file

@ -1,4 +1,5 @@
from typing import Any
from agent import AgentContextType
from helpers.extension import Extension
from helpers import files, persist_chat
import os, re
@ -9,6 +10,9 @@ class SaveToolCallFile(Extension):
def execute(self, data: dict[str, Any] | None = None, **kwargs):
if not self.agent:
return
if self.agent.context.type == AgentContextType.BACKGROUND:
return
if not data:
return