Repository navigation
feat(guest): share the Python guest filesystem engine - #333
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:03 PM ET / September 14, 2026, 00:03 UTC (Revision 5). ClawSweeper reviewWhat this changesAdds a public Python filesystem engine for caller-launched Linux/macOS guests, with basename checks, support for long filenames, protocol documentation, and regression coverage. Merge readiness✅ Ready for maintainer review This remains a distinct contribution absent from current main. The previous filename and merge-conflict blockers are resolved, the recorded runtime proof still applies, and no actionable patch defects were found. Priority: P2 Review scores
Verification
How this fits togetherThe host supplies authorized roots, operation arguments, and file bytes to a Python program inside a guest. The program performs descriptor-relative filesystem operations and returns bytes, directory listings, or exit statuses; authorization and process lifetime remain with the caller. flowchart LR
A[Caller authorizes roots and paths] --> B[Guest transport]
C[Exported Python source] --> B
B --> D[Validate basename syntax]
D --> E[Descriptor-relative filesystem operations]
E --> F[Guest files and directories]
E --> G[Bytes listings and exit status]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Maintain one documented guest engine in fs-safe and migrate downstream consumers together after a separately approved package release. Do we have a high-confidence way to reproduce the issue? Not applicable to the extraction as a whole; the included long-filename repair has focused regression coverage and recorded after-fix filesystem proof. Is this the best way to solve the issue? Yes. A source-only subpath supports guests without Node while preserving caller-owned transport and authorization, and avoids reviving the retired host-side Python worker. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 168f1d033ebf. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
b9ca0b8 to
3e21fa7
Compare
3e21fa7 to
b913fff
Compare
What Problem This Solves
OpenClaw carries a 663-line Python filesystem engine for Docker and SSH guests, including writes, exclusive create, bounded reads, copy, rename/EXDEV fallback, directory traversal, and removal. Its workspace bootstrap also reuses the no-replace rename implementation. These filesystem mechanics can have one maintained owner in fs-safe.
Why This Change Was Made
Add
@openclaw/fs-safe/guestwith the complete Python source string, two existing protocol exit constants, and the independently consumed no-replace rename fragment. Importing the subpath performs no I/O or process launch. The caller keeps transport, interpreter discovery, quoting, mount selection, read-only policy, path authorization, and live authority.The extracted engine has two deliberate repairs: basename syntax validation before filesystem operations, and short independent staging names. The latter fixes an inherited
NAME_MAXfailure for legal 240-byte destinations during writes and cross-device file/directory moves. The argument frames, standalone rename fragment, publication order, and all other program bytes are unchanged. The docs describe the trusted-root boundary and existing cancellation, resource-budget, and partial-publication limits.User Impact
The prepared OpenClaw cutover deletes both program modules and migrates every Docker/SSH/bootstrap consumer through a six-line infra facade: 657 fewer OpenClaw production lines, with zero net test/support lines. It targets OpenClaw
610f6dcfef322b85af25f0df495715e426adaee5; all seven consumer/test bodies retain their behavior.Linux/macOS guests need Python 3, without requiring Node or the fs-safe addon inside the guest. Adoption waits for a separately approved fs-safe release. This PR changes no dependency versions or native ABI and does not activate unavailable imports in OpenClaw.
Evidence
pnpm checkpassed on the reviewed code: 6,248 tests passed, with 2,820 existing platform/native gates skipped; build, docs examples, public API inventory, and installed-tarball smoke passed. Integration with current main changed only release-note placement and the README table; guest source and tests remain byte-identical to the reviewed code. Combined build/package checks passed on the updated base. Docs-site build also passed.Captured Linux guest and installed-tarball output
The package smoke verified different device IDs before moving a 131,089-byte payload from temporary storage to
/dev/shm. The task-owned Linux environment was released after proof.CHANGELOG.mdupdated when release-relevant