Repository navigation
fix(daemon): keep egress-proxy CA paths out of service units - #177007
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
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. |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4fd4f8a1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const proxyUrl = normalized.HTTPS_PROXY; | ||
| const legacyProxy = | ||
| legacyCa(caPath) && /^http:\/\/openclaw:[^@]+@127\.0\.0\.1:\d+$/u.test(proxyUrl ?? "") | ||
| ? proxyUrl! | ||
| : ""; |
There was a problem hiding this comment.
Detect both legacy proxy variables independently
When a pre-receipt service still contains the injected HTTP_PROXY but an operator has replaced or removed HTTPS_PROXY, legacyProxy is empty because it is derived only from HTTPS_PROXY. The later matching logic therefore preserves both the dead authenticated loopback HTTP_PROXY and NODE_USE_ENV_PROXY while removing the temporary CA, so doctor --fix or reinstall leaves HTTP requests routed through a proxy that disappeared with the old Gateway. Classify each legacy proxy variable independently and remove the Node flag when either injected proxy remains.
AGENTS.md reference: AGENTS.md:L75-L76
Useful? React with 👍 / 👎.
|
@clawsweeper re-review Updated in 4988784: removed the inherited JSON marker and replaced it with the egress owner's fixed-key structural filter. Operator CA paths and surviving corporate proxy activation are preserved. The native, session-owned restoration fingerprint handoff remains intact. The PR body includes the passing clean Linux replay, current checks, LOC, and the three unresolved failures in unchanged consumer suites. |
|
🦞👀 Re-review progress:
|
…w#177007) Running openclaw gateway install from inside a Gateway exec with the secret egress proxy enabled captured that Gateway's per-process NODE_EXTRA_CA_CERTS (an ephemeral trust bundle under its state dir) into the new service unit, so the installed Gateway and its children later pointed at another profile's stale or live proxy CA. The egress-proxy owner now exports the fixed set of variables it injects plus a structural check for its own per-process artifacts; service installation (systemd, launchd, Scheduled Task) excludes only those values and keeps operator-set CA and proxy settings. openclaw doctor --fix repairs existing units, and Doctor restoration accepts exactly the definition its own repair wrote, so the service is restarted instead of left stopped. Fixes openclaw#176479
Fixes #176479
What Problem This Solves
Installing a Gateway from another Gateway's exec environment can persist the caller's temporary secret-egress-proxy CA in the service unit. After the caller restarts, the installed Gateway and its children inherit a missing CA path.
User Impact
Installation excludes process-owned proxy artifacts on systemd, launchd, and Windows tasks while retaining operator CA files. The shared classifier preserves corporate proxy values; existing service proxy-capture policy still applies.
openclaw doctor --fixrepairs affected definitions with backups, preserves unrelated settings, and restores service availability.Why This Change Was Made
The egress-proxy owner supplies its fixed injection key set and a shared structural predicate. CA paths are normalized before checking whether they reside inside a
secret-egress-proxy/gateway-*/directory; proxy URLs must match the owner's authenticated loopback endpoint shape. Arbitrary keys and ordinary operator values are preserved. There is no environment-carried provenance marker or JSON parser. A surviving corporate HTTP(S) proxy retainsNODE_USE_ENV_PROXY; that flag is removed only when the HTTP(S) proxies present are all proxy-owned.Doctor detection, preservation checks, and install capture use the same predicate. Doctor's restoration handoff uses an exact fingerprint captured by this maintenance session's own native writer under its operation lock and authority. It cannot be supplied through environment data. The unchanged definition remains valid when no repair runs; a later edit or foreign ownership is rejected. Same-install repairs with verified unchanged/restored outcomes resume the previous running service with a warning.
The node-service launcher repair from #175860 activates through its own native installer. Gateway policy refresh occurs before the stopped-service snapshot. Repairs performed during Gateway restoration share the same native-write handoff.
Evidence
f4fd4f8a: it removes an operator's CA andCUSTOM_SETTING. It passes after deleting the marker mechanism. The corporate-proxy activation regression also fails before its fix and passes afterward. Tests cover arbitrary keys, normalized paths outside proxy directories, Windows casing, real proxy artifacts, Doctor drift/repair, and restoration.node scripts/run-vitest.mjs … --maxWorkers=4. Combined completed results: 1,652 passed, 8 skipped, 3 failed. Two failures are the unchanged database-rollback Git case timeouts; the third is the unchanged rollback state-verification case detailed below. A lint-only rename during the first run invalidated its frozen compiler snapshot; the 59 affected files were replayed with source frozen, producing 1,177 passed, 8 skipped, 1 failed in 1,417.47s and a clean compiler-integrity check. Initial completed suites took 1,221.99s including the rejected later shards. These are not reported as a green broad run.CUSTOM_SETTING=retained, stopping the origin removed its CA.node /candidate/openclaw.mjs --profile proof doctor --fix --yes --non-interactive --no-workspace-suggestionsexited 0, removed the stale CA, preserved the custom setting, wrote definition/receipt backups, restored the service to active, and returned HTTP 200 from/healthz; zero missing-CA warnings appeared in the final invocation. Both the owned container and image were removed.tsgo, directoxlinton changed production/test files,oxfmt --checkon all 18 changed files,git diff --check, andmadgeall passed; madge found zero cycles. Full build passed (4m43.7s); final runtime build passed (1m15.3s).Full
check:changedSQLite inventory was skipped under the local gate time budget. Existing ratchets are not changed: the environment-name budget is already over its limit on the base (459/452); the removed marker's historical name remains only in forgery fixtures. Existing max-lines suppression findings are in untouched chat/config/sessions UI files. The build reported a UI boot gzip advisory (1025.6 KiB against 1025.4 KiB); no UI source or budget was changed. Current slow-test timings and any failures are recorded below.The unchanged
update-command-database-rollback.test.tsexceeded its 120s case budget forgit(120.057s) andgit-edited(120.058s);packagetook 117.941s andexited-writer80.252s. This 13-case serial integration fixture repeatedly creates packages and SQLite state, boots child services, runs the full update/Doctor/finalization path, and launches isolated database workers. Git cases additionally perform real local Git transactions; pnpm build is mocked, so package installation/network is not the cause. The source and durations support cumulative subprocess/module-load and worker-round-trip cost; the log has no phase-level timing, so precise attribution remains open. These timeouts are recorded, not retried or weakened. Other unchanged update fixture maxima and final consumer totals follow below.The unchanged
update-command-rollback.test.tsalso failedidentity-read-failed schema change; previous verified=true; service=stoppedin 1.827s: candidate state verification returnedrollback-state-unverifiedbefore any restoration step or the changed service revalidation was reached. The rollback catch omits the underlying exception from this fixture result when no update run is provided, so the exact worker/read cause remains unresolved; this is not presented as a proven timeout or patch regression. It was not rerun to chase green.Other unchanged slow suites:
update-cli.git-service.test.tshad 11 cases over 30s (maximum 114.726s, “reports managed Git restart failure: refused”);update-cli.service-authority.test.tshad nine (maximum 102.341s, final ancestry refusal); the rollback replay reached 44.112s for the owned-include-alias case. They exercise repeated service/update/worker lifecycles. No timeout, retry, skip, or assertion was weakened. Precise phase profiling remains a separate follow-up.No new runtime environment variable, config/CLI option, schema, dependency, baseline, or suppression.