fix(env): clone state containing Unix sockets - #109
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 7:36 PM ET / 23:36 UTC. ClawSweeper reviewWhat this changesThe PR skips Unix-domain sockets during recursive environment-state copies and adds a Unix-only test proving normal files still copy. Merge readinessKeep this active, member-authored PR open for normal maintainer approval. Current main still sends Unix sockets to Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherOCM environment lifecycle commands recursively copy durable state into a new environment before its services start. The shared copy helper feeds clone, import, migration, and simulation flows, which then create fresh runtime endpoints in the destination. flowchart LR
A[Environment lifecycle command] --> B[Recursive state copy]
B --> C{Filesystem entry type}
C -->|Directory or link| D[Copy durable state]
C -->|Unix socket| E[Omit live endpoint]
D --> F[Destination environment]
E --> F
F --> G[Services create runtime endpoints]
Before merge
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Merge the focused socket-omission behavior after ordinary maintainer review, retaining the UnixListener regression test as the contract for live runtime endpoints. Do we have a high-confidence way to reproduce the issue? Yes: on Unix, create a UnixListener inside a source tree and call the current recursive copier; current main's file-type fallthrough reaches fs::copy, while the branch test exercises the repaired path. Is this the best way to solve the issue? Yes: checking FileTypeExt::is_socket after existing symlink and directory handling preserves durable copy semantics while excluding a non-copyable live endpoint before fs::copy. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning high; reviewed against 035686953c68. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Problem
ocm env clonecould not clone a running environment when its state treecontained a live Unix-domain socket.
The recursive state copier handled directories and symlinks specially, but
sent every other file type to
fs::copy. A service-owned socket such as:therefore caused the entire clone command to fail before the target environment
was registered. This blocked canary, recovery, and migration workflows for
otherwise healthy environments.
Why the socket should not be copied
A Unix socket is a live process endpoint, not durable environment data. Its
contents cannot be copied into another environment, and the owning service must
create a new socket when that environment starts.
The correct clone behavior is therefore:
Fix
copy_pathnow detects Unix sockets withFileTypeExt::is_socket()and skipsthem. A Unix-only regression test binds a real
UnixListener, clones thesource tree, and verifies that:
Closes #108
Testing
cargo test copy_dir_recursive_skips_unix_sockets -- --nocapturecargo test --test env_clone_tests -- --nocapturecargo test --test daemon_runtime_tests -- --test-threads=1 --nocapturecargo test --workspace -- --test-threads=1 --skip bin_wrapper_runs_with_an_overridden_homecargo build --releasecargo fmt --checkgit diff --checkThe local host lacks
rustup, so its unrelated wrapper fixture was excludedfrom the broad local run. GitHub CI ran the complete suite, including that
fixture, successfully on macOS and Ubuntu.
Live proof
ocm env clone main main-ecf-canary --jsonfailed onMain's live
.openclaw/tailscale/tailscaled.sockTailscale or deleting the socket
unchanged immediately after clone and after supervisor convergence
Worked on by