You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mempalace mine <dir> on a large directory is slow (thousands of files × embedding + upsert). Users commonly Ctrl-C if they realize they pointed at the wrong dir, or just want to stop and come back later. Today this produces a bare KeyboardInterrupt traceback through multiple stack frames — something like:
File ".../mempalace/cli.py", line 168, in cmd_mine
mine(project_dir=args.dir, ...)
File ".../mempalace/miner.py", line 898, in mine
drawers, room = process_file(...)
File ".../mempalace/miner.py", line 730, in process_file
added = add_drawer(...)
File ".../mempalace/miner.py", line 662, in add_drawer
collection.upsert(...)
KeyboardInterrupt
This is ugly, and the user has no signal about:
How many files were processed before the interrupt
Whether partial progress is safe (it is — mine is idempotent on re-run via deterministic drawer IDs)
Whether anything needs cleanup
Proposal
Wrap the main mine() loop in a try / except KeyboardInterrupt block and emit a clean summary:
Mine interrupted.
files_processed: N/M
drawers_filed: K
last_file: <filename>
Re-run `mempalace mine <dir>` to resume — already-filed drawers are
upserted idempotently and will not duplicate.
Exit with code 130 (standard for SIGINT) so shell scripts can distinguish interrupt from error.
Edge cases
Mid-upsert interrupt. ChromaDB upsert() calls are per-batch atomic; a half-processed file is fine because re-running produces the same drawer IDs.
Mid-closet-build interrupt. Closets are rebuilt per file rather than accumulated mid-file — interrupting between files is clean; interrupting during closet LLM/regex pass for a given file means that file's closets will be recomputed on re-mine (acceptable).
Problem
mempalace mine <dir>on a large directory is slow (thousands of files × embedding + upsert). Users commonly Ctrl-C if they realize they pointed at the wrong dir, or just want to stop and come back later. Today this produces a bare KeyboardInterrupt traceback through multiple stack frames — something like:This is ugly, and the user has no signal about:
Proposal
Wrap the main
mine()loop in atry / except KeyboardInterruptblock and emit a clean summary:Exit with code 130 (standard for SIGINT) so shell scripts can distinguish interrupt from error.
Edge cases
upsert()calls are per-batch atomic; a half-processed file is fine because re-running produces the same drawer IDs.finallyso a future mine doesn't see a stale PID.Tests
mine()raises KeyboardInterrupt internally → caller sees exit code 130 and cleanup messageOut of scope