Skip to content

bug: reject ambiguous Codex homes instead of queueing to an inactive copy #55

Closed

Description

@abruption

What happened

On a remote macOS host, an active Codex session was running under an Orca-managed per-account CODEX_HOME:

~/Library/Application Support/orca/codex-accounts/<account-id>/home

The default ~/.codex also contained a saved copy of the same thread UUID. Running discovery without an explicit home selected the default home:

$ session-peer list --host <mac> --agent codex --all --json
# Returns thread <thread-uuid> from ~/.codex/state_5.sqlite

A send to that UUID then reported success:

$ session-peer send --host <mac> --to codex:<thread-uuid> --json "message"
{"ok":true,"status":"queued","queueId":"<queue-id>",...}

The message was submitted to the queue associated with ~/.codex, but the live writer was using the Orca account home, so the active session never consumed it. From the caller's perspective this looked like successful delivery to the intended session.

Repeating both commands with the live process's actual home fixed the problem:

$ session-peer list --host <mac> --agent codex \
    --codex-home "~/Library/Application Support/orca/codex-accounts/<account-id>/home" --json

$ session-peer send --host <mac> --to codex:<thread-uuid> \
    --codex-home "~/Library/Application Support/orca/codex-accounts/<account-id>/home" \
    --json "message"

The second queue item appeared in the active rollout and was consumed.

Diagnosis

The current home selection is internally consistent but can be consistently wrong:

  1. Without --codex-home, the destination uses its CODEX_HOME environment variable or falls back to ~/.codex.
  2. An Orca-launched Codex process has a process-specific account home; a separate SSH command does not inherit that environment.
  3. Discovery and queue submission both use the fallback home, so validation succeeds.
  4. Codex thread UUIDs can exist in more than one home, so UUID resolution alone does not identify the live instance.
  5. The JSON result exposes status: "queued" but not the resolved home or the fact that consumption remains unconfirmed.

The human-readable output already explains that queue submission is not evidence of consumption. The JSON response does not carry the same distinction explicitly enough for automation.

What was expected

session-peer should not silently report an apparently successful send to an inactive copy when the intended thread is actively running under another Codex home.

At minimum, callers should be able to see exactly which destination home was used. When multiple detected/configured homes contain the same thread, resolution should fail as ambiguous unless the caller selects one explicitly.

Proposed safeguards

  • Include the resolved destination codexHome in Codex list, dry-run, and send JSON.
  • Make the submission semantics explicit, for example submitted: true plus consumptionConfirmed: false, while preserving compatibility with status: "queued".
  • Add a way to configure or discover multiple Codex homes on a destination (including app-managed per-account homes).
  • When the target UUID exists in more than one known home, reject it as ambiguous and list the candidate homes; require --codex-home to continue.
  • Extend doctor from feat: v0.7 roadmap — doctor, reply waiting, reply URIs, and SSH return-route diagnostics #45 to compare the selected home with running Codex processes where the OS permits reliable inspection.
  • Document the current workaround: always pass --codex-home for Orca/multi-account sessions.

Automatic process inspection may be platform-specific and should not be required to implement the first two safeguards.

Environment

  • session-peer: 0.6.0
  • Codex CLI: 0.154.0
  • Destination: macOS on Apple Silicon
  • Launcher: Orca with a per-account Codex home
  • Transport: SSH
  • Reproduced: 2026-09-13

Acceptance criteria

  • Codex JSON output identifies the resolved destination home and does not imply consumption.
  • Tests cover the same thread UUID being present in two configured/discovered homes.
  • Ambiguous resolution fails with an actionable error instead of queueing silently.
  • Explicit --codex-home continues to select and queue to the requested home locally and over SSH.
  • Single-home/default installations retain current behavior.
  • The multi-home/Orca workaround is documented until automatic or configured discovery ships.

Related: #45 (diagnostics and status semantics), #29 (JSON contract).

Activity

  1. added
    bug
    on Sep 14, 2026
  2. abruption commented on Sep 15, 2026

    @abruption
    OwnerAuthor

    2026-09-15 follow-up review against the reported mac-mini → MacBook/Orca reproduction:

    The stale item in the wrong default queue was not modified or deleted.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions