openai / openai/codex

App Server init/proxy failure blocks programmatic archival fallback

Open
#45,954 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app app-server automations enhancement
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

Summary

A Codex automation session completed repository cleanup but could not archive its own completed thread through the documented thread/archive RPC. The automation tool surface did not expose thread/archive, so it attempted the local App Server fallback. That path failed before the archive operation could be called.

This issue tracks the fallback-path failure and diagnostics. The direct feature request to expose current-thread archival is tracked separately in #44784.

Environment

  • codex-cli 0.152.0
  • Linux 4.4.302+ x86_64
  • Hosted/containerized Codex automation environment
  • No raw session JSONL, credentials, thread IDs, or local paths are included

Initial reproduction

  1. Complete a Codex automation task and clean up its Git worktree.
  2. Attempt to archive the completed thread through the documented App Server API.
  3. Initialize a separate App Server and call thread/list to obtain the current thread ID.

Sanitized request:

printf '%s\n' \
  '{"method":"initialize","id":1,"params":{"clientInfo":{"name":"cleanup-audit","title":"Cleanup audit","version":"1.0"}}}' \
  '{"method":"initialized"}' \
  '{"method":"thread/list","id":2,"params":{"limit":100}}' |
  codex app-server --stdio

Observed result:

Error: failed to initialize sqlite state runtime under $CODEX_HOME: failed to initialize state runtime at $CODEX_HOME

Follow-up diagnostics

  • codex doctor --summary reported the SQLite state databases as healthy.
  • It reported three thread-index inconsistencies: rollout files missing from the state DB or rows pointing to missing/unusable rollout files.
  • A persistent App Server was already running.
  • The separate codex app-server --stdio failure therefore did not establish database corruption or a root cause.
  • codex app-server proxy against the persistent daemon completed without an RPC response, so the automation still could not obtain the current thread ID or call thread/archive.

Expected behavior

The App Server fallback should either:

  • initialize and expose the underlying state correctly;
  • provide an actionable diagnostic and safe recovery path; or
  • provide a supported bridge to the persistent App Server instance.

Impact

When direct current-thread archival is unavailable, the documented App Server fallback is also unusable. Repository cleanup can complete while session cleanup remains a manual UI action.

Related

  • #44784 tracks the direct, narrowly scoped enablement request.
  • #30105 covers a similar generic App Server SQLite initialization symptom caused by concurrent access on macOS; this report does not assume the same root cause.
  • #39130 covers a Windows archive file-move failure after an archive attempt; this report fails before thread/archive can run.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with codex app-server --stdio, then compare its initialization path with codex app-server proxy and the results of codex doctor --summary. Done means the fallback initializes successfully, reports an actionable diagnostic and safe recovery path, or provides a supported bridge to the persistent App Server.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
backend-api-design, cli, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.