Skip to content

Worktree-bound Codex starts fail with “app-server process is not running” while unbound starts succeed #554

Description

@mplibunao

Summary

Codex-backed Agent Mode sessions fail during provider startup whenever they are bound to an app-managed worktree, while the same Codex model starts successfully without a worktree binding and Claude Code starts successfully in the same worktree.

The session is created and queued, then terminates with:

Codex native start failed: Codex app-server process is not running.

Reproduction

Starting state:

  • RepoPrompt CE with a multi-root workspace
  • An app-managed Git worktree created through manage_worktree
  • Codex CLI installed through npm and launched with a mise-managed Node runtime

Run the following in the same application session:

Start type Result
Codex, no worktree binding Starts and completes
Claude Code, worktree-bound Starts and completes
Codex, bound through worktree_id Fails during provider startup
Codex, bound through worktree: "@branch:<name>" Fails during provider startup

The failure reproduced on every worktree-bound Codex attempt.

Expected behavior

A Codex session should start with the worktree as its thread and turn cwd, regardless of whether the app-server process itself is launched from the logical checkout or another stable directory.

If the launcher exits, the resulting error should include a bounded stderr excerpt and termination status rather than only reporting that the process is not running.

Actual behavior

RepoPrompt projects the same resolved worktree path into both:

  1. the Codex app-server process working directory; and
  2. the Codex thread, turn, and sandbox working directory.

This makes provider bootstrap sensitive to repository-local toolchain configuration before thread/start occurs.

At failure time, another healthy Codex app-server owned by an unbound session remained alive. The worktree-bound attempt did not leave an additional app-server process running.

Source findings

CodexNativeSessionController.startOrResume calls:

await client.updateWorkingDirectory(workspacePath)

and then uses the same workspacePath for thread/start.cwd and thread/resume.cwd. The client passes that directory directly to ProcessLauncher.spawn.

CodexAppServerClient drains stderr but retains it only through optional debug printing. Process termination/reaping results are also discarded. Several transport-loss paths consequently collapse into .processNotRunning.

The precise historical launcher trigger is not recoverable. A cwd-sensitive wrapper, Node/mise shim, or trust/configuration failure is plausible, but not proven.

The relevant Codex startup files are unchanged between v1.0.28 and v1.0.29, and the same coupling remains in v1.0.29.

Regression context

Worktree-bound Codex agents worked in the same workspace around July 9–13, 2026. The failure was first observed on July 15.

Restarting RepoPrompt CE and removing stale debug CLI daemon processes did not change the result.

Related but distinct issues

This issue occurs after the worktree binding is accepted and specifically affects Codex app-server provider startup under the worktree cwd.

Acceptance criteria

  • A worktree-bound Codex session starts successfully while retaining the worktree for thread, turn, and sandbox execution.
  • App-server launch cwd and Codex execution cwd are modeled independently.
  • Both paths come from the same owning logical-root/worktree binding in multi-root workspaces.
  • A controller is replaced when either launch cwd or execution cwd changes.
  • Early launcher exit reports executable, launch cwd, termination status or signal, and a bounded stderr tail.
  • Regression coverage exercises unbound, existing-worktree, created-worktree, inherited-worktree, and secondary-root projections.
  • Explicit shutdown and lifecycle teardown are not mislabeled as observed process exits.

Environment

  • RepoPrompt CE debug build; source rechecked against v1.0.29
  • macOS, Apple Silicon
  • Codex CLI installed npm-global
  • Node runtime managed through mise

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions