Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
session_peer.py has grown to about 3,972 lines, 133 top-level functions and 16 classes. It now contains Codex home ownership, Claude transport, Antigravity bridging, SSH/Tailscale routing, reply envelopes, diagnostics, update logic and CLI construction. The single-file form remains valuable because SSH list/send can push and execute one standard-library-only file on a destination that has not installed the package.
Design and implement a staged internal modularization without losing that deployment property.
Constraints
- Python 3.9 remains the core floor and the core CLI remains third-party-dependency-free.
session_peer.pymust remain directly executable and usable byinstall.sh, remote push/update and old standalone deployments.- Existing CLI flags, exit codes, JSON envelopes, security failure modes and submission/consumption semantics remain compatible unless separately approved.
- Keep the frozen root
cc_peer.pycompatibility artifact unchanged. - Do not mix relay protocol changes, OAuth/control changes or live infrastructure changes into this refactor.
Proposed direction
- Define stable internal boundaries such as
codex,claude,antigravity,ssh,diagnostics,updates,repliesand CLI wiring. - Keep canonical maintainable source in an internal package.
- Produce the standalone script deterministically at build/release time, or choose an equivalently reviewable design that does not require the destination to install a package.
- Add a CI check that regenerating the standalone artifact produces no diff.
- Migrate one boundary at a time with behavior-focused tests before deleting the old section.
Acceptance criteria
- Maintainers edit each implementation in one canonical place; no hand-maintained duplicate modular and standalone logic.
- The standalone script works when copied alone to a clean supported host.
- Local, SSH, Codex multi-home/wake, Claude, Antigravity, doctor, update, MCP and paired relay dispatch tests retain their current behavior.
- Wheel and sdist entry points remain installable and the standalone updater remains compatible.
- Generation is deterministic and fails CI on stale output.
- macOS/Linux Python 3.9/3.13 and Windows Python 3.13 CI pass, along with optional relay/MCP jobs.
- Documentation explains the canonical source and generated artifact boundary.
Sequencing
Do this after the repository layout cleanup in #111 so file moves and behavioral refactoring are not mixed in one review.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
abruption commentedon Sep 20, 2026
Target release: v1.0.0 stable. Sequence this after the test/CI boundaries in #113. The stable-release gate is behavioral compatibility across the alpha CLI, deterministic standalone generation, clean install/update/remote-push verification, and the full supported OS/runtime matrix; this is not an alpha patch refactor.
abruption commentedon Sep 21, 2026
The v1 compatibility contract proposed in #120 is the behavioral baseline for this modularization. Please keep
tests/fixtures/compatibility-v1.jsonandtests/test_compatibility_contract.pygreen, preserve the generated standalone CLI's required JSON/exit/reply behavior, and treat any incompatible surface change through the documented version or migration rule.