Repository navigation
fix(openclaw): keep the Python launcher fallback off the working directory - #4843
chopratejas wants to merge 5 commits into
Conversation
…ctory The proxy manager's Python fallback checked for headroom with `python -c` and started it with `python -m headroom.cli`, both of which put the current directory first on sys.path, so a headroom/ folder in the directory OpenClaw runs from was used instead of the installed package. Both now pass -P (Python 3.11+); older interpreters reject it and the launcher moves on. Assay-Kind: bugfix Assay-Ask: The OpenClaw plugin's Python launcher fallback could import a headroom package from the working directory instead of the installed one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR governanceThis PR follows the template and is marked ready for human review. |
With PYTHONPATH pointing at a headroom checkout the probe found that package and the test failed for a reason unrelated to the working directory. The probe now also runs with -E. Assay-Kind: tests Assay-Ask: The OpenClaw working-directory probe test failed whenever PYTHONPATH contained a headroom package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up the dependency updates from #4835 so the audit checks pass. Assay-Kind: deps Assay-Ask: The dependency audit checks failed on this PR because the branch predates the dependency updates on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JerrettDavis
left a comment
There was a problem hiding this comment.
The Python fallback change looks correct. I independently ran all 35 proxy-manager tests and TypeScript checking successfully. Real Python probes from a directory containing headroom/init.py exit 0 with the target-branch implementation and exit 1 with this change, confirming that cwd discovery is excluded. The PYTHONPATH review finding is resolved by -E in the regression test. I found no additional code defect. Qualification remains held by the inherited shared workflow provenance audit. Separately, the current commitlint job failed; its diagnostic log is needed to determine the cause before readiness can be established. Windows py and the full plugin suite were not independently tested.
JerrettDavis
left a comment
There was a problem hiding this comment.
The Python launcher fix and its regression test remain supported by the prior independent 35-test run, TypeScript check, and real Python head/base probes at this same commit. The newly available CI log identifies the remaining blocker: commit e75532b (chore: merge main into fix/openclaw-python-launcher-path) has a 116-character Assay-Ask footer. Commitlint job 132208024108 in run 43518951621 fails with footer-max-line-length; it requires at most 100 characters per footer line. Please reword that commit to wrap the footer and obtain a passing commitlint result. For example:
Assay-Ask: The dependency audit failed because this branch predates
the dependency updates on main.
No additional source defect found. Windows py and the full plugin suite were not independently tested. Inherited workflow provenance issues remain separately recorded and do not drive this change request under the supplied review-only baseline.
Sync PR #4843 with latest main.
JerrettDavis
left a comment
There was a problem hiding this comment.
The previously reported commit-message blocker remains at the current head. CI run 43547215469, commitlint job 132301219755, fails with footer-max-line-length on commit e75532b. Its Assay-Ask footer is 116 characters; the limit is 100. Please reword that commit to wrap the footer and obtain a passing commitlint result. For example:
Assay-Ask: The dependency audit checks failed because this branch predates
the dependency updates on main.
I rechecked both changed files against the current target and found no additional source defect. Earlier-head passing tests are context only; no new unit-test run is claimed. Inherited workflow provenance holds are recorded separately and are not the reason for this change request.
|
Jerrett, the commitlint blocker is cleared. The footer-length rule fix (#4868) is merged into main, and I merged main into this branch, so commitlint now passes on this head. No code changes in this update. |
Description
ProxyManager.buildLaunchSpecs()(plugins/openclaw/src/proxy-manager.ts) has a Python fallback: it probes withpython -c "...find_spec('headroom')..."and starts the proxy withpython -m headroom.cli proxy .... Both put the current directory first onsys.path, and the spawned process inherits OpenClaw's working directory, so aheadroom/folder there was found and run instead of the installed package.Both the probe and the launch now pass
-P(Python 3.11+: do not prepend the cwd tosys.path). Interpreters older than 3.11 reject-P, so their probe fails and the launcher moves on;headroom-airequires 3.11+ so they could not hold a real install.-Prather than-IkeepsPYTHONPATHand user-site installs working.Companion to the same change in
plugins/headroom-agent-hooks/bin/headroom-hook.sh(#4842); kept separate because this plugin has its own test suite.Type of Change
Changes Made
plugins/openclaw/src/proxy-manager.ts:-Pon the configured-python and fallback-python launch and probe args.plugins/openclaw/test/proxy-manager.test.ts: updated expected args; new test that runs each Python spec's probe with a real Python 3.11+ (site-packages disabled) from a directory containing aheadroom/package and expects "not found".Testing
vitest)ruff check .) (no Python changed)npm run typecheck)Test Output
Real Behavior Proof
headroom/__init__.py, run each Python launch spec's probe aspython3 -S <checkArgs>(-Sso no installed headroom can be seen).pylauncher (it forwards-Pto the interpreter).Runtime Rollout Safety
pythonPath/PYTHONPATH, or putheadroomon PATH).headroomexecutable on PATH or an explicitproxyUrlbypasses the fallback.Review Readiness
Checklist
CHANGELOG.mdAdditional Notes
No docs change needed.
🤖 Generated with Claude Code
Reported by @JoaoMarcos44. Thank you for your contribution! 🩵