Commit Graph

3 Commits

Author SHA1 Message Date
Codex
0064654d8f fix(scripts): recover group folder for already-unregistered rooms
When a room was unregistered first (room_settings row already gone), the
folder was unknown, so sessions rows and the on-disk group/workspace/session/
ipc folders (and any git worktree) were silently skipped — leaving orphans.
Back-trace the folder from the group_folder recorded on the chat's leftover
paired_tasks/work_items/scheduled_tasks/service_handoffs/paired_projects rows
so folder-scoped cleanup still runs. Targets now carry a folder list.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-18 23:44:26 +09:00
Codex
e21308db1f fix(scripts): prune scheduled-task run logs + auto-backup on deregister
task_run_logs.task_id references scheduled_tasks.id, not paired_tasks.id, so
the previous deletion (keyed by paired task ids) left orphaned run-log rows
behind — with foreign_keys OFF nothing cleaned them up. Delete task_run_logs
by the chat's scheduled_tasks ids before removing the scheduled_tasks rows.

Also auto-back up the DB to /home/claude/ejclaw-db-backup-<ts>.db before the
irreversible purge (skippable with --no-backup).

Verified end-to-end in a sandboxed DB copy: a seeded room's scheduled task +
3 run logs, paired data, work items, sessions, and router cursor are all
removed, disk folders deleted, while chats/messages and unrelated rooms stay
intact.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-18 23:38:35 +09:00
Codex
77426fc15c feat(scripts): add deregister-room purge script
Reusable script to fully unregister chat room(s) and purge all managed data
while keeping ONLY the chats channel row and messages history. Removes room
registration, paired tasks/turns/attempts/outputs/reservations/leases/
projects/handoffs, work items, scheduled tasks, sessions, router cursor, and
the on-disk group/workspace/session/ipc folders (git worktrees removed
cleanly). Supports --dry-run, refuses main rooms without --force, and skips
disk deletion for group folders still shared by another room.

Backs the "채팅 등록 해제" standing workflow (unregister + purge + restart).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-18 23:30:35 +09:00