Skip to content

codex-local: optional app-server daemon mode (packaged install) #16

Open

Description

@ehrvs

Summary

codex-local currently runs the TUI in-process (--no-daemon, plus features.daemon_auto_start=false; see the PR stack, 12/12). This issue tracks an optional, later phase in which codex-local can use upstream's app-server daemon the way stock codex 0.162+ does.

Why it's off today

  • Hook registrations are in-process. codex-local's hooks (H2 Ollama /model list, H3 resume sanitizer, H4 all-provider picker) are registered in the codex-local process. A daemon started from stock's package would run stock code without them.
  • Packaging. Upstream's daemon bootstrap needs a complete package next to the executable: codex-package.json, bin/codex, bin/codex-code-mode-host, codex-path/rg, and on Windows the sandbox helpers (app-server-daemon/src/prepare_install.rs). codex-local ships as a bare binary, which caused the "no complete local package" error.
  • Updater. Upstream's daemon-updater would pull stock releases over a fork build.

What we lose without it

  • Work dies with the terminal. Turns and sub-agent fan-outs stop when the terminal closes (no "Disconnected... running work continues"). Rollouts are kept and codex-local resume works.
  • No cross-terminal management. codex agents can't list or stop codex-local tasks from another terminal.
  • No other front ends. The desktop app and IDE can't attach.
  • Slower start. Startup is a little slower, because there's no warm engine.

Workaround: run codex-local inside tmux or screen.

Proposed approach

  1. Package format. Ship codex-local as a package from local-release.yml: a codex-package.json manifest, bin/codex-local, the code-mode host, rg, and the platform helpers. Install it under $CODEX_LOCAL_HOME/packages/.... Daemon files already live under CODEX_HOME=~/.codex/local, so they're isolated from stock.
  2. Daemon entry point. The daemon must be codex-local app-server, so it goes through codex-local's main and registers H2/H3/H4. Verify that the launched server path doesn't bypass the registrations.
  3. Updater. Disable it, or point it at local-v* releases on this repo, never at stock releases (prepare_install.rs, auto-update selection).
  4. Default mode. Remove the --no-daemon injection only when the package is present; keep in-process as the fallback.
  5. Tests.
    • Daemon start and attach with a pseudo-TTY.
    • Detach and reattach a running turn.
    • codex agents lists codex-local tasks.
    • Stock's daemon (PID, socket, locks under ~/.codex) stays untouched.
    • The fork surface stays within budget.

References

  • The root-cause plan is in the PR stack notes (local/docs/plan-deltas.md).
  • Isolation evidence: daemon socket, PID and lock paths derive from CODEX_HOME (app-server-daemon/src/lib.rs, app-server-transport/src/transport/mod.rs).

🤖 Generated with Claude Code

https://claude.ai/code/session_01RPCzgwU247gMtjybR5v4iR

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions