diff --git a/README.md b/README.md index 857f400..c748c43 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ The rule is simple: > Make handoffs first. Archive, don't delete. Apply changes only when you are ready. +## Three Modes + +- **Inspect:** report-only, no writes. +- **Maintain:** normal apply; backs up, archives old sessions, moves stale worktrees, rotates logs, prunes dead config, and normalizes paths. It does not trim thread title/preview metadata. +- **Optional repair:** only with `--apply --repair-thread-metadata-bloat`; shortens oversized SQLite display title/preview metadata after backup. The transcript stays intact. + ## Who This Is For Use this if Codex has started feeling slower after heavy use, especially if you: @@ -30,24 +36,15 @@ It helps Codex: - create handoff docs before archiving old chats - back up important state before applying changes - archive old chats instead of deleting them +- detect pathological thread title/preview metadata that can slow chat navigation - move stale worktrees out of the hot path - rotate large logs - prune dead project references - report heavy Node/dev processes without killing them -## Install - -Ask Codex: - -```text -Install the keep-codex-fast skill from https://github.com/vibeforge1111/keep-codex-fast -``` - -Or clone/copy this folder into your Codex skills directory as `keep-codex-fast`. - ## Quick Start -After installing, ask Codex: +Ask Codex: ```text Use $keep-codex-fast to inspect my Codex local state and recommend a safe maintenance plan. @@ -105,6 +102,24 @@ Then back up first, archive instead of deleting, move stale worktrees, rotate la If Codex is currently running, do not mutate local state. Tell me to close Codex first. ``` +## Thread Title And Preview Bloat + +Some Codex builds can store a full first user prompt as both the thread title and the list preview. When those fields grow into hundreds of thousands of characters, thread navigation can become sluggish even before a large chat is opened. + +The script reports title and preview payload size in report mode and normal apply mode. It does not trim this metadata unless you explicitly opt in: + +```bash +python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat +``` + +With that flag, after backing up and only when Codex is not running, it trims active SQLite title/preview metadata to bounded display values. It also appends repaired titles to `session_index.jsonl`, which matches current Codex name-update storage. + +This does not remove the actual conversation transcript. The full rollout JSONL remains available unless you separately archive the session. + +The repair manifest stores the old full title/preview values so you can restore them. Keep the backup folder private, especially `thread-metadata-repairs.jsonl` and `restore-thread-metadata.py`. + +If you are using the skill normally, this repair does not happen automatically. Treat it as an extra recommendation only when the report shows unusually large title/preview metadata. + ## Weekly Or Biweekly Reminder Recurring maintenance should be a reminder, not an automatic apply. @@ -128,6 +143,16 @@ The reminder should: - tell me that manual apply should only happen after I confirm handoffs exist or are not needed and Codex is closed ``` +## Install + +Ask Codex: + +```text +Install the keep-codex-fast skill from https://github.com/vibeforge1111/keep-codex-fast +``` + +Or clone/copy this folder into your Codex skills directory as `keep-codex-fast`. + ## Advanced: Manual Script Use Most users can stay inside Codex and use the prompts above. The script is here for people who want to run it directly. @@ -152,12 +177,18 @@ python scripts/keep_codex_fast.py --backup-only Backup folders can contain private local Codex metadata. Keep them on your machine, and do not publish or share them unless you have reviewed what is inside. -Apply archive/maintenance actions: +Apply core maintenance actions. This does not trim thread title/preview metadata: ```bash python scripts/keep_codex_fast.py --apply --archive-older-than-days 10 --worktree-older-than-days 7 ``` +Optionally repair oversized title/preview metadata only when the report recommends it: + +```bash +python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat +``` + Wait for Codex to exit before applying: ```bash @@ -173,6 +204,7 @@ The skill can safely handle: - large `logs_2.sqlite*` files - dead/temp project entries in `config.toml` - Windows `\\?\C:\...` path mismatches in local SQLite text fields +- oversized thread title and first-message preview metadata in `state_5.sqlite`, only with `--repair-thread-metadata-bloat` It does not permanently delete chats, logs, or worktrees. It moves them into archive folders and writes backup/restore artifacts before applying changes. diff --git a/SKILL.md b/SKILL.md index 8580d9f..d8d4090 100644 --- a/SKILL.md +++ b/SKILL.md @@ -26,6 +26,14 @@ Primary principle: preserve continuity before applying changes. For active repo - Before archiving any active repo chat the user may want to continue, recommend creating a comprehensive handoff doc plus a reactivation prompt. - Do not archive old-but-important active repo chats until the user either confirms a handoff exists or confirms they do not need one. +## Mental Model + +There are three modes: + +- Inspect: report-only, no writes. +- Maintain: normal `--apply`; backs up, archives old sessions, moves stale worktrees, rotates logs, prunes dead config, and normalizes paths. It does not trim thread title/preview metadata. +- Optional repair: `--apply --repair-thread-metadata-bloat`; shortens oversized SQLite display title/preview metadata after backup. The rollout transcript stays intact. + ## Default Workflow 1. Reassure the user: the first run is read-only, privacy-safe, and the skill archives instead of deleting when changes are later applied. @@ -39,6 +47,7 @@ python scripts/keep_codex_fast.py - active session size - archived session size - largest active sessions + - thread metadata bloat: active title/preview character totals, max title/preview lengths, and over-limit counts - stale worktree candidates - log size - bad Windows `\\?\` path counts @@ -76,6 +85,7 @@ If the user wants automation and the Codex app automation tool is available, cre - Moves stale worktrees to `~/.codex/archived_worktrees/`. - Rotates `logs_2.sqlite*` into `~/.codex/archived_logs/` only when above the threshold. - Reports heavy Node processes without killing them. +- Reports pathological active thread titles and `first_user_message` previews. It only repairs them when the user explicitly opts in with `--repair-thread-metadata-bloat`. Report mode does none of those mutations. It only prints counts and pseudonymous candidates. Use `--details` when raw IDs, titles, or paths are needed for diagnosis. @@ -87,6 +97,25 @@ Report mode does none of those mutations. It only prints counts and pseudonymous - Run weekly maintenance if Codex is used daily across many repos/terminals. - Offer weekly or biweekly report-only reminders after the first successful apply; do not assume the user wants recurring maintenance. - When in doubt, leave a chat active or ask the user. Never archive a chat that is pinned, current, or explicitly marked as still needed without a handoff. +- Treat title/preview repair as metadata repair only. The full rollout transcript remains in the session JSONL; bounded SQLite fields are for list/navigation display. + +## Thread Metadata Bloat + +Codex Desktop can become slow when `threads.title` or `threads.first_user_message` stores a full prompt/history-sized value instead of a display title or preview. This affects the thread list/navigation path before the UI renders anything. + +The script reports active thread count, total title/preview characters, maximum title/preview length, active titles over the configured title limit, and active previews over the configured preview limit and over 10k characters. + +Normal apply mode reports metadata-bloat candidates but does not repair them. If the user explicitly opts in, after backups and only when Codex is not running, run: + +```bash +python scripts/keep_codex_fast.py --apply --repair-thread-metadata-bloat +``` + +That bounds active `threads.title` and `threads.first_user_message` values. Defaults are 120 characters for titles and 240 characters for previews. It also appends repaired titles to `session_index.jsonl`, matching current upstream name-update storage, so reconciliation/name lookup does not immediately prefer the old full-message fallback. + +The targeted repair manifest stores the old full title/preview values so the change can be reversed. Treat `thread-metadata-repairs.jsonl`, `restore-thread-metadata.py`, and the whole backup folder as private local artifacts. + +This is a local maintenance workaround for metadata bloat. It does not solve app renderer hydration of very large rollout histories; that needs upstream staged/paged thread loading. ## Handoff Doc + Reactivation Prompt @@ -162,6 +191,7 @@ Avoid these behaviors: - applying changes while Codex is actively writing the DB - archiving important repo chats before creating handoff docs - treating active history size as "bad" without checking whether the user needs continuity +- treating preview metadata repair as deletion of the actual rollout transcript - killing Node/dev processes automatically - rewriting `config.toml` without a backup and parse check - writing UTF-8 TOML with a BOM on Windows @@ -172,4 +202,6 @@ Avoid these behaviors: Tell users this does not permanently delete chats, worktrees, or logs. It moves them into archive folders and writes restore helpers. The only removed content is stale metadata, such as project entries pointing to folders that no longer exist, and even that happens after backing up `config.toml`. -Also tell users backup folders can contain private local Codex metadata. They should keep backups local and avoid publishing or sharing them unless they have reviewed what is inside. +Also tell users that thread title/preview bloat repair is not part of normal apply. Normal use only reports title/preview bloat. Recommend `--repair-thread-metadata-bloat` only as an optional extra when the report shows large metadata payloads and the user understands that SQLite display metadata will be shortened while the real transcript remains in rollout JSONL. + +Also tell users backup folders can contain private local Codex metadata, including old thread titles and first-message previews. They should keep backups local and avoid publishing or sharing them unless they have reviewed what is inside. diff --git a/scripts/keep_codex_fast.py b/scripts/keep_codex_fast.py index cf404f3..0bb3eb6 100644 --- a/scripts/keep_codex_fast.py +++ b/scripts/keep_codex_fast.py @@ -30,6 +30,8 @@ r"(\\AppData\\Local\\Temp\\|/AppData/Local/Temp/|\\Temp\\codex-|/Temp/codex-|\\Temp\\spark-|/Temp/spark-)", re.I, ) +DEFAULT_TITLE_LIMIT = 120 +DEFAULT_PREVIEW_LIMIT = 240 @dataclass @@ -42,6 +44,15 @@ class SessionCandidate: updated_at: int | None +@dataclass +class ThreadMetadataRepair: + thread_id: str + old_title: str + new_title: str + old_preview: str + new_preview: str + + def now_stamp() -> str: return datetime.now().strftime("%Y%m%d-%H%M%S") @@ -212,6 +223,234 @@ def normalize_extended_path(value: str) -> str: return value +def table_columns(conn: sqlite3.Connection, table: str) -> set[str]: + try: + return {row[1] for row in conn.execute(f'pragma table_info("{table}")').fetchall()} + except sqlite3.Error: + return set() + + +def has_threads_columns(conn: sqlite3.Connection, required: set[str]) -> bool: + return required.issubset(table_columns(conn, "threads")) + + +def bounded_text(value: str, limit: int) -> str: + text = " ".join(value.split()) + if len(text) <= limit: + return text + if limit <= 3: + return text[:limit] + return text[: limit - 3].rstrip() + "..." + + +def append_session_index_name(codex_home: Path, thread_id: str, name: str) -> None: + path = codex_home / "session_index.jsonl" + path.parent.mkdir(parents=True, exist_ok=True) + entry = { + "id": thread_id, + "thread_name": name, + "updated_at": datetime.utcnow().isoformat(timespec="milliseconds") + "Z", + } + with path.open("a", encoding="utf-8") as handle: + handle.write(json.dumps(entry, ensure_ascii=False) + "\n") + + +def report_thread_metadata_bloat( + conn: sqlite3.Connection, + *, + title_limit: int, + preview_limit: int, +) -> None: + columns = table_columns(conn, "threads") + if not {"id", "title"}.issubset(columns): + report("thread_metadata_bloat skipped_missing_threads_columns") + return + archived_expr = "COALESCE(archived,0)=0" if "archived" in columns else "archived_at is null" + preview_col = "first_user_message" if "first_user_message" in columns else None + if preview_col: + row = conn.execute( + f""" + select + count(*), + coalesce(sum(length(title)), 0), + coalesce(sum(length(first_user_message)), 0), + coalesce(max(length(title)), 0), + coalesce(max(length(first_user_message)), 0), + sum(case when length(title) > ? then 1 else 0 end), + sum(case when length(first_user_message) > ? then 1 else 0 end), + sum(case when length(first_user_message) > 10000 then 1 else 0 end) + from threads + where {archived_expr} + """, + (title_limit, preview_limit), + ).fetchone() + ( + active_rows, + title_chars, + preview_chars, + max_title, + max_preview, + title_over_limit, + preview_over_limit, + preview_over_10k, + ) = row + else: + row = conn.execute( + f""" + select + count(*), + coalesce(sum(length(title)), 0), + coalesce(max(length(title)), 0), + sum(case when length(title) > ? then 1 else 0 end) + from threads + where {archived_expr} + """, + (title_limit,), + ).fetchone() + active_rows, title_chars, max_title, title_over_limit = row + preview_chars = max_preview = preview_over_limit = preview_over_10k = 0 + + report(f"thread_active_rows {active_rows}") + report(f"thread_title_chars {title_chars}") + report(f"thread_first_user_message_chars {preview_chars}") + report(f"thread_max_title_chars {max_title}") + report(f"thread_max_first_user_message_chars {max_preview}") + report(f"thread_titles_over_limit {title_over_limit or 0}") + report(f"thread_first_user_message_over_limit {preview_over_limit or 0}") + report(f"thread_first_user_message_over_10k {preview_over_10k or 0}") + + +def repair_thread_metadata_bloat( + conn: sqlite3.Connection, + codex_home: Path, + backup_root: Path, + *, + apply: bool, + details: bool, + title_limit: int, + preview_limit: int, +) -> None: + required = {"id", "title"} + if not has_threads_columns(conn, required): + report("thread_metadata_repair skipped_missing_threads_columns") + return + columns = table_columns(conn, "threads") + has_preview = "first_user_message" in columns + archived_expr = "COALESCE(archived,0)=0" if "archived" in columns else "archived_at is null" + select_preview = "first_user_message" if has_preview else "''" + rows = conn.execute( + f""" + select id, title, {select_preview} + from threads + where {archived_expr} + and ( + length(title) > ? + {"or length(first_user_message) > ?" if has_preview else ""} + ) + """, + (title_limit, preview_limit) if has_preview else (title_limit,), + ).fetchall() + + repairs: list[ThreadMetadataRepair] = [] + for thread_id, title, preview in rows: + old_title = title or "" + old_preview = preview or "" + new_title = bounded_text(old_title, title_limit) + new_preview = bounded_text(old_preview, preview_limit) if has_preview else "" + if new_title != old_title or new_preview != old_preview: + repairs.append( + ThreadMetadataRepair( + str(thread_id), + old_title, + new_title, + old_preview, + new_preview, + ) + ) + + report(f"thread_metadata_repair_candidates {len(repairs)}") + for index, item in enumerate(repairs[:10], start=1): + label = f"thread_{index:03d}" + title_delta = len(item.old_title) - len(item.new_title) + preview_delta = len(item.old_preview) - len(item.new_preview) + if details: + report( + f"thread_metadata_repair_candidate {label} thread_id={item.thread_id} " + f"title_delta={title_delta} preview_delta={preview_delta}" + ) + else: + report( + f"thread_metadata_repair_candidate {label} " + f"title_delta={title_delta} preview_delta={preview_delta}" + ) + + if not apply or not repairs: + return + + manifest = backup_root / "thread-metadata-repairs.jsonl" + with manifest.open("w", encoding="utf-8") as handle: + for item in repairs: + record = { + "thread_id": item.thread_id, + "old_title": item.old_title, + "new_title": item.new_title, + "old_first_user_message": item.old_preview, + "new_first_user_message": item.new_preview, + } + handle.write(json.dumps(record, ensure_ascii=False) + "\n") + + cur = conn.cursor() + for item in repairs: + if has_preview: + cur.execute( + "update threads set title=?, first_user_message=? where id=?", + (item.new_title, item.new_preview, item.thread_id), + ) + else: + cur.execute( + "update threads set title=? where id=?", + (item.new_title, item.thread_id), + ) + if item.new_title and item.new_title != item.old_title: + append_session_index_name(codex_home, item.thread_id, item.new_title) + report("thread_metadata_repair applied") + report(f"thread_metadata_repair_manifest {manifest}") + write_thread_metadata_restore_script(manifest, codex_home / "state_5.sqlite", backup_root) + + +def write_thread_metadata_restore_script(manifest: Path, state_db: Path, backup_root: Path) -> None: + restore = backup_root / "restore-thread-metadata.py" + restore.write_text( + f'''import json +import sqlite3 +from pathlib import Path + +manifest = Path(r"{manifest}") +db = Path(r"{state_db}") +conn = sqlite3.connect(db) +conn.execute("pragma busy_timeout=10000") +cols = {{row[1] for row in conn.execute('pragma table_info("threads")').fetchall()}} +has_preview = "first_user_message" in cols +for line in manifest.read_text(encoding="utf-8").splitlines(): + rec = json.loads(line) + if has_preview: + conn.execute( + "update threads set title=?, first_user_message=? where id=?", + (rec["old_title"], rec["old_first_user_message"], rec["thread_id"]), + ) + else: + conn.execute( + "update threads set title=? where id=?", + (rec["old_title"], rec["thread_id"]), + ) +conn.commit() +conn.close() +''', + encoding="utf-8", + ) + report(f"thread_metadata_restore_script {restore}") + + def normalize_sqlite_paths(conn: sqlite3.Connection, apply: bool) -> int: cur = conn.cursor() total = 0 @@ -530,6 +769,20 @@ def run(args: argparse.Namespace) -> int: conn = sqlite_connect(state_db, readonly=not effective_apply) conn.execute("pragma busy_timeout=10000") normalize_sqlite_paths(conn, effective_apply) + report_thread_metadata_bloat( + conn, + title_limit=args.thread_title_limit, + preview_limit=args.thread_preview_limit, + ) + repair_thread_metadata_bloat( + conn, + codex_home, + backup_root, + apply=effective_apply and args.repair_thread_metadata_bloat, + details=args.details, + title_limit=args.thread_title_limit, + preview_limit=args.thread_preview_limit, + ) candidates = active_session_candidates(conn, codex_home, args.archive_older_than_days) archive_sessions(conn, candidates, codex_home, backup_root, stamp, effective_apply, args.details) if effective_apply: @@ -576,9 +829,30 @@ def parse_args(argv: list[str]) -> argparse.Namespace: parser.add_argument("--archive-older-than-days", type=int, default=10) parser.add_argument("--worktree-older-than-days", type=int, default=7) parser.add_argument("--rotate-logs-above-mb", type=int, default=64) + parser.add_argument( + "--thread-title-limit", + type=int, + default=DEFAULT_TITLE_LIMIT, + help="Title length threshold for metadata-bloat reporting and optional repair.", + ) + parser.add_argument( + "--thread-preview-limit", + type=int, + default=DEFAULT_PREVIEW_LIMIT, + help="Preview length threshold for metadata-bloat reporting and optional repair.", + ) + parser.add_argument( + "--repair-thread-metadata-bloat", + action="store_true", + help="With --apply, trim oversized thread title/preview metadata. Default --apply only reports candidates.", + ) args = parser.parse_args(argv) if args.apply and args.backup_only: parser.error("--apply and --backup-only cannot be used together") + if args.thread_title_limit < 20: + parser.error("--thread-title-limit must be at least 20") + if args.thread_preview_limit < args.thread_title_limit: + parser.error("--thread-preview-limit must be greater than or equal to --thread-title-limit") return args diff --git a/tests/smoke_test.py b/tests/smoke_test.py index 76bc56e..4bc43fb 100644 --- a/tests/smoke_test.py +++ b/tests/smoke_test.py @@ -56,13 +56,16 @@ def make_fake_home(root: Path) -> dict[str, Path]: state_db = codex_home / "state_5.sqlite" conn = sqlite3.connect(state_db) conn.execute( - "create table threads (id text primary key, title text, rollout_path text, cwd text, updated_at integer, archived_at integer, archived integer)" + "create table threads (id text primary key, title text, first_user_message text, rollout_path text, cwd text, updated_at integer, archived_at integer, archived integer)" ) + long_title = "Title " + ("x" * 300) + long_preview = "Preview " + ("y" * 600) conn.execute( - "insert into threads values (?,?,?,?,?,?,?)", + "insert into threads values (?,?,?,?,?,?,?,?)", ( "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", - "Old test thread", + long_title, + long_preview, str(rollout), r"\\?\C:\DefinitelyMissingKeepCodexFast", int(old_time), @@ -96,6 +99,9 @@ def assert_report_mode(module) -> None: archive_older_than_days=10, worktree_older_than_days=7, rotate_logs_above_mb=0, + thread_title_limit=120, + thread_preview_limit=240, + repair_thread_metadata_bloat=False, ) output = io.StringIO() with contextlib.redirect_stdout(output): @@ -106,8 +112,15 @@ def assert_report_mode(module) -> None: assert paths["log_file"].exists(), "report mode must not rotate logs" assert not backup.exists(), "report mode must not create backup artifacts" assert "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" not in text - assert "Old test thread" not in text assert str(paths["codex_home"]) not in text + conn = sqlite3.connect(paths["state_db"]) + title, preview = conn.execute( + "select title, first_user_message from threads where id=?", + ("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",), + ).fetchone() + conn.close() + assert len(title) > 120, "report mode must not trim titles" + assert len(preview) > 240, "report mode must not trim previews" def assert_backup_only_mode(module) -> None: @@ -124,6 +137,9 @@ def assert_backup_only_mode(module) -> None: archive_older_than_days=10, worktree_older_than_days=7, rotate_logs_above_mb=0, + thread_title_limit=120, + thread_preview_limit=240, + repair_thread_metadata_bloat=False, ) assert module.run(args) == 0 assert paths["rollout"].exists(), "backup-only mode must not move sessions" @@ -132,6 +148,14 @@ def assert_backup_only_mode(module) -> None: assert (backup / "state_5.sqlite").exists() assert (backup / "config.toml").exists() assert not (backup / "moved-sessions.jsonl").exists() + conn = sqlite3.connect(paths["state_db"]) + title, preview = conn.execute( + "select title, first_user_message from threads where id=?", + ("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",), + ).fetchone() + conn.close() + assert len(title) > 120, "backup-only mode must not trim titles" + assert len(preview) > 240, "backup-only mode must not trim previews" def assert_session_alias_detection(module) -> None: @@ -169,12 +193,15 @@ def assert_apply_mode(module) -> None: archive_older_than_days=10, worktree_older_than_days=7, rotate_logs_above_mb=0, + thread_title_limit=120, + thread_preview_limit=240, + repair_thread_metadata_bloat=True, ) assert module.run(args) == 0 conn = sqlite3.connect(paths["state_db"]) - archived, archived_at, rollout_path, cwd = conn.execute( - "select archived, archived_at, rollout_path, cwd from threads where id=?", + archived, archived_at, rollout_path, cwd, title, preview = conn.execute( + "select archived, archived_at, rollout_path, cwd, title, first_user_message from threads where id=?", ("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",), ).fetchone() conn.close() @@ -183,6 +210,8 @@ def assert_apply_mode(module) -> None: assert archived_at is not None assert "archived_sessions" in rollout_path assert cwd == r"C:\DefinitelyMissingKeepCodexFast" + assert len(title) <= 120 + assert len(preview) <= 240 assert not paths["rollout"].exists() assert not paths["worktree"].exists() assert not paths["log_file"].exists() @@ -190,8 +219,46 @@ def assert_apply_mode(module) -> None: encoding="utf-8" ) assert (backup / "restore-sessions.py").exists() + assert (backup / "restore-thread-metadata.py").exists() assert (backup / "moved-sessions.jsonl").exists() + assert (backup / "thread-metadata-repairs.jsonl").exists() assert (backup / "moved-worktrees.jsonl").exists() + session_index = paths["codex_home"] / "session_index.jsonl" + assert session_index.exists() + assert "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" in session_index.read_text(encoding="utf-8") + + +def assert_normal_apply_does_not_repair_thread_metadata(module) -> None: + with tempfile.TemporaryDirectory() as td: + paths = make_fake_home(Path(td)) + backup = Path(td) / "backup-normal-apply" + args = argparse.Namespace( + apply=True, + backup_only=False, + details=False, + wait_for_codex_exit=False, + codex_home=str(paths["codex_home"]), + backup_root=str(backup), + archive_older_than_days=10, + worktree_older_than_days=7, + rotate_logs_above_mb=64, + thread_title_limit=120, + thread_preview_limit=240, + repair_thread_metadata_bloat=False, + ) + assert module.run(args) == 0 + + conn = sqlite3.connect(paths["state_db"]) + title, preview = conn.execute( + "select title, first_user_message from threads where id=?", + ("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",), + ).fetchone() + conn.close() + + assert len(title) > 120, "normal apply must not trim titles without explicit repair flag" + assert len(preview) > 240, "normal apply must not trim previews without explicit repair flag" + assert not (backup / "thread-metadata-repairs.jsonl").exists() + assert not (backup / "restore-thread-metadata.py").exists() def main() -> int: @@ -199,6 +266,7 @@ def main() -> int: assert_report_mode(module) assert_backup_only_mode(module) assert_session_alias_detection(module) + assert_normal_apply_does_not_repair_thread_metadata(module) assert_apply_mode(module) print("smoke tests passed") return 0