Skip to content

codex app-server can pollute subsequent TUI session metadata (wrong cwd/source/originator) #23437

Closed

Description

@szrenwei

Summary

After starting codex app-server, subsequent Codex TUI sessions launched from a project directory were recorded with incorrect session metadata.

The sessions were started from a CLI/TUI workflow in:

/data00/home/<user>/Work/team-docs

But multiple session records were written as if they came from Desktop / VS Code, and in the wrong working directory:

cwd=/data00/home/<user>
originator=Codex Desktop
source=vscode

The expected metadata should have been:

cwd=/data00/home/<user>/Work/team-docs
originator=codex-tui
source=cli

Environment

  • OS: Linux 5.4.0 x86_64
  • Affected session metadata was created with codex-cli 0.130.0
  • Current local CLI after update: codex-cli 0.131.0
  • Storage inspected:
    • ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
    • ~/.codex/state_5.sqlite

What happened

I normally launch Codex TUI from the repository directory. A previous normal session had metadata like:

{
  "cwd": "/data00/home/<user>/Work/team-docs",
  "originator": "codex-tui",
  "source": "cli"
}

After starting codex app-server, new sessions created from the same repository were indexed incorrectly.

A backup taken before manual repair showed the canonical DB rows in ~/.codex/state_5.sqlite had the wrong cwd/source for 6 sessions from the same day:

cwd=/data00/home/<user>
source=vscode
thread_source=user

The rollout JSONL session_meta first line also showed wrong metadata for most of those sessions:

cwd=/data00/home/<user>
originator=Codex Desktop
source=vscode
cli_version=0.130.0

One JSONL had already been manually corrected by the time the broader backup was taken, but the SQLite threads table still showed the same wrong cwd/source pattern for all 6 affected session rows.

Expected behavior

Starting codex app-server should not affect metadata for later CLI/TUI sessions.

A TUI session launched from a terminal in a repository should consistently write:

cwd=<actual project cwd>
originator=codex-tui
source=cli

This should be true in both:

  • the first session_meta line of the rollout JSONL file
  • the corresponding row in ~/.codex/state_5.sqlite.threads

Actual behavior

After codex app-server had been started, later TUI sessions were attributed to Desktop / VS Code and indexed under the parent home directory instead of the active project directory.

This caused repository-based session lookup to fail or return incomplete results, because the affected sessions no longer appeared to belong to the project they were actually launched from.

Impact

Tools and workflows that rely on session metadata break or become misleading:

  • listing sessions for the current repository misses affected sessions
  • session recall/search by cwd points to the wrong directory
  • TUI sessions appear to have been created by Desktop / VS Code
  • the JSONL session file and SQLite thread index can disagree during/after partial repair

Manual repair performed

I manually repaired:

  • the first-line session_meta payload in affected ~/.codex/sessions/.../rollout-*.jsonl files
  • the corresponding cwd and source fields in ~/.codex/state_5.sqlite.threads

After repair, all 6 affected sessions resolved correctly under:

/data00/home/<user>/Work/team-docs

with:

originator=codex-tui
source=cli

logs_2.sqlite still contains historical telemetry strings such as Codex_Desktop / source=vscode, but those appear to be log text rather than the canonical session metadata index.

Related issues

I found a few Desktop/session-history related issues, for example #20864 and #20741, but this report is specifically about codex app-server apparently leaking Desktop/VS Code attribution into later TUI session metadata and the SQLite thread index.

Activity

  1. added
    bug
    CLI
    app-server
    session
    on May 19, 2026
  2. added
    regression
    and removed
    session
    on May 19, 2026
  3. etraut-openai commented on May 26, 2026

    @etraut-openai
    Contributor

    This is fixed in 0.133.0

  4. bsabiston commented on May 30, 2026

    @bsabiston

    This is fixed in 0.133.0

    @etraut-openai Not fixed for me in the Codex app.
    My About dialog shows Desktop 26.527.31326 (3390), but I do not know what bundled CLI/app-server version that corresponds to. Is there a way in Codex Desktop to confirm that the embedded app-server is actually 0.133.0 or later? My Desktop sidebar/history issue is still reproducible on this Desktop build.

  5. etraut-openai commented on May 30, 2026

    @etraut-openai
    Contributor

    @bsabiston, this bug was specifically about metadata recorded when creating a new thread via the TUI. It sounds like you're using the app.

  6. bsabiston commented on May 30, 2026

    @bsabiston

    @bsabiston, this bug was specifically about metadata recorded when creating a new thread via the TUI. It sounds like you're using the app.

    @etraut-openai I see - sorry. Is there any way to call attention to the problem with the app losing all but the most recent chats in all projects? #20741

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

    CLIapp-serverbugregression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions