Forked session loses all original record timestamps when editing an earlier prompt (codex-cli 0.145.0)

Open 💬 2 comments Opened Jul 23, 2026 by Yan233th
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.145.0

What subscription do you have?

Team

Which model were you using?

gpt-5.6-sol

What platform is your computer?

Linux 6.12.94+deb13-amd64 x86_64 unknown

What terminal emulator and version are you using (if applicable)?

Not relevant

Codex doctor report

{
  "schemaVersion": 1,
  "generatedAt": "1784836295s since unix epoch",
  "overallStatus": "fail",
  "codexVersion": "0.145.0",
  "checks": {
    "app_server.status": {
      "id": "app_server.status",
      "category": "app-server",
      "status": "ok",
      "summary": "background server is not running",
      "details": {
        "control socket": "/home/Yan233_/.codex/app-server-control/app-server-control.sock",
        "daemon state dir": "/home/Yan233_/.codex/app-server-daemon",
        "mode": "ephemeral",
        "pid file": "/home/Yan233_/.codex/app-server-daemon/app-server.pid (missing)",
        "settings": "/home/Yan233_/.codex/app-server-daemon/settings.json (missing)",
        "status": "not running",
        "update-loop pid file": "/home/Yan233_/.codex/app-server-daemon/app-server-updater.pid (missing)"
      },
      "remediation": null,
      "durationMs": 0
    },
    "auth.credentials": {
      "id": "auth.credentials",
      "category": "auth",
      "status": "fail",
      "summary": "no Codex credentials were found",
      "details": {
        "auth file": "/home/Yan233_/.codex/auth.json",
        "auth storage mode": "File"
      },
      "remediation": "Run codex login or provide an API key through a supported auth env var.",
      "durationMs": 0
    },
    "config.load": {
      "id": "config.load",
      "category": "config",
      "status": "ok",
      "summary": "config loaded",
      "details": {
        "CODEX_HOME": "/home/Yan233_/.codex",
        "config.toml": "/home/Yan233_/.codex/config.toml",
        "config.toml parse": "ok",
        "cwd": "/home/Yan233_",
        "enabled feature flags": "shell_tool, unified_exec, shell_snapshot, code_mode_host, terminal_resize_reflow, sqlite, hooks, enable_request_compression, multi_agent, apps, tool_search_always_defer_mcp_tools, tool_suggest, plugins, in_app_browser, browser_use, browser_use_full_cdp_access, browser_use_external, computer_use, remote_plugin, plugin_sharing, image_generation, resize_all_images, skill_mcp_dependency_install, skill_search, mentions_v2, steer, guardian_approval, goals, collaboration_modes, tool_call_mcp_elicitation, auth_elicitation, personality, fast_mode, tui_app_server, remote_compaction_v2, workspace_dependencies",
        "feature flag overrides": "none",
        "feature flags enabled": "36",
        "log dir": "/home/Yan233_/.codex/log",
        "mcp servers": "0",
        "model": "gpt-5.6-sol",
        "model provider": "openai",
        "sqlite home": "/home/Yan233_/.codex"
      },
      "remediation": null,
      "durationMs": 0
    },
    "git.environment": {
      "id": "git.environment",
      "category": "git",
      "status": "ok",
      "summary": "git version 2.47.3",
      "details": {
        "PATH git #1": "/usr/bin/git",
        "PATH git #2": "/bin/git",
        "PATH git entries": "2",
        "git build options": "git version 2.47.3; cpu: x86_64; no commit associated with this build; sizeof-long: 8; sizeof-size_t: 8; shell-path: /bin/sh; libcurl: 8.14.1; zlib: 1.3.1",
        "git exec path": "/usr/lib/git-core",
        "git version": "git version 2.47.3",
        "repo detected": "false",
        "selected git": "/usr/bin/git"
      },
      "remediation": null,
      "durationMs": 35
    },
    "installation": {
      "id": "installation",
      "category": "install",
      "status": "ok",
      "summary": "installation looks consistent",
      "details": {
        "PATH codex #1": "/home/Yan233_/.local/bin/codex",
        "current executable": "/home/Yan233_/.local/bin/codex",
        "install context": "other",
        "managed by bun": "false",
        "managed by npm": "false",
        "managed by pnpm": "false",
        "managed package root": "not set"
      },
      "remediation": null,
      "durationMs": 0
    },
    "mcp.config": {
      "id": "mcp.config",
      "category": "mcp",
      "status": "ok",
      "summary": "no MCP servers configured",
      "details": {},
      "remediation": null,
      "durationMs": 0
    },
    "network.env": {
      "id": "network.env",
      "category": "network",
      "status": "ok",
      "summary": "network-related environment looks readable",
      "details": {
        "proxy env vars": "none"
      },
      "remediation": null,
      "durationMs": 0
    },
    "network.provider_reachability": {
      "id": "network.provider_reachability",
      "category": "reachability",
      "status": "fail",
      "summary": "one or more required provider endpoints are unreachable over HTTP",
      "details": {
        "ChatGPT base URL": "https://chatgpt.com/backend-api/ request timed out (required)",
        "reachability mode": "ChatGPT auth"
      },
      "remediation": "Check proxy, VPN, firewall, DNS, and custom CA configuration.",
      "durationMs": 3021
    },
    "network.websocket_reachability": {
      "id": "network.websocket_reachability",
      "category": "websocket",
      "status": "warning",
      "summary": "Responses WebSocket timed out; HTTPS fallback may still work",
      "details": {
        "DNS": "1 IPv4, 1 IPv6, first IPv4",
        "auth mode": "none",
        "connect timeout": "15000 ms",
        "endpoint": "wss://api.openai.com/v1/<redacted>",
        "model provider": "openai",
        "provider name": "OpenAI",
        "proxy env vars": "none",
        "supports websockets": "true",
        "wire API": "responses"
      },
      "notes": [
        "handshake timed out"
      ],
      "remediation": "Check proxy, VPN, firewall, DNS, custom CA, and WebSocket policy support.",
      "durationMs": 15029
    },
    "runtime.provenance": {
      "id": "runtime.provenance",
      "category": "runtime",
      "status": "ok",
      "summary": "running local build on linux-x86_64",
      "details": {
        "commit": "unknown",
        "current executable": "/home/Yan233_/.local/bin/codex",
        "install method": "other",
        "platform": "linux-x86_64",
        "version": "0.145.0"
      },
      "remediation": null,
      "durationMs": 0
    },
    "runtime.search": {
      "id": "runtime.search",
      "category": "search",
      "status": "ok",
      "summary": "search is OK (system)",
      "details": {
        "search command": "rg",
        "search command readiness": "ripgrep 14.1.1",
        "search provider": "system"
      },
      "remediation": null,
      "durationMs": 1
    },
    "sandbox.helpers": {
      "id": "sandbox.helpers",
      "category": "sandbox",
      "status": "ok",
      "summary": "sandbox configuration is readable",
      "details": {
        "approval policy": "Never",
        "codex-linux-sandbox helper": "/home/Yan233_/.codex/tmp/arg0/codex-arg0OvzcmM/codex-linux-sandbox",
        "execve wrapper helper": "/home/Yan233_/.codex/tmp/arg0/codex-arg0OvzcmM/codex-execve-wrapper",
        "filesystem sandbox": "unrestricted",
        "network sandbox": "enabled"
      },
      "remediation": null,
      "durationMs": 0
    },
    "state.paths": {
      "id": "state.paths",
      "category": "state",
      "status": "ok",
      "summary": "state paths and databases are inspectable",
      "details": {
        "CODEX_HOME": "/home/Yan233_/.codex (dir)",
        "active rollout files": "174 files, 509727806 total bytes, 2929470 average bytes",
        "archived rollout files": "0 files, 0 total bytes, 0 average bytes",
        "goals DB": "/home/Yan233_/.codex/goals_1.sqlite (file)",
        "goals DB integrity": "ok",
        "log DB": "/home/Yan233_/.codex/logs_2.sqlite (file)",
        "log DB integrity": "ok",
        "log dir": "/home/Yan233_/.codex/log (dir)",
        "memories DB": "/home/Yan233_/.codex/memories_1.sqlite (file)",
        "memories DB integrity": "ok",
        "sqlite home": "/home/Yan233_/.codex (dir)",
        "state DB": "/home/Yan233_/.codex/state_5.sqlite (file)",
        "state DB integrity": "ok",
        "thread history DB": "/home/Yan233_/.codex/thread_history_1.sqlite (missing)",
        "thread history DB integrity": "skipped (missing)"
      },
      "remediation": null,
      "durationMs": 186
    },
    "state.rollout_db_parity": {
      "id": "state.rollout_db_parity",
      "category": "threads",
      "status": "ok",
      "summary": "rollout files and state DB thread inventory agree",
      "details": {
        "default model provider": "openai",
        "rollout DB active files": "174",
        "rollout DB active rows": "174",
        "rollout DB archive mismatches": "0",
        "rollout DB archived files": "0",
        "rollout DB archived rows": "0",
        "rollout DB duplicate DB paths": "0",
        "rollout DB duplicate rollout thread ids": "0",
        "rollout DB malformed file names": "0",
        "rollout DB missing active rows": "0",
        "rollout DB missing archived rows": "0",
        "rollout DB model providers": "T=60, Core=43, VE=37, Map=15, openai=12, CUSTOM=7",
        "rollout DB rows": "174",
        "rollout DB scan cap reached": "false",
        "rollout DB scan errors": "0",
        "rollout DB sources": "cli=164, vscode=9, exec=1",
        "rollout DB stale rows": "0"
      },
      "remediation": null,
      "durationMs": 106
    },
    "system.environment": {
      "id": "system.environment",
      "category": "system",
      "status": "ok",
      "summary": "OS language zh-CN",
      "details": {
        "EDITOR": "not set",
        "LANG": "zh_CN.UTF-8",
        "VISUAL": "not set",
        "os": "Debian 13.0.0 (trixie) [64-bit]",
        "os language": "zh-CN",
        "os type": "Debian",
        "os version": "13.0.0"
      },
      "remediation": null,
      "durationMs": 7
    },
    "terminal.env": {
      "id": "terminal.env",
      "category": "terminal",
      "status": "ok",
      "summary": "terminal metadata was detected",
      "details": {
        "SSH_CLIENT": "present",
        "SSH_CONNECTION": "present",
        "SSH_TTY": "present",
        "TERM": "xterm-256color",
        "color output": "enabled",
        "effective locale": "zh_CN.UTF-8",
        "stderr is terminal": "true",
        "stdin is terminal": "true",
        "stdout is terminal": "true",
        "terminal": "unknown",
        "terminal size": "169x48"
      },
      "remediation": null,
      "durationMs": 0
    },
    "terminal.title": {
      "id": "terminal.title",
      "category": "title",
      "status": "ok",
      "summary": "terminal title default",
      "details": {
        "terminal title activity": "true",
        "terminal title items": "activity, project-name",
        "terminal title project source": "cwd",
        "terminal title project value": "Yan233_",
        "terminal title source": "default"
      },
      "remediation": null,
      "durationMs": 0
    },
    "updates.status": {
      "id": "updates.status",
      "category": "updates",
      "status": "ok",
      "summary": "update configuration is locally consistent",
      "details": {
        "cached latest version": "0.145.0",
        "check for update on startup": "true",
        "last checked at": "2026-07-23T18:58:31.667341924Z",
        "latest version": "0.145.0",
        "latest version status": "current version is not older",
        "update action": "manual or unknown",
        "version cache": "/home/Yan233_/.codex/version.json"
      },
      "remediation": null,
      "durationMs": 693
    }
  }
}

What issue are you seeing?

On codex-cli 0.145.0, editing an earlier prompt branches the conversation (per #33201, shipped in 0.145.0). The branched session is a full copy of the conversation, but every copied record's timestamp is rewritten to the fork creation time, destroying the original per-message timeline inside the branch.

A session whose records spanned 8 distinct days (2026-06-28 … 2026-07-22) collapses to a single day in the fork — all ~14k records carry the fork timestamp. Original timestamps survive only in the root session, reachable via forked_from_id (which points at the parent session, not a message).

Practical impact: the branch I actually continue working in is the one that loses its history; from the session in use, there is no way to tell when any earlier message was really sent.

What steps can reproduce the bug?

  1. In codex-cli 0.145.0, open a session with history spanning >1 day.
  2. Edit an earlier user prompt (the #33201 "branch on edit" path) and continue.
  3. A new session file is written under ~/.codex/sessions/ with a new session id and forked_from_id → parent.
  4. Inspect the fork file: every record's timestamp equals the fork time; the original multi-day distribution is gone.

Evidence (session ids abbreviated):

  • Root 019f0ebc-…, timestamps by day: 06-28 / 07-01 / 07-13 / 07-14 / 07-15 / 07-20 / 07-21 / 07-22
  • Fork 019f88f3-… (forked_from_id = 019f0ebc): all 14157 records timestamped 2026-07-22
  • Field-level diff of matched records: 85% of differing values are timestamp (all restamped to the fork instant), 6% regenerated ids (turn_id/call_id); message text is byte-identical.

What is the expected behavior?

Copied historical records in a forked/branched session should either preserve their original timestamps, or be clearly marked as copied history distinct from messages freshly sent in the branch. The session a user actively works in should retain a trustworthy view of when each message was originally sent.

Additional information

  • Related to #21025 (fork timestamp rewrite), but filing separately because: (a) it reproduces on codex-cli 0.145.0, where #21025's reporter (Mac App) said it stopped reproducing for them; (b) it is now triggered by the new edit-earlier-prompt behavior (#33201, 0.145.0), so exposure just increased; (c) the impact differs — the branch a user actively works in loses its history, not merely "looks confusing".
  • Lineage: #31902 (0.144.0 — editing an earlier message overwrote instead of forking) → #33201 (0.145.0 — made edit-earlier-prompt always fork/preserve) → this issue (the fork loses original timestamps).
  • Related feature request: #35005 (option to edit an earlier prompt in place instead of always forking).
  • Behavior is client-side (session-file writing); model/provider appears incidental.

Side note: each fork is a full ~23MB self-contained copy (no dedup); one edit-chain here = 9 files / ~215MB (possibly related to #20230).

View original on GitHub ↗

2 Comments

github-actions[bot] contributor · 1 month ago

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

  • #34268

Powered by Codex Action

Yan233th · 1 month ago
Potential duplicates detected. Please review them and close your issue if it is a duplicate. * Multi-agent V2 full-history forks duplicate historical compaction snapshots and inline images, causing >100 GiB session storage growth #34268 _Powered by Codex Action_

Not a duplicate of #34268. That issue is about storage growth from forks duplicating compaction snapshots / inline images (multi-agent V2, Desktop). This one is about forked sessions restamping every record's timestamp to the fork time, losing the original per-message timeline (codex-cli 0.145.0, edit-earlier-prompt). Different defect and impact — though both are fork side-effects on session rollout files.