diff --git a/src/void_tools/cli.py b/src/void_tools/cli.py index bab6028..7087493 100644 --- a/src/void_tools/cli.py +++ b/src/void_tools/cli.py @@ -516,10 +516,19 @@ def cmd_dispatch(args): except Exception as e: print(f"Error updating inbox.yaml: {e}") - # Always delete the outbox file after successful dispatch to prevent stale state loops + # Move the outbox file to an archive directory instead of deleting it try: - os.remove(args.file) - print(f"Cleared {args.file} to prevent state desynchronization.") + import datetime + import shutil + + archive_dir = "outbox_archive" + os.makedirs(archive_dir, exist_ok=True) + + timestamp = datetime.datetime.now(datetime.UTC).strftime('%Y%m%d_%H%M%S') + archive_path = os.path.join(archive_dir, f"{timestamp}_outbox.yaml") + + shutil.move(args.file, archive_path) + print(f"Archived {args.file} to {archive_path} to prevent state desynchronization.") # If any memfs updates happened, trigger a git add/commit in the background agent_id = os.getenv("AGENT_ID")