{"slug": "disable-codex-sqlite-diagnostic-logging-on-windows", "title": "Disable Codex SQLite diagnostic logging on Windows", "summary": "A developer reported that Codex SQLite diagnostic logging was generating excessive SSD writes, with approximately 37 TB of total writes over 21 days. OpenAI merged three pull requests to reduce log traffic by about 85%, but continuing writes have been reported in later versions. A workaround using a SQLite trigger can disable diagnostic logging for environments where SSD write volume is a concern.", "body_md": "Last updated: July 25, 2026\n\nWarning\n\nThis is an unofficial workaround, not an OpenAI-supported configuration. It disables local diagnostic records used for feedback and troubleshooting. Re-enable logging before collecting data for a support request.\n\nThis note explains how to stop the Windows Codex Desktop app from writing diagnostic records to `%USERPROFILE%\\.codex\\logs_2.sqlite`\n\n.\n\nIt does not disable the separate databases that store conversation and application state.\n\n[Issue #28224](https://github.com/openai/codex/issues/28224) in OpenAI's official GitHub repository reported that Codex SQLite diagnostic logging was generating excessive SSD writes.\n\nThe affected files were:\n\n`%USERPROFILE%\\.codex\\logs_2.sqlite`\n\n`%USERPROFILE%\\.codex\\logs_2.sqlite-wal`\n\n`%USERPROFILE%\\.codex\\logs_2.sqlite-shm`\n\nIn the reported environment, high-frequency TRACE events were continuously inserted and deleted even when the retained row count remained stable.\n\nThese operations update the SQLite WAL, indexes, and checkpoints, so the amount written to the SSD can be much larger than the visible database size.\n\nThe reporter observed approximately 37 TB of total SSD writes over 21 days.\n\nThe following changes were subsequently merged to reduce the main sources of diagnostic-log traffic:\n\n[Stop logging every Responses WebSocket event, PR #29432](https://github.com/openai/codex/pull/29432)[Filter noisy targets from persistent logs, PR #29457](https://github.com/openai/codex/pull/29457)[Stop persisting bridged log events, PR #29599](https://github.com/openai/codex/pull/29599)\n\nThe reporter observed an approximately 85% reduction in log traffic and closed Issue #28224 on June 23, 2026.\n\nThese changes did not disable diagnostic logging completely.\n\nContinuing SQLite diagnostic writes have been reported in later versions, so environments where SSD write volume matters should measure the current behavior and apply an additional mitigation if necessary.\n\nThis procedure prevents new diagnostic records from being inserted into the `logs`\n\ntable in `logs_2.sqlite`\n\n.\n\nNormal conversations, source-code editing, and command execution do not depend on these diagnostic records.\n\nDisabling them does reduce the information available for:\n\n- Submitting a report through\n`/feedback`\n\n- Investigating crashes or connection failures\n- Providing diagnostic evidence to OpenAI Support\n\nThis is a workaround based on a SQLite trigger, not an official Codex configuration option.\n\nA Codex update or recreation of the log database may remove the trigger.\n\nConfirm that the Python Launcher is available:\n\n```\npy -3 --version\n```\n\nQuit Codex Desktop, all Codex CLI sessions, and any VS Code instance running the Codex extension.\n\nOpen Task Manager and verify that no `Codex`\n\nor `codex.exe`\n\nprocesses remain.\n\nChanging the database while another process holds it open may cause lock contention or WAL inconsistency.\n\nRun the following command in PowerShell:\n\n``` python\npy -3 -c \"import sqlite3,os; p=os.path.expanduser(r'~\\.codex\\logs_2.sqlite'); c=sqlite3.connect(p); c.execute('CREATE TRIGGER IF NOT EXISTS block_log_inserts BEFORE INSERT ON logs BEGIN SELECT RAISE(IGNORE); END;'); c.commit(); print('Diagnostic logging disabled:',p)\"\n```\n\nThis creates a trigger named `block_log_inserts`\n\nthat silently ignores every `INSERT`\n\ninto the `logs`\n\ntable.\n\nBecause the trigger discards inserts without returning an application error, it is less likely to cause a retry loop than making the database read-only.\n\nStart Codex again and use it normally.\n\nDiagnostic logging can be restored before troubleshooting a problem or contacting OpenAI Support.\n\nQuit all Codex-related processes, then run:\n\n``` python\npy -3 -c \"import sqlite3,os; p=os.path.expanduser(r'~\\.codex\\logs_2.sqlite'); c=sqlite3.connect(p); c.execute('DROP TRIGGER IF EXISTS block_log_inserts'); c.commit(); print('Diagnostic logging enabled:',p)\"\n```\n\nDo not apply this workaround to the following files or directories:\n\n`%USERPROFILE%\\.codex\\state_5.sqlite`\n\n`%USERPROFILE%\\.codex\\goals_1.sqlite`\n\n`%USERPROFILE%\\.codex\\sessions`\n\n`%USERPROFILE%\\.codex\\history.jsonl`\n\nDo not make the entire `.codex`\n\ndirectory read-only.\n\nThese locations contain thread metadata, UI state, goals, session history, and other runtime state.\n\nFirst, verify that the blocking trigger exists:\n\n``` python\npy -3 -c \"import sqlite3,os; p=os.path.expanduser(r'~\\.codex\\logs_2.sqlite'); c=sqlite3.connect(p); print(c.execute(\\\"SELECT name FROM sqlite_master WHERE type='trigger' AND name='block_log_inserts'\\\").fetchall())\"\n```\n\nThe following output confirms that the trigger is registered:\n\n```\n[('block_log_inserts',)]\n```\n\nNext, start Codex and run this 60-second check:\n\n``` python\npy -3 -c \"import sqlite3,os,time; p=os.path.expanduser(r'~\\.codex\\logs_2.sqlite'); q=lambda: sqlite3.connect(p).execute('SELECT COUNT(*), COALESCE(MAX(id),0) FROM logs').fetchone(); t=sqlite3.connect(p).execute(\\\"SELECT 1 FROM sqlite_master WHERE type='trigger' AND name='block_log_inserts'\\\").fetchone(); a=q(); print('trigger=',bool(t),'before=',a); time.sleep(60); b=q(); print('after=',b); print('PASS' if t and b[1]==a[1] else 'CHECK REQUIRED')\"\n```\n\nSend a short prompt to Codex during the 60-second interval to exercise the normal logging path.\n\nIf the command reports both `trigger=True`\n\nand `PASS`\n\n, the trigger exists and no new log IDs were inserted during the observation period.\n\nThe existing row count may decrease because of cleanup, so the check uses the maximum row ID for its pass or fail decision.\n\nIf it reports `CHECK REQUIRED`\n\n, quit Codex and run the disable command again.\n\nThe commands in this note assume that SQLite state is stored in the default `%USERPROFILE%\\.codex`\n\ndirectory.\n\nIf the location has been changed through `sqlite_home`\n\nin `config.toml`\n\nor the `CODEX_SQLITE_HOME`\n\nenvironment variable, replace the value assigned to `p`\n\nin each command with the actual path to `logs_2.sqlite`\n\n.", "url": "https://wpnews.pro/news/disable-codex-sqlite-diagnostic-logging-on-windows", "canonical_source": "https://gist.github.com/jun76/bf5f8fdde0e3866f537fc9422c65326d", "published_at": "2026-07-25 05:45:05+00:00", "updated_at": "2026-07-25 06:30:08.146828+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["OpenAI", "Codex", "GitHub", "Issue #28224", "PR #29432", "PR #29457", "PR #29599"], "alternates": {"html": "https://wpnews.pro/news/disable-codex-sqlite-diagnostic-logging-on-windows", "markdown": "https://wpnews.pro/news/disable-codex-sqlite-diagnostic-logging-on-windows.md", "text": "https://wpnews.pro/news/disable-codex-sqlite-diagnostic-logging-on-windows.txt", "jsonld": "https://wpnews.pro/news/disable-codex-sqlite-diagnostic-logging-on-windows.jsonld"}}