Skip to content

Clarify tracking for Codex local session deletion, retention, and cleanup UX #28187

Open

Description

@Aesthermortis

Summary

This issue is not intended to duplicate a single existing feature request. It is meant to clarify the tracking status for Codex local session deletion, retention, and cleanup UX.

Several related issues exist, but the current triage state is confusing because some issues have been closed while the user-facing problem appears unresolved.

Related issues:

Problem

Codex stores local session/thread data, but users do not currently have a clear, discoverable workflow to answer:

  • What session/thread data is stored locally?
  • Where is it stored?
  • How can a specific session/thread be deleted?
  • How can archived or old sessions be deleted?
  • How can local logs/history/session artifacts be cleared?
  • How can retention be configured?
  • Which issue is the canonical tracking issue for this work?

This is not only a UI preference. It is also a local data hygiene, privacy, and trust issue.

Triage concern

#20251 was closed as a duplicate of #13018. However, #13018 is also closed, and it appears to cover a narrower request: deleting archived threads from the app UI.

#20251 covered a broader local data-management problem, including local session data, logs, history, storage discoverability, and retention controls.

If #13018 is considered the canonical issue, please clarify whether it was resolved, rejected, or moved to internal tracking.

If #6015 is now the canonical tracking issue for retention and cleanup, please link the related issues there and clarify the expected scope.

If none of the existing issues are canonical, please keep this issue open as the tracking issue or reopen the appropriate existing one.

Expected outcome

One of the following would resolve the triage ambiguity:

  1. Reopen the canonical issue and mark related issues as duplicates of that open tracker.
  2. Keep this issue open as the canonical tracker for local session deletion, retention, and cleanup UX.
  3. Clearly state that this work is tracked internally and link or label the public issue accordingly.
  4. Split the work into explicit sub-issues:
    • delete thread/session from UI
    • delete archived sessions
    • clear local logs/history
    • show/open local storage location
    • configure retention by age/count
    • disable future local transcript/session persistence

Why this matters

Manual deletion of internal files should not be the primary workflow for managing Codex local data.

Codex sessions can contain source code, file paths, diffs, commands, logs, project names, environment details, personal notes, and accidental secrets.

Users need a clear and supported way to manage that data without reverse-engineering internal storage folders.

Activity

  1. added
    enhancement
    CLI
    session
    config
    on Jun 14, 2026
  2. Aesthermortis commented on Jun 14, 2026

    @Aesthermortis
    Author

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

    Thanks. These are related, but this issue is intentionally about canonical tracking and triage ambiguity, not only the deletion workflow itself.

    If #20230 is the intended canonical tracker, that would be a reasonable outcome. In that case, please link #13018, #20251, #8784, #6015, and this issue there, and clarify that #20230 covers local session deletion/cleanup/retention UX.

    The main concern is that related issues have been closed as duplicates of closed or narrower issues, leaving no clear public tracker for the broader local data hygiene problem.

  3. linerking commented on Jul 4, 2026

    @linerking

    Adding a current macOS/Codex Desktop data point for why archive is not enough as a local data-management workflow.

    A user asked whether archiving threads prevents local or remote storage from continuing to grow. On the local machine, archive appears to be only a visibility/state change, not a storage cleanup mechanism.

    Observed local ~/.codex sizes on 2026-07-05:

    ~/.codex total:              ~5.0G
    ~/.codex/sessions:           ~2.6G
    ~/.codex/logs_2.sqlite:      ~1.1G
    ~/.codex/generated_images:   ~233M
    ~/.codex/archived_sessions:  ~98M
    sessions + archived_sessions files: 504
    

    This reinforces the user-facing ambiguity:

    • Archive hides a thread, but it does not communicate that local transcript/log/image storage remains.
    • There is no obvious supported way to delete or purge old/archived session data from the app.
    • There is no visible retention policy by age/count/size.
    • Users cannot easily tell which local files are safe to remove without reverse-engineering ~/.codex internals.
    • It is also unclear what, if anything, archive does for remote/cloud-retained state.

    Expected UX would ideally make the distinction explicit:

    1. Archive = hide from normal sidebar/list, keep history and local data.
    2. Delete = remove selected thread/session data, with confirmation and clear scope.
    3. Purge old archived = bulk-delete archived sessions older than N days or over a size/count limit.
    4. Clear diagnostics/logs = manage logs_*.sqlite separately from user transcripts.
    5. Storage view = show local storage usage by category and open the local storage folder.

    Without this, archive can look like cleanup while local data continues growing indefinitely.

  4. armanruzgar commented on Aug 31, 2026

    @armanruzgar

    Adding a measured macOS Codex Desktop case and a concrete storage-manager proposal.

    Observed impact:

    • ~/.codex/sessions reached 22 GiB after several months of regular Desktop use.
    • 1,722 rollout files dated before August 1, 2026 consumed 11.9 GiB.
    • logs_2.sqlite consumed another 1.0 GiB.
    • Removing the old sessions safely required checking pinned, active, and automation-owned threads; deleting rollout files; cleaning the state DB, local thread catalog, summaries, goals, and logs; and vacuuming SQLite.
    • After cleanup, sessions fell to 9.8 GiB, Codex SQLite data fell to 6.7 MiB, and actual free disk increased from 167 GiB to 177 GiB.

    Requested Desktop UX:

    1. Settings > Storage with per-thread and per-category usage.
    2. Sort/filter by size, last activity, project, and archived state.
    3. Bulk select, including delete sessions older than a date.
    4. Preview estimated recovery and explicitly protect active, pinned, and automation-owned threads.
    5. Transactional deletion across rollouts, attachments, logs, summaries, and index records so manual SQLite surgery is never required.
    6. Clearly distinguish Archive from space-reclaiming Delete.
    7. Optional retention by age or storage budget, default-off, with dry run and quarantine/undo.
    8. Disk-pressure warnings before the session store becomes operationally dangerous.

    On APFS, logical file size and physically reclaimable space can differ because of shared/cloned blocks, so the UI should label those measurements separately.

    This overlaps with #6015 for retention and #34337 for unbounded rollout growth, but the missing user-facing storage manager and index-safe deletion path are the core request here.

  5. phplego commented on Oct 18, 2026

    @phplego

    Please add date/project filters, multi-select, and bulk deletion to quickly clean up old history.

    I'd also like to trim old messages from long threads without deleting the thread—for example, keep the latest 10 MB of a 500 MB thread and discard the obsolete earlier history.

  6. simfor99 commented on Nov 3, 2026

    @simfor99

    To help with the storage inventory and cleanup UX design here, these are the four ~/.codex stores that grew unbounded in our Linux/WSL2 production environment and how they interact when deleting sessions:

    1. ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl (reached 67.83 GiB across 12,097 files).
    2. ~/.codex/state_5.sqlite and ~/.codex/thread_history_1.sqlite (reached 5.86 GiB): deleting rollout-*.jsonl files on disk without deleting the matching thread_id rows in both SQLite databases leaves dead entries in codex resume, triggers state.rollout_db_parity warnings in codex doctor (doctor: rollout DB / state DB parity warnings accumulate (231 missing active rows, 179 stale rows, 45 duplicate thread ids) #55933), and never shrinks the multi-GB SQLite files until VACUUM runs.
    3. ~/.codex/.tmp/git-XXXXXX: 352,950 orphaned empty bare-git directories that consumed 1.4M inodes and bloated the .tmp directory inode to 12 MiB (Plugin refresh error leaves orphaned marketplace-plugin-source clones and .tmp/git-* dirs (second unawaited refresh wave) #55068).
    4. ~/.codex/state/ and ~/.codex/backups/ dated ephemeral runs.

    We open-sourced a standalone ring-buffer guard that reconciles all four rails safely (--dry-run default, /proc/*/fd live-handle protection, fail-closed is_pinned = 1 protection, 48h safety floor, and SQLite DELETE + VACUUM): https://github.com/simfor99/codex-hdd-guard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIconfigenhancementsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions