Repository navigation
fix: allow Gateway startup in PRoot Ubuntu containers - #174974
Conversation
PRoot can expose the kernel PID namespace link while stat returns ENOENT when following its synthetic target. Parse the link's decimal inode so same-namespace owners keep their existing identity and admission rules. Unreadable or malformed links still preserve fresh foreign ownership. Add a failing-before regression and retain the namespace and Doctor contention coverage. The isolated live run now passes namespace admission, but full listener readiness remains blocked by an upstream PRoot assertion. Refs #171385
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesRead Linux PID namespace identity from its procfs symlink so Gateway startup works when PRoot cannot stat the link target. Example: Ubuntu 22.04.5 under Termux PRoot exposes /proc/self/ns/pid as pid:[4026532609], but stat returns ENOENT.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it fixes a concrete PRoot startup failure still present on main, with no actionable patch defect found; CI failure attribution remains unfinished. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherGateway startup, SQLite owner leases, and Doctor share namespace discovery and ownership classification; kernel boot and namespace identities qualify PID evidence before state access or recovery. flowchart TD
A[Gateway or Doctor] --> B[Namespace discovery]
C[Kernel boot and namespace links] --> B
B --> D[Shared ownership classifier]
E[Recorded owner and heartbeat] --> D
D --> F[Admit or refuse state access]
Technical reviewBest possible solution: Land the shared namespace-reader repair once the remaining CI failure is classified through the existing landing policy. Do we have a high-confidence way to reproduce the issue? Source establishes that stat failure produces null identity and fresh-owner refusal; the author additionally reports a real isolated PRoot reproduction, but this review executed no target code. Is this the best way to solve the issue? Replacing the failing probe in the shared reader addresses the cause without a bypass, duplicate owner, new option, or weaker foreign-owner policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9dd47e67ded4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3, Tests +43, Docs +1. Total +47 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 16, 2026, 10:37 PM ET / October 17, 2026, 02:37 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
PRoot can expose the kernel PID namespace link while stat returns ENOENT when following its synthetic target. Parse the link's decimal inode so same-namespace owners keep their existing identity and admission rules. Unreadable or malformed links still preserve fresh foreign ownership. Add a failing-before regression and retain the namespace and Doctor contention coverage. The isolated live run now passes namespace admission, but full listener readiness remains blocked by an upstream PRoot assertion. Refs openclaw#171385
Related: #171385
What Problem This Solves
Fixes Gateway startup refusing its own state ownership in a PRoot Ubuntu container with
GatewayLockNamespaceError.User Impact
The Gateway can start when PRoot exposes the PID namespace link but cannot follow it with
stat(). Unreadable or malformed namespace identities still refuse ownership; foreign-owner and heartbeat rules are unchanged. Thanks @caozhongbin for reporting this.Why This Change Was Made
Read the kernel namespace inode from
readlink("/proc/self/ns/pid"), which returnspid:[inode], instead of following PRoot's synthetic target. This preserves the existing identity format and admission policy without treating unknown identities as matching or adding a same-PID shortcut. No public API, dependency, or schema changes.Evidence
pnpm openclaw gateway runon Linux arm64, Node 24.21.0, Ubuntu 22.04.5, using unmodified Termux PRoot source at7f2fab0fb3a9e15f63ac47497ebc29d72281206e. The baseline refused its own fresh owner; the patched Gateway reachedready, returned HTTP 200 from/healthz, and bothgateway health --jsonandgateway call health --jsonreturnedok: truewith exit code 0. State and ports were isolated.stat()failing withENOENTwhilereadlink()succeeded; the patched production namespace reader returned matching valid identities.readlink_procbefore readiness. The unmodified Termux fork completed the full proof above. Actual Android hardware, x64 PRoot, and Bun were not exercised locally; the reporter should retest on the next release.The production change replaces one probe; test growth covers the readable-link/stat-failure regression and malformed-link refusal. Release-note context: restore Gateway startup in PRoot Ubuntu containers while preserving ownership checks.
CI on the exact head: run 38993644769 failed in two places. The update-CLI mock-export ratchet has the identical diagnostic in scheduled main run 38991549274. Two unchanged state-migration tests expect a completed cursor without the
version: 2field now written by the migration owner; both reproduce locally. Both cases also fail with the identical marker mismatch on clean main9dd47e67ded4986aabe211c62b5c26fc9eec0299(2 failed, 59 unselected); the native inherited-failure exception is being used for these baseline failures. No CI rerun or timeout increase was used.