Skip to content

fix(codex): resume unloaded threads before starting a turn - #459

Open
Mayaskara25 wants to merge 1 commit into
yuga-hashimoto:mainfrom
Mayaskara25:fix/codex-resume-unloaded-threads
Open

Mayaskara25 wants to merge 1 commit into
yuga-hashimoto:mainfrom
Mayaskara25:fix/codex-resume-unloaded-threads

Conversation

@Mayaskara25

Copy link
Copy Markdown

Problem. After AndCode restarts, sending a message in an existing Codex chat fails with thread not found. New chats work until the next restart.

Cause. A new codex app-server process knows a thread only from its rollout on disk. It rejects turn/start for a thread it has not loaded. CodexRuntime never calls thread/resume, so every chat older than the current server process is unusable.

Fix. Each server process tracks the threads it has loaded (created with thread/start, or resumed). Before the first turn/start on an unloaded thread, send calls thread/resume once, with excludeTurns: true since the history is not needed. A new process starts with an empty set.

Testing. Tested on a Samsung Galaxy F41 (SM-F415F) with Codex 0.172.0 and Claude Code 2.1.332.

  • CodexThreadResumeTest (4 tests) and all existing *Codex* tests pass.
  • On the device: started a chat, force-stopped AndCode, reopened it and sent again in the same chat. It answered with the earlier context. Before the fix: thread not found.

🤖 Generated with Claude Code

Existing Codex chats failed with "thread not found" after AndCode restarted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant