Skip to content

[macOS] Recent turns disappear after restart although messages remain in local rollout JSONL #44434

Open

Description

@cuikaipeng

What version of the Codex App are you using (From “About Codex” dialog)?

Current installed/running desktop app: 26.903.71938 (build 8576), bundle identifier com.openai.codex. The installed application is currently named ChatGPT.app. These values were read from its bundle metadata; the exact version at the first occurrence was not separately captured.

What subscription do you have?

Not provided in this report.

What platform is your computer?

macOS 26.6.2, Apple Silicon.
uname -mprs: Darwin 25.6.0 arm64 arm

What issue are you seeing?

Recent completed turns disappear from an existing long-running local task's visible conversation history after restarting the desktop app. Read-only inspection confirms that multiple missing user messages and final assistant replies still exist in the task's original local rollout JSONL.

First noticed on September 9, 2026; still reproducible on the affected task on September 10 (Asia/Shanghai).

The UI's history stops at a completed turn from September 8. Newly exchanged messages may be visible while working, but after restart the history returns to the same old endpoint. The app's available read_thread tool also returns September 8 as the newest completed turn, even though the raw rollout contains later messages.

This is a mismatch between raw stored messages and the history returned/displayed, not evidence that all missing messages were physically deleted.

What steps can reproduce the bug?

There is no deterministic minimal reproduction on a new task yet. The observed sequence on the affected task is:

  1. Continue working in an existing long-running local task across multiple days.
  2. Complete additional user/assistant turns on September 9.
  3. Notice that intermediate recent turns are absent from the visible history.
  4. Restart the desktop app and reopen the same task.
  5. Observe that even the recent discussion about the missing history no longer appears; history again ends at the September 8 checkpoint.
  6. Read the task through read_thread: its newest-first results also stop at that checkpoint.
  7. Inspect the original session JSONL read-only: September 9 user messages and final assistant replies are still present.

Sanitized examples of retained raw records:

  • September 9, 05:57:23 UTC: user message.
  • September 9, 06:12:53 UTC: final assistant reply.
  • September 9, 06:45:52 UTC: user message.
  • September 9, 06:47:21 UTC: final assistant reply.

No message text is included here.

In-app feedback/session ID supplied after reporting the problem:
019fb5de-a749-7dd1-a446-bf6c86928ed7
This is also the affected task ID; it is not claimed to be a separate support ticket number.

What is the expected behavior?

Reopening a task should display its retained completed turns. If history reconstruction fails, the app should show an actionable error rather than silently presenting stale history.

Please advise on a supported, non-destructive recovery or history-rebuild procedure that preserves the original transcript.

Additional information

Activity

  1. added
    bug
    app
    session
    on Sep 10, 2026
  2. heznpc commented on Sep 10, 2026

    @heznpc

    Additional occurrence on macOS 27.0 / Apple Silicon, with the same desktop build as this report. Follow-up investigation now identifies an ordinal regression and a stalled history projection, and includes a synthetic reproduction plus a comparison against the fixed runtime.

    Verified environment and impact

    • Desktop: ChatGPT.app / com.openai.codex, 26.903.71938, build 8576.
    • Installed desktop-bundled executable: codex-cli 0.153.4, measured with --version.
    • Observed: September 10, 2026, Asia/Seoul (UTC+09:00).
    • The visible conversation and newest-first read_thread results remain stuck on a turn started at 15:11:34, marked inProgress, completedAt: null, with 22 items.
    • Later actual user messages and completed assistant replies remain in the original JSONL, including a 17:32–17:34 discussion of this bug and the user's 21:06 recurrence report. The task can still accept new work.

    The user first noticed the missing history after an app update around 17:00. The persisted ordinal regression occurred earlier, at 15:32, so the update must not be assumed to have caused the original corruption. The exact UI action preceding the 21:06 recurrence was not captured.

    Actual failing boundary, checked read-only

    This task has segmented/paginated history. The logical task ID and the physical segment referenced by the projection error differ; inspecting only the logical task's projection row would give the wrong checkpoint. Identifiers are omitted here.

    The active segment is valid JSONL. It contains this sequence:

    Local time Record Stored ordinal
    15:17:06.002 event_msg/token_count (primary used_percent is a JSON decimal) 1577
    15:32:18.643 event_msg/thread_settings_applied 1577 again

    The physical segment's thread_history_projection_state is frozen at:

    next_rollout_byte_offset = 12451091
    next_rollout_ordinal = 1578
    

    Reading precisely at that byte offset finds the second record above, with ordinal 1577. The same segment's latest thread_turns row starts at rollout ordinal 1488 / 15:11:34 and remains inProgress, matching the stale turn returned by the app.

    The local log database repeatedly contains this error, with the identifier redacted:

    failed to project durable rollout for <thread>:
    thread-store internal error:
    thread history projection for <segment> expected ordinal 1578, got 1577
    

    This connects the persisted duplicate, the stalled projection checkpoint, and the stale API result. It matches the ordinal-regression mechanism tracked in #35746 / #43142 rather than establishing a separate UI-only defect.

    Minimal synthetic reproduction and fixed-version comparison

    Tested two fresh, isolated three-record fixtures on this Mac. Neither uses a real task, transcript, credentials, or model request.

    1. Write a paginated rollout with ordinal 0 session_meta, ordinal 1 synthetic agent_message, and ordinal 2 token_count.
    2. In the token-count record, set rate_limits.primary.used_percent to 0 for the control or 0.0 for the failing case. Everything else is identical apart from generated fixture IDs and directories.
    3. Start an isolated codex app-server --stdio with a private CODEX_HOME, disabled analytics, and a loopback-only model provider.
    4. Send initialize, initialized, thread/resume, thread/settings/update, and thread/unsubscribe; do not send turn/start.
    5. Close stdin, wait for exit, and inspect the appended record's ordinal.

    Expected: the appended thread_settings_applied uses ordinal 3 in both cases.

    Measured results:

    Runtime tested used_percent JSON Ordinals after resume/settings update Result
    Installed desktop 0.153.4 0 [0, 1, 2, 3] control passes
    Installed desktop 0.153.4 0.0 [0, 1, 2, 2] duplicate reproduced
    Official 0.154.0 0 [0, 1, 2, 3] passes
    Official 0.154.0 0.0 [0, 1, 2, 3] passes

    All RPC sequences succeeded, and the original three synthetic records were unchanged in all four cases. The 0.154.0 binary was downloaded from the official rust-v0.154.0 Apple Silicon release asset, its SHA-256 was checked against the release metadata, and it was run separately without replacing the installed application.

    The source comparison agrees with these results: ordinal_state_for_rollout uses scan_next::<RolloutLine>() in rust-v0.153.4 and scan_next_rollout_line() in rust-v0.154.0. #42378 routes readers through the canonical decoder; #42369 adds resilience when materialization encounters invalid/discontinuous records. Both appear in the 0.154.0 release.

    Reproduction script

    Save the following as reproduce.py. Run with Python 3, an absolute executable path, and a new output directory:

    python3 reproduce.py /absolute/path/to/codex /new/output/directory
    

    The script refuses to reuse an existing output directory and retains the synthetic fixtures, stderr, and JSON results there. No inference call is made.

    Self-contained Python 3 script tested against both runtimes
    """Offline ordinal regression probe using synthetic data only (Python 3).
    
    Usage: python3 reproduce.py /absolute/path/to/codex /new/output/directory
    No model request, account credentials, or real task is used.
    """
    import asyncio
    import json
    import os
    from pathlib import Path
    import subprocess
    import sys
    import uuid
    
    
    async def probe(binary, root, label, value):
        case = root / label
        case.mkdir(mode=0o700)
        workspace = case / "workspace"
        workspace.mkdir()
        data = case / "codex-data"
        sessions = data / "sessions" / "2026" / "09" / "10"
        sessions.mkdir(parents=True)
        (data / "config.toml").write_text(
            'model = "offline-probe"\nmodel_provider = "offline-probe"\n'
            '[model_providers.offline-probe]\nname = "Offline probe"\n'
            'base_url = "http://127.0.0.1:9/v1"\nwire_api = "responses"\n'
            'requires_openai_auth = false\n[analytics]\nenabled = false\n'
        )
        tid = str(uuid.uuid4())
        stamp = "2026-09-10T00:00:00Z"
        rollout = sessions / f"rollout-2026-09-10T00-00-00-{tid}.jsonl"
        records = [
            {"timestamp": stamp, "ordinal": 0, "type": "session_meta",
             "payload": {"id": tid, "timestamp": stamp, "cwd": str(workspace),
                         "originator": "offline-history-probe", "cli_version": "0.153.4",
                         "source": "cli", "model_provider": "offline-probe",
                         "history_mode": "paginated"}},
            {"timestamp": stamp, "ordinal": 1, "type": "event_msg",
             "payload": {"type": "agent_message", "message": "Synthetic record."}},
            {"timestamp": stamp, "ordinal": 2, "type": "event_msg",
             "payload": {"type": "token_count", "info": None,
                         "rate_limits": {"primary": {"used_percent": value,
                                                     "window_minutes": 5,
                                                     "resets_at": 1788912000}}}},
        ]
        rollout.write_text("".join(json.dumps(r) + "\n" for r in records))
        # CODEX_HOME is scoped to this child and keeps its documented meaning.
        # No real Codex configuration, task ID, auth token, or app-server address
        # is passed into the child process.
        child_env = {k: os.environ[k] for k in ("PATH", "HOME", "TMPDIR", "LANG")
                     if k in os.environ}
        child_env.update({"CODEX_HOME": str(data), "RUST_LOG": "warn",
                          "HTTP_PROXY": "http://127.0.0.1:9",
                          "HTTPS_PROXY": "http://127.0.0.1:9",
                          "ALL_PROXY": "http://127.0.0.1:9", "NO_PROXY": ""})
        stderr = (case / "stderr.log").open("wb")
        proc = await asyncio.create_subprocess_exec(
            str(binary), "app-server", "--stdio", cwd=workspace, env=child_env,
            stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE,
            stderr=stderr, limit=4 * 1024 * 1024,
        )
        request_id = 0
    
        async def rpc(method, params):
            nonlocal request_id
            request_id += 1
            proc.stdin.write((json.dumps({"id": request_id, "method": method,
                                         "params": params}) + "\n").encode())
            await proc.stdin.drain()
            while True:
                line = await asyncio.wait_for(proc.stdout.readline(), timeout=15)
                if not line:
                    raise RuntimeError("app-server ended before response")
                response = json.loads(line)
                if response.get("id") == request_id:
                    if "error" in response:
                        raise RuntimeError(json.dumps(response["error"]))
                    return response.get("result")
    
        result = {"case": label, "used_percent_json": json.dumps(value),
                  "expected_next_ordinal": 3}
        try:
            await rpc("initialize", {"clientInfo": {"name": "offline-history-probe",
                      "version": "1"}, "capabilities": {"experimentalApi": True}})
            proc.stdin.write(b'{"method":"initialized"}\n')
            await proc.stdin.drain()
            await rpc("thread/resume", {"threadId": tid, "path": str(rollout),
                      "cwd": str(workspace), "model": "offline-probe",
                      "modelProvider": "offline-probe", "excludeTurns": True})
            await rpc("thread/settings/update", {"threadId": tid, "effort": "low"})
            await rpc("thread/unsubscribe", {"threadId": tid})
            result["rpc_succeeded"] = True
        except Exception as error:
            result["error"] = str(error)
            result["rpc_succeeded"] = False
        finally:
            proc.stdin.close()
            try:
                await asyncio.wait_for(proc.wait(), timeout=5)
            except asyncio.TimeoutError:
                proc.terminate()
                await asyncio.wait_for(proc.wait(), timeout=5)
            stderr.close()
        actual = [json.loads(line) for line in rollout.read_text().splitlines()]
        result.update({"ordinals_after": [r.get("ordinal") for r in actual],
                       "appended_types": [r.get("payload", {}).get("type")
                                          for r in actual[len(records):]],
                       "original_records_unchanged": actual[:len(records)] == records,
                       "actual_next_ordinal": actual[len(records)].get("ordinal")
                       if len(actual) > len(records) else None})
        result["reproduced"] = (result["rpc_succeeded"] and
                                result["actual_next_ordinal"] is not None and
                                result["actual_next_ordinal"] < 3)
        (case / "result.json").write_text(json.dumps(result, indent=2) + "\n")
        print(json.dumps(result), flush=True)
        return result
    
    
    async def main():
        binary = Path(sys.argv[1]).resolve(strict=True)
        root = Path(sys.argv[2]).resolve()
        root.mkdir(mode=0o700)  # Refuse to overwrite an existing run.
        version = subprocess.check_output([str(binary), "--version"], text=True).strip()
        results = []
        for label, value in [("integer-control", 0), ("decimal-tail", 0.0)]:
            results.append(await asyncio.wait_for(probe(binary, root, label, value), 55))
        summary = {"runtime": version, "cases": results}
        (root / "summary.json").write_text(json.dumps(summary, indent=2) + "\n")
        print(json.dumps({"runtime": version}), flush=True)
    
    
    if __name__ == "__main__":
        asyncio.run(main())

    Remaining recovery question

    The initiating bug is now reproduced on the installed runtime and absent in the tested 0.154.0 synthetic cases. This is not yet an end-to-end recovery test of the original segmented task. No original JSONL or SQLite records were edited, renumbered, reset, or deleted, and the desktop app still bundles 0.153.4.

    Please confirm the first macOS desktop build shipping the applicable fixes and the supported path for an already-affected segmented task to catch up past this exact duplicate boundary. In particular, confirm whether reopening under the updated runtime should recover it automatically and how successful recovery should be verified.

    The missing conversation contains recent decisions and completion reports; preserving raw messages alone does not restore usability in the app. The public evidence above contains no private conversation text, project names or source, real task IDs, personal filesystem paths, credentials, screenshots, or raw production logs.

  3. webdesigns36 commented on Sep 10, 2026

    @webdesigns36

    Desktop history stops at duplicate ordinal; 0.153.4 decimal fixture reproduces, 0.154.0 passes

    Environment: Apple Silicon M1, 8 GB RAM, macOS. Codex desktop 26.903.71938, build 8576; bundled engine reports codex-cli 0.153.4. The desktop had recently been updated, but the bundled engine version remained 0.153.4.

    User-visible symptom

    An existing task displays older history after reopening, while later user/assistant records remain in its JSONL file and a newly generated reply accurately recalls the later context. This distinction matters: stale displayed/indexed history is not equivalent to complete loss of model-visible context.

    The local index repeatedly reports expected ordinal 48246, got 48245 and stops at byte offset 632857751. Immediately before the duplicate is a token-count record with nested decimal literals used_percent: 0.0; the next record is thread_settings_applied, reusing ordinal 48245.

    Independent synthetic reproduction

    Use a separate temporary data root, an empty workspace, an offline dummy provider, no authentication, and OS-enforced network denial. Do not use a real task.

    1. Create three JSONL records with ordinals 0, 1, 2: session metadata declaring paginated history, one synthetic agent message, then token_count with info: null and a primary rate limit containing used_percent: 0.0, window_minutes: 5, and a valid integer reset timestamp.
    2. Start the engine's stdio app-server against that isolated data root.
    3. Initialize with capabilities.experimentalApi: true, send initialized, resume the synthetic fixture with excludeTurns: true, update its reasoning effort to low, and unsubscribe. Do not send turn/start.
    4. Inspect the appended thread_settings_applied ordinal. Repeat with integer 0 instead of decimal 0.0, and with both engine versions.

    Measured results:

    Version Integer control Decimal fixture
    0.153.4 0,1,2,3 0,1,2,2
    0.154.0 0,1,2,3 0,1,2,3

    All three original fixture lines remained unchanged in each run. The official Apple Silicon 0.154.0 archive SHA-256 was verified against release metadata before execution.

    Related upstream work

    Existing-data recovery remains unverified

    An isolated test with byte-identical copies of the affected task and its ancestor chain could read metadata. A fresh index did not populate just by listing turns. A normal open of a disposable writable recorder exceeded a conservative memory stop threshold on the 8 GB Mac and was deliberately terminated at about 1.09 GB sampled process RSS. This does not demonstrate that the new engine cannot recover it, but it also does not demonstrate safe full recovery. No live index reset, ordinal rewrite, migration, transcript deletion, or app-binary replacement was attempted.

    Questions for maintainers

    1. Which supported desktop build includes these fixes, and how can the bundled engine version be checked reliably?
    2. What is the supported, bounded-memory recovery/reindex procedure for already affected paginated tasks?
    3. Can recovery preserve the original JSONL, inheritance cutoffs, existing task identity and all later valid user/assistant records without an unbounded full-history load?

    This report omits private task text, account details, local usernames, client names, transcript files and credentials. No private history is attached.

  4. DannyWolfofTech commented on Sep 12, 2026

    @DannyWolfofTech

    Adding another independently observed occurrence on the same desktop build, reported with the affected user's permission.

    Environment

    • macOS 26.6.2 (25G83)
    • ChatGPT.app / Codex desktop version 26.903.71938, build 8576
    • Existing long-running task created on September 10, 2026; missing recent conversation reported September 12.

    Observed evidence

    • The user repeatedly could not see recent messages and generated ad images during ongoing work. The exact trigger is unknown; a restart trigger was not established in this case.
    • A read-only read_thread request with turnLimit: 5 returned only one old setup turn, marked inProgress, with completedAt: null.
    • Pagination reported nextCursor: null and hasMore: false, despite substantial later conversation.
    • Read-only inspection of the corresponding local rollout JSONL found the recent September 12 user messages as response_item message records, including the messages reporting the disappearance.
    • The latest generated image files also still existed locally.

    This establishes a mismatch between persisted content and the history exposed by retrieval/display in this case; it does not establish permanent data loss. We have not independently checked the ordinal/projection mechanism described in the other comments.

    No transcript/database edits, cache resets, or binary replacements were performed. Private conversation text, images, account details, local paths, and task identifiers are intentionally omitted.

    Please advise which desktop release contains the fix and the supported way to recover affected existing task history without modifying its original rollout.

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

    appbugsession

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions