openai / openai/codex

[iOS Remote] New Local task reuses a viewed conversation's worktree directory and fails to switch branch

Open
#46,723 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug iOS remote session
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

Summary

In ChatGPT/Codex Remote on iOS, starting a new task in Work locally mode can reuse the working directory of the previously viewed conversation, even after the main repository directory was manually selected for another Local task.

Manually selecting the main checkout makes branch selection work. However, returning to the older worktree conversation and starting another new Local task reproduces the failure. Both directories have the basename monorepo, so the folder label does not make the difference obvious.

Environment

  • Observed and reproduced by the user on 19 September 2026.
  • Client: ChatGPT on iPhone, using Remote with a connected Mac.
  • Mobile app: ChatGPT for iOS 1.2026.244 (33940143573), verified from the app's About screen supplied by the reporter. The connected client's host-side metadata also reports version 1.2026.244.
  • Exact iOS operating system version: not recorded.
  • Mac host application: ChatGPT/Codex 26.915.31945, build 9922.
  • Repository: a clean main checkout on production, plus an existing linked worktree on a task branch.

Paths and task branch names below are anonymized.

Steps to reproduce

  1. Have a saved project rooted at the main checkout, for example ~/dev/project/monorepo, with production checked out there.
  2. Have an existing conversation whose working directory is a linked worktree, for example ~/.codex/worktrees/<id>/monorepo, on codex/previous-task.
  3. On iOS, start a new task in Work locally mode. Manually select the main repository directory. Starting on production works.
  4. Return to the existing conversation associated with the linked worktree.
  5. Start another new task, again in Work locally mode, before sending its first message.
  6. The selected directory/branch again corresponds to the linked worktree and its previous task branch.
  7. Select production. The app displays the Czech alert:

Chyba

Nepodařilo se změnit větev Gitu.

English translation: Error — Failed to change Git branch.

  1. Manually reselect the main repository directory. Branch selection works again.
  2. Visit the old worktree conversation and start another new Local task: the problem returns.

Expected behavior

The directory manually selected for new Local work in a project should remain predictable when navigating between conversations. If inheriting the viewed conversation's directory is intentional, the new-task UI should clearly identify the full directory and its worktree status before submission, and explain any branch conflict.

Actual behavior

The new Local task returns to a previously viewed conversation's worktree directory. The UI shows only the shared folder basename, the previous task branch, and a generic error when selecting the main branch. Manual directory selection fixes only the current occurrence.

Host-side verification

Read-only inspection alongside the user's reproduction confirmed:

  • The saved project and desktop workspace roots still point to the main repository directory.
  • The successful new Local conversation was recorded with the main checkout directory and branch production.
  • The older conversation remains associated with the linked worktree and its task branch.
  • Both checkouts exist, are clean, and pointed at the same commit when inspected.
  • No repository configuration or app database was modified during diagnosis.

Interpretation and evidence limits

The new-task flow appears to inherit the last viewed conversation's directory rather than retain the explicitly selected main project directory. Trying to check out production in that linked worktree would conflict with production already being checked out in the main repository.

The directory-selection behavior was reproduced by the user. The precise failed Git request and its stderr were not captured, and the native iOS implementation was not inspected; the branch-conflict explanation is therefore an inference, not a captured backend error.

Workaround

Before starting each affected Local task, explicitly select the main repository directory in the folder picker. This selection does not survive the conversation-navigation sequence above.

Related reports

  • #37591: branch controls resolve a different/stale worktree from the task context; reopening or reconnecting brings the mismatch back. Similar branch-switch symptoms, but an existing-task/desktop reproduction.
  • #41835: an iOS Remote-created task loses its worktree binding after project reassignment, followed by a branch-in-use error. Different trigger.
  • #31623: mobile Remote groups worktree directories as separate projects. Relevant to ambiguous directory selection.

I did not find an existing report with this exact select main directory → view older worktree conversation → create new Local task → directory reverts sequence. These links are related cases, not claims of a shared internal root cause.

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 tracing the iOS Remote Work locally flow and the conversation-navigation state described in the reproduction. The payload names no source files or tests, so first locate where a new task inherits its working directory and where manual directory selection is stored. Done means navigating from an older worktree conversation no longer replaces the explicitly selected main checkout, with branch selection succeeding afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, ios, rust
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.