Skip to content

fix: reject ambiguous Codex homes before queueing - #56

Merged
abruption merged 1 commit into
mainfrom
fix/55-codex-home-ambiguity
Sep 15, 2026
Merged

abruption merged 1 commit into
mainfrom
fix/55-codex-home-ambiguity

Conversation

@abruption

@abruption abruption commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #55. Related: #45 (diagnostics/observation) and #29 (JSON contract).

  • Add resolved destination codexHome to successful Codex list, dry-run and send results, including SSH/multi-host results and human output.
  • Preserve status: queued|validated, existing envelope shapes and queueId; add submitted (false for dry-run) and consumptionConfirmed: false to successful Codex sends. Errors retain their existing shape, and timeout remains an unknown submission outcome.
  • Before an implicit send/dry-run, check the selected/default home, existing macOS Orca account-home databases and additional homes configured by destination SESSION_PEER_CODEX_HOMES (JSON array). Reject duplicate UUIDs, including archived copies, before invoking the queue CLI; report candidate homes and require --codex-home.
  • Fail closed on unreadable inventories/databases, incompatible duplicate-check schemas and missing configured additional databases. Deduplicate resolved path aliases. Never automatically switch to another home. An explicit --codex-home selects that copy and bypasses unrelated inventory checks.
  • Keep single-home/native queue behavior, Claude behavior, default selection precedence and existing CLI arguments compatible. No process inspection, database writes, wake or acknowledgement observer added.
  • Document the Orca/local/SSH workaround, configuration scope, additive JSON semantics and detection limits in README/help. Explain that these safeguards are not yet in the published 0.6.0 package.

Type

  • feat
  • fix
  • docs
  • chore / refactor / test / perf

Reproduction and regression coverage

New fixture tests create the same thread UUID in a default .codex database and an Orca account database. Before the fix, the implicit send returned success and called the queue stub for the default copy (expected rejection assertions failed); the new metadata assertions also failed. After the fix, send and dry-run reject the ambiguity without any queue call or fixture DB content changes.

Coverage also includes configured homes without macOS discovery, CODEX_HOME versus default copies, archived duplicates, absent/broken/unreadable inventories, explicit bypass, unrelated homes, no automatic rerouting, symlink aliases, paths containing spaces/Unicode/shell metacharacters, the unchanged single-home case (including native send without a discovery DB), local/SSH dry-run, per-host metadata and timeout semantics.

Checklist

  • Current session_peer.py list works locally (legacy PR-template command updated to current product).
  • Current session_peer.py list --host <real macOS host> checked over SSH, without installation changes.
  • Explicit-home Codex dry-run resolves locally and over real SSH without posting/queueing.
  • Conventional Commit; only implementation, regression tests and README changed.
  • README/help updated; no secrets, tokens, actual session IDs or account identifiers in the diff.

Validation results

  • python3 -m unittest discover -q: 161 tests passed locally (27 new tests; original suite had 134).
  • python3 -m compileall -q cc_peer.py session_peer.py test_cc_peer.py test_session_peer.py test_codex.py test_install.py: passed.
  • shellcheck --shell=sh --exclude=SC2016,SC1007 install.sh: passed.
  • git diff --check: passed.
  • uv build: wheel and sdist built; independently installed in isolated environments. CLI version and package-manager update protection checked. Distribution contents match source and exclude legacy code/user files.
  • README: 12 shell fences pass sh -n; 26 CLI examples parse without execution; local anchors/links checked.
  • Real local/remote macOS smoke checks: Claude/Codex read-only discovery and explicit-home Codex dry-run passed, including resolved home and submitted: false, consumptionConfirmed: false. Live messages were not sent. Duplicate-home rejection is established by deterministic fixtures, not claimed as a live consumption test.
  • GitHub CI: all checks passed in run 34807397360: Ubuntu/macOS Python 3.9 and 3.13, Windows Python 3.13 (platform-specific skips), wheel/sdist, standalone install smoke, shellcheck, plus GitGuardian security checks.

Remaining limits / follow-ups

  • The inventory is intentionally bounded. Automatic Orca discovery covers only the reported macOS Library/Application Support/orca/codex-accounts/*/home layout. Other layouts/platforms require configured additional homes or explicit selection.
  • No process-based liveness inference. Copies appearing after the check or in unknown/unconfigured homes can be missed; there is no atomic cross-home snapshot. Explicit selection also does not prove that a live writer uses that home.
  • Listing still reads one selected home and does not itself prove a send is unambiguous. This is not the unified JSON envelope redesign (--json output can't say which host it came from, and the shape differs per command #29), doctor, or a receipt/acknowledgement observer (feat: v0.7 roadmap — doctor, reply waiting, reply URIs, and SSH return-route diagnostics #45).
  • No version bump, release, remote deployment or PyPI publication in this PR. Legacy cc-peer is untouched. Existing untracked user file is untouched and excluded.
  • Please leave this PR unmerged for the user's review.

@abruption
abruption merged commit 25ae1d3 into main Sep 15, 2026
9 checks passed
@abruption
abruption deleted the fix/55-codex-home-ambiguity branch September 18, 2026 07:58
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.

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

1 participant