Repository navigation
fix(cli): local terminal chat sends model requests without the configured proxy - #173530
Conversation
|
🦞👀 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: needs maintainer review before merge. What this changesStarts the existing managed proxy for local terminal chat and bare-command local onboarding or chat. Example: Run
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR repairs a verified proxy-startup omission still present on current main, with relevant CLI request traces and no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCLI startup selects local execution or a Gateway connection; local execution installs process-wide proxy routing before launching the embedded agent or onboarding, then releases it through existing cleanup. flowchart TD
A[CLI invocation] --> B[Startup policy]
B --> C[Local runtime]
B --> D[Gateway client]
C --> E[Managed proxy]
E --> F[Model endpoint]
D --> G[Gateway]
Technical reviewBest possible solution: Land the focused startup repair using the existing managed proxy owner and cleanup lifecycle. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the startup omission, and the supplied CLI traces show its effect; this read-only review executed no target code. Is this the best way to solve the issue? The patch fixes the owning startup policy for all reported local entry points without adding provider-specific routing or another proxy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2a48809c5ce3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +30, Tests +15, Docs 0. Total +45 across 6 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 5:19 AM ET / 09:19 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* commit 'ac03ca0b6d26a7dc55d0d262e40d2549631b1ea7': (25 commits) fix: apply shared plugin model policy to decisions (#156621) perf: shortlist transcript relevance scores before metadata reads (#174058) fix: strip standalone trailing NO_REPLY from replies (#171990) fix(ci): avoid repeated discovery during changed-test planning (#174069) fix(sqlite): preserve transaction outcomes when warnings throw (#157151) fix(ai): native video handoff to chat-completions providers + preflight video cost (#170920) fix(litellm): image generation fails when the backend returns image URLs (#173508) test(memory,gateway,infra,subagents): remove low-value tests (batch d152) (#174034) perf(memory): bound derived worker snapshot and pricing retention (#174067) fix(test): reduce eager imports during test startup (#174056) refactor(codex): share lifecycle preflight fixtures (#174062) test(gateway,matrix,agents,ui): remove low-value tests (batch d150) (#174025) perf(infra): batch usage refresh maintenance (#174050) fix(gateway): revert cold session list worker regression (#174052) refactor(config): consolidate browser meeting configuration (#173947) fix(cron): keep global-session deliveries on the selected agent (#173855) test(compaction): assert structured stale-writer failure (#174064) fix(cli): local terminal chat sends model requests without the configured proxy (#173530) test(ui): restore bootstrap preference locale after each case (#174065) fix: download session files through the development proxy (#173973) ...
…ured proxy (openclaw#173530) * fix(cli): route local chat and TUI egress through the managed proxy * fix(cli): return the bare-root launch policy on every path
Closes #173529
What Problem This Solves
Fixes: with
proxy.proxyUrlconfigured,openclaw chat,openclaw terminal,openclaw tui --local, and bareopenclawwithout a reachable Gateway send their in-process model requests directly instead of through the proxy, and bareopenclawopens onboarding without the managed proxy, whileopenclaw agent --localuses it.User Impact
User impact: the local terminal chat, and onboarding opened by bare
openclaw, now route egress through the configured proxy, the same asopenclaw agent --localandopenclaw onboard. These commands now also follow the proxy's destination policy andproxy.loopbackMode, asopenclaw agent --localdoes. A Gateway-connectedopenclaw tuistill connects to its Gateway directly.Why This Change Was Made
The CLI starts the configured proxy from each command's startup policy.
chat,terminal, andtuiwere set to bypass it, althoughchatandterminalalways run the embedded agent in the CLI process andtui --localdoes too. They now follow theagentrule:chatandterminalalways route,tuiroutes only with--local.Bare
openclawhas no command, so no startup policy applies. It picks onboarding, the local TUI, or a Gateway-bound TUI only after probing for a Gateway. The proxy now starts at that point, right before onboarding or the local TUI opens, and the existing CLI cleanup stops it. Gateway-bound targets are unchanged. That launch decision moved into the existingrun-main-policy.tstogether with its TTY messages, becauserun-main.tsis over its line cap. The network proxy docs now list these commands as protected.Evidence
Tested at
71b3d0c5508(baseupstream/mainb53ba16c63a; the later upstream commits do not touch these files). The headbd6748a3825adds only the lint fix described under Checks.Both sides ran the source build through
pnpm openclawon Linux with Node 24.18.0, with a fresh isolated HOME and profile for each command. Config:proxy.proxyUrl=http://127.0.0.1:13128, a local forward proxy that logs each request, and one model athttp://172.17.0.1:18990/v1, a keyless OpenAI-compatible mock on a non-loopback address (loopback is exempt in the defaultgateway-onlymode). The Gateway port was set to an unused port, so bareopenclawdid not find a Gateway. The TUI commands ran in a pseudo-terminal; for bareopenclaw,hiwas typed into it. The last run drops the model, so bareopenclawopens onboarding.Config used on both sides (
~/.openclaw-p194/openclaw.json, synthetic values){ "proxy": { "proxyUrl": "http://127.0.0.1:13128" }, "models": { "mode": "replace", "providers": { "stub": { "baseUrl": "http://172.17.0.1:18990/v1", "apiKey": "dummy-key", "api": "openai-completions", "models": [ { "id": "m", "name": "Stub", "reasoning": false, "input": ["text"], "contextWindow": 32000, "maxTokens": 1000 } ] } } }, "agents": { "defaults": { "model": { "primary": "stub/m" } } } }The onboarding run omits
agents.Before (base
b53ba16c63a):After (this PR):
Observed result: on the base, only
agent --localreaches the model through the proxy. With this change, all four local chat entry points do (chat,terminal,tui --local, and bareopenclaw), and onboarding starts behind the proxy. In the TUI paths, the proxy line prints before the TUI draws. At this head, Ctrl+C duringchatstartup exits with 130 and sends no model request.terminal,tui --local, bareopenclaw, and onboarding, before and afterBefore (base
b53ba16c63a):After (this PR):
Checks: the touched test files (
pnpm test <file> --maxWorkers=1, wall time below),oxfmt --checkon the changed files,pnpm tsgo:core,pnpm tsgo:core:test, and the line-cap ratchet (scripts/check-line-cap-ratchet.mts); the broad suites, including lint, run in this PR's CI. The three changed tests fail on the base (expected 'bypass' to be 'default'; the bare-root tests see no proxy start before the local TUI or the onboarding wizard) and pass with the fix. The other 27 tests in the two files pass on both.--maxWorkers=1wallsrc/cli/command-path-policy.test.tssrc/cli/run-main.bare-root.test.tsThe second commit only rewrites the
switchinresolveBareRootLaunchPolicyas early returns, for oxlintconsistent-return; there is no behavior change, and both test files pass on it.Simplification pass: no further cut. No mechanism is removed. Named commands keep the command catalog as their only proxy policy. Bare
openclawgets one decision point,resolveBareRootLaunchPolicy, besideshouldStartProxyForCli; it replaces the inline nested TTY-message ternary inrun-main.tsand also decides proxy startup. Still protected: the Gateway-connectedtui, bareopenclawwith a Gateway, and remote Gateway inference setup keep their direct connection, and the TTY messages are unchanged. Delta againstb53ba16c63a: production +44/−14 (run-main.ts3 lines shorter; the 29-line policy function holds the growth), tests +16/−1, docs +1/−1.Not covered: the onboarding run shows only that the proxy starts before the wizard; no provider request was made in it. The Gateway-connected
tuikeeps its bypass. A policy expectation fortuiwithout--localand a bare-root test that asserts no proxy start for a Gateway-bound TUI cover this; nothing ran against a real Gateway. HTTPS proxy endpoints and otherproxy.loopbackModevalues were not exercised; these commands now use the same startup proxy path asagent --local. Each command ran once per side.