Skip to content

fix(proxy): keep WebChat and Codex loopback calls direct - #154013

Merged
steipete merged 3 commits into
mainfrom
upd/proxy-loopback-bypass
Sep 21, 2026
Merged

steipete merged 3 commits into
mainfrom
upd/proxy-loopback-bypass

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Closes #153930. Thanks @eefreenyc for the report and proxy-environment comparison.

What Problem This Solves

Fixes WebChat/native Codex loopback 502 and handshake failures after upgrading a managed-proxy installation from 9.3 to 9.4/9.5.

User Impact

Default managed routing keeps runtime loopback HTTP/WebSocket listeners direct while external requests still use the proxy. Explicit proxy and block modes remain enforced. Doctor reports failed loopback probes with recovery commands, and update-readiness diagnostics identify the route correctly. No new configuration option or migration is required.

Why This Change Was Made

Commit 8169aacdda92, first shipped in 9.4, added a native Codex loopback inference relay while managed routing still cleared NO_PROXY. The shared Proxyline bypass policy and loopback exclusions for native children repair that boundary. Per-request registrations are no longer needed; retained callbacks still enforce explicit block policy.

The CI follow-up preserves that routing contract. Main's wildcard-listener change 192ff574a21 concerns TCP readiness, and 7723e490386 concerns Doctor completion/cleanup; neither calls for sending default loopback traffic through an external proxy.

Evidence

CI attached to head e5310014ee9386015eb0ea896d0c5975cfc9f8f6: run 35557127865, in progress at handoff.

Input-safety fixture follow-up: replaced the Doctor test proxy URL containing username/password userinfo with an unauthenticated reserved .test URL. Production code and assertions are unchanged. All 17 Doctor tests passed, with a longest case of 148 ms; local wrapper wall time was 195.80 s, including 116.886 s preparing the shared subprocess bundle (11,195 inputs / 15,060 outputs). The initial local build could not execute tests because the pre-rebase install had fs-safe 0.16.0; restoring the existing frozen lockfile installed the declared 0.17.0 without source/lockfile edits. Scoped formatting, lint, and fresh P1 autoreview passed. Exactly one re-review request was posted for this revision.

Testbox proof: owned Linux runner. All 197 focused tests passed. The four original CI shard selections each passed three replays in their original order, totaling 15,822 passing cases per replay. TUI and outbound-custody files each passed 20/20 standalone reliability runs after fixing their causes. The new direct-probe diagnostic regression was also demonstrated failing against the original readiness implementation.

Final node scripts/check-changed.mjs completed with exit 0, including core/test typechecks, formatting, lint, guards, and all three dead-export scans. The first gate caught the TUI fixture's unsupported Promise.withResolvers; replacing it with the existing createDeferred helper was followed by a fresh TUI run (18 passed) and the complete green gate. Fresh P1 autoreview: scoped-clean, no accepted/actionable P0 or P1 findings. The owned Testbox is stopped; its wrapper's successful exit/timing evidence is authoritative if lease cleanup marks the Actions container run cancelled.

Measured focused-file wall time with one worker on Testbox:

File Passing tests Wall time
src/tui/gateway-chat.test.ts (final corrected run) 18 11.52 s
src/infra/update-candidate-canary.test.ts 53 19.92 s
src/gateway/client.test.ts 116 13.05 s
src/infra/state-migrations.outbound-custody.test.ts 4 8.11 s, versus the original 90 s setup timeout
src/infra/state-migrations.outbound-preparation.test.ts 6 21.04 s

The test interdiff is +143/−101 lines (net +42); the production interdiff is detailed below.

Failing file Decision and repair
src/tui/gateway-chat.test.ts (a) Fixture/assertion update. A preceding module reset split client and proxy ownership, causing Proxyline to reject different callback identities before the block guard. Import both from the same module graph, await error delivery, and assert the full block error plus recovery command exactly once.
src/infra/update-candidate-canary.test.ts (a) Contract update. The live loopback listener must still return 200 after readiness under the persistent default bypass; the external target must return the dummy proxy's 502. Request accounting is exact, and explicit proxy/block cases remain. A new regression also prevents labeling a failed direct probe as “via proxy.”
src/gateway/client.test.ts (a) Contract update. Replace retired registration/unregistration counts with the installed policy's loopback/external decisions before WebSocket construction, retaining exact connection-error forwarding and proxy/block tests. Restore all environment fields changed by inherited routing.
src/infra/state-migrations.outbound-custody.test.ts Existing owner repair, #154123 (c159663b126). The 90-second failure came from a fixture running four broad Doctor sweeps. Reuse the focused nested-maintenance test repair, preserving native writability, physical exclusion, exact acquisition/disposal causes, and receipt coverage. Deadlines are unchanged.

The production interdiff against 630e6f50dd9 is +6/−2 lines, solely in src/infra/update-candidate-canary-readiness.ts: proxy attribution now comes from the effective mode rather than the removed registration's return value. No routing-policy narrowing was needed.

Initial proof remains: 75 focused tests, routing and Doctor regressions demonstrated failing before the fix, and an isolated real-Gateway/native-Codex turn completed in 15.144 seconds with zero loopback proxy attempts and four external proxy connections to a scripted provider. Cleanup confirmed the owned Gateway stopped.

Known separate defect: the first isolated attempt spent 70.3 s reaching Gateway readiness, then failed with codex app-server request timed out. Native model discovery applies its 2.5 s acquisition budget at extensions/codex/src/app-server/model-catalog.ts:126; the timed scope in request.ts:308 includes app-server preparation and startup before catalog reads. The exact expired phase was not captured. This is assigned to a separate native-startup budget repair lane; the successful instrumented turn is proxy-routing evidence, not a repair of that timeout.

Landing review disposition

The latest ClawSweeper comment (5752252448, updated 2026-09-21 02:20:59 UTC) reports that its input-safety check blocked review; it contains no completed verdict or Rank-up moves. There are therefore no Rank-up changes to apply or skip. The native ClawSweeper gate reports completed review is missing or expired, so landing is stopped pending maintainer qualification of the flagged material and a completed review. This does not assert that the material is a real credential or a safe fixture. No source changes or test reruns were made during this landing attempt.

@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated 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.

ClawSweeper will not retry this unchanged revision.

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.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 20, 2026 19:55
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: M maintainer Maintainer-authored PR labels Sep 20, 2026
In 9.4, 8169aac added the native Codex loopback inference relay
while managed proxy routing still cleared NO_PROXY.

Use Proxyline's shared bypass policy and supply loopback exclusions to
native children. Explicit proxy/block modes remain unchanged. Doctor
reports failed loopback probes with recovery commands.

Fixes #153930. Reported by @eefreenyc.
@steipete
steipete force-pushed the upd/proxy-loopback-bypass branch from bc041be to 630e6f5 Compare September 20, 2026 21:37
Keep default loopback routing direct after canary readiness and assert
that external requests still reach the proxy. Attribute readiness failures
to the proxy only in explicit proxy mode.

Keep the TUI client and proxy lifecycle in one module generation after
mock resets, assert the full block-mode recovery message exactly once,
and verify the inherited policy at Gateway WebSocket construction.

Include the existing test-only outbound custody repair from c159663
(#154123), preserving nested maintenance, physical exclusion, native
writability, failure causes, and migration receipts without longer budgets.

Related: #153930
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L and removed size: M labels Sep 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete enabled auto-merge (squash) September 21, 2026 04:41
@steipete
steipete merged commit 8dc1294 into main Sep 21, 2026
216 checks passed
@steipete
steipete deleted the upd/proxy-loopback-bypass branch September 21, 2026 04:42
vincentkoc added a commit to jb510/openclaw that referenced this pull request Sep 21, 2026
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (49 commits)
  fix(ci): remove duplicate database worker test entry
  fix(voice): keep audio flowing while the Gateway is busy (openclaw#154119)
  docs: reserve Team live updates for Night Watch (openclaw#154425)
  test(meeting-bot): control browser retry fixture clocks (openclaw#149174)
  fix(ui): use remote defaults for manual worktree creation (openclaw#154364)
  fix(proxy): keep WebChat and Codex loopback calls direct (openclaw#154013)
  fix(pr): revalidate head reads and reuse repository locators (openclaw#154212)
  fix(browser): start control when the Gateway has activated the plugin (openclaw#154255)
  improve: publish CI dependencies promptly and warm hosted JavaScript caches (openclaw#154156)
  improve: speed up streaming text with inline brackets (openclaw#154398)
  test: isolate historical Node runner policy from CI
  fix: refresh stale Gateway shutdown budgets during updates and Doctor (openclaw#153636)
  ci: use four Windows workers on the 16 class (openclaw#154261)
  feat: verify GitHub credit from trusted OIDC claims (openclaw#153940)
  feat(sessions): support explicit local placement for child sessions (openclaw#153912)
  fix(ui): prevent stale copies after text changes (openclaw#154259)
  perf(gateway): reuse session list candidates across viewers (openclaw#154003)
  perf(codex): bound progressive local catalog waits (openclaw#154362)
  docs: keep update requests owned through acceptance (openclaw#154111)
  perf(state): reduce main-thread coordinator waits (openclaw#154244)
  ...
vincentkoc added a commit that referenced this pull request Sep 21, 2026
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (58 commits)
  fix(ci): remove duplicate database worker test entry
  fix(voice): keep audio flowing while the Gateway is busy (#154119)
  docs: reserve Team live updates for Night Watch (#154425)
  test(meeting-bot): control browser retry fixture clocks (#149174)
  fix(ui): use remote defaults for manual worktree creation (#154364)
  fix(proxy): keep WebChat and Codex loopback calls direct (#154013)
  fix(pr): revalidate head reads and reuse repository locators (#154212)
  fix(browser): start control when the Gateway has activated the plugin (#154255)
  improve: publish CI dependencies promptly and warm hosted JavaScript caches (#154156)
  improve: speed up streaming text with inline brackets (#154398)
  test: isolate historical Node runner policy from CI
  fix: refresh stale Gateway shutdown budgets during updates and Doctor (#153636)
  ci: use four Windows workers on the 16 class (#154261)
  feat: verify GitHub credit from trusted OIDC claims (#153940)
  feat(sessions): support explicit local placement for child sessions (#153912)
  fix(ui): prevent stale copies after text changes (#154259)
  perf(gateway): reuse session list candidates across viewers (#154003)
  perf(codex): bound progressive local catalog waits (#154362)
  docs: keep update requests owned through acceptance (#154111)
  perf(state): reduce main-thread coordinator waits (#154244)
  ...
vincentkoc added a commit that referenced this pull request Sep 21, 2026
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (58 commits)
  fix(ci): remove duplicate database worker test entry
  fix(voice): keep audio flowing while the Gateway is busy (#154119)
  docs: reserve Team live updates for Night Watch (#154425)
  test(meeting-bot): control browser retry fixture clocks (#149174)
  fix(ui): use remote defaults for manual worktree creation (#154364)
  fix(proxy): keep WebChat and Codex loopback calls direct (#154013)
  fix(pr): revalidate head reads and reuse repository locators (#154212)
  fix(browser): start control when the Gateway has activated the plugin (#154255)
  improve: publish CI dependencies promptly and warm hosted JavaScript caches (#154156)
  improve: speed up streaming text with inline brackets (#154398)
  test: isolate historical Node runner policy from CI
  fix: refresh stale Gateway shutdown budgets during updates and Doctor (#153636)
  ci: use four Windows workers on the 16 class (#154261)
  feat: verify GitHub credit from trusted OIDC claims (#153940)
  feat(sessions): support explicit local placement for child sessions (#153912)
  fix(ui): prevent stale copies after text changes (#154259)
  perf(gateway): reuse session list candidates across viewers (#154003)
  perf(codex): bound progressive local catalog waits (#154362)
  docs: keep update requests owned through acceptance (#154111)
  perf(state): reduce main-thread coordinator waits (#154244)
  ...
vincentkoc added a commit to vyctorbrzezowski/openclaw that referenced this pull request Sep 21, 2026
* commit 'f76d38a4ac5e5f4e6c5a5320436db169e33d5c8a': (44 commits)
  fix(ci): remove duplicate database worker test entry
  fix(voice): keep audio flowing while the Gateway is busy (openclaw#154119)
  docs: reserve Team live updates for Night Watch (openclaw#154425)
  test(meeting-bot): control browser retry fixture clocks (openclaw#149174)
  fix(ui): use remote defaults for manual worktree creation (openclaw#154364)
  fix(proxy): keep WebChat and Codex loopback calls direct (openclaw#154013)
  fix(pr): revalidate head reads and reuse repository locators (openclaw#154212)
  fix(browser): start control when the Gateway has activated the plugin (openclaw#154255)
  improve: publish CI dependencies promptly and warm hosted JavaScript caches (openclaw#154156)
  improve: speed up streaming text with inline brackets (openclaw#154398)
  test: isolate historical Node runner policy from CI
  fix: refresh stale Gateway shutdown budgets during updates and Doctor (openclaw#153636)
  ci: use four Windows workers on the 16 class (openclaw#154261)
  feat: verify GitHub credit from trusted OIDC claims (openclaw#153940)
  feat(sessions): support explicit local placement for child sessions (openclaw#153912)
  fix(ui): prevent stale copies after text changes (openclaw#154259)
  perf(gateway): reuse session list candidates across viewers (openclaw#154003)
  perf(codex): bound progressive local catalog waits (openclaw#154362)
  docs: keep update requests owned through acceptance (openclaw#154111)
  perf(state): reduce main-thread coordinator waits (openclaw#154244)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 22, 2026
…4013)

* fix(proxy): keep native runtime loopback requests direct

In 9.4, d6bd911 added the native Codex loopback inference relay
while managed proxy routing still cleared NO_PROXY.

Use Proxyline's shared bypass policy and supply loopback exclusions to
native children. Explicit proxy/block modes remain unchanged. Doctor
reports failed loopback probes with recovery commands.

Fixes openclaw#153930. Reported by @eefreenyc.

* fix(proxy): align loopback diagnostics and client regression coverage

Keep default loopback routing direct after canary readiness and assert
that external requests still reach the proxy. Attribute readiness failures
to the proxy only in explicit proxy mode.

Keep the TUI client and proxy lifecycle in one module generation after
mock resets, assert the full block-mode recovery message exactly once,
and verify the inherited policy at Gateway WebSocket construction.

Include the existing test-only outbound custody repair from f5b7014
(openclaw#154123), preserving nested maintenance, physical exclusion, native
writability, failure causes, and migration receipts without longer budgets.

Related: openclaw#153930

* test(proxy): remove userinfo from Doctor fixture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 9.4/9.5 upgrade: proxy.enabled=true breaks WebChat/Codex loopback; use HTTP_PROXY with NO_PROXY

1 participant