Skip to content

fix(cron): mirror runner env proxy in model preflight - #102116

Closed
tonibofarull wants to merge 1 commit into
openclaw:mainfrom
tonibofarull:tbc/fix-cron
Closed

tonibofarull wants to merge 1 commit into
openclaw:mainfrom
tonibofarull:tbc/fix-cron

Conversation

@tonibofarull

@tonibofarull tonibofarull commented Jul 8, 2026 •

Copy link
Copy Markdown

NVIDIA/NemoClaw#5129 worked around this by patching OpenClaw's built dist in its Dockerfile. This PR fixes it at the source in OpenClaw directly.

What Problem This Solves

Fixes an issue where cron jobs against a local model provider that is only
reachable through the configured env HTTP proxy would see every scheduled run
silently skipped
.

The cron model preflight probes the local provider endpoint before the runner
starts. It probed with strict DNS pinning, but the actual model runner
(provider-transport-fetch) reaches that same endpoint through the env HTTP
proxy. For proxy-routed local vhosts (e.g. http://inference.local/v1), strict
DNS pinning cannot resolve the hostname (it fails with EAI_AGAIN), so the
preflight reports the endpoint as unavailable and skips the run.

Why This Change Was Made

The preflight now mirrors the runner's proxy selection so it predicts the same
reachability the runner will actually get.

The SSRF guard is unchanged: the probe still uses the configured provider's
exact hostname allowlist plus allowPrivateNetwork, so the trusted-env-proxy
upgrade only changes how the hostname is resolved, not which hosts are
permitted.

User Impact

Operators with cron jobs pointed at a local model provider reachable only via an
env HTTP proxy (e.g. a proxy-routed inference.local vhost) no longer have
every scheduled run skipped by a false-negative preflight. The preflight now
reports the endpoint as reachable, so cron runs proceed to the model runner like
any other provider. Hosts that do not need the env proxy are unaffected.

Evidence

Real behavior proof through a local env HTTP proxy. A real local HTTP forward
proxy (CONNECT-tunnel, like a real corporate/sandbox proxy) routes the
non-DNS-resolvable vhost inference.local to a real local OpenAI-compatible
provider (llama.cpp at 127.0.0.1:8084). Real HTTP_PROXY env is set, and the
real preflightCronModelProvider is called with no mocks of
shouldUseEnvHttpProxyForUrl. Same setup run on both branches.

Nothing to redact: inference.local is a synthetic non-resolvable vhost,
127.0.0.1:8084 is a local llama.cpp server, and the /v1/models GET carries
no credentials (the preflight ignores auth).

Before (origin/main, 6418e19)

13:00:36 [fetch-timeout] fetch timeout after 2500ms (elapsed 2502ms) operation=fetchWithSsrFGuard url=http://inference.local/v1/models
{
  "gitHead": "6418e196b1",
  "provider": "my-provider",
  "model": "unsloth/Qwen-AgentWorld-35B-A3B-GGUF:IQ3_XXS",
  "baseUrl": "http://inference.local/v1",
  "upstream": "127.0.0.1:8084",
  "shouldUseEnvHttpProxyForUrl": true,
  "httpProxy": "http://127.0.0.1:43731",
  "elapsedMs": 5006,
  "preflightResult": {
    "status": "unavailable",
    "provider": "my-provider",
    "model": "unsloth/Qwen-AgentWorld-35B-A3B-GGUF:IQ3_XXS",
    "baseUrl": "http://inference.local/v1",
    "retryAfterMs": 300000,
    "reason": "Agent cron job uses my-provider/unsloth/Qwen-AgentWorld-35B-A3B-GGUF:IQ3_XXS but the local provider endpoint is not reachable at http://inference.local/v1. Skipping this cron run; OpenClaw will retry the provider preflight on a later scheduled run. Last error: Error: getaddrinfo ENOTFOUND inference.local"
  }
}

shouldUseEnvHttpProxyForUrl is true, but main probes with STRICT pinned DNS,
so it cannot resolve inference.local (ENOTFOUND) and returns unavailable. The
skip is cached for 5 minutes, so every scheduled run is skipped.

After (tbc/fix-cron, 76e78cd)

{
  "gitHead": "76e78cd5ae",
  "provider": "my-provider",
  "model": "unsloth/Qwen-AgentWorld-35B-A3B-GGUF:IQ3_XXS",
  "baseUrl": "http://inference.local/v1",
  "upstream": "127.0.0.1:8084",
  "shouldUseEnvHttpProxyForUrl": true,
  "httpProxy": "http://127.0.0.1:40913",
  "elapsedMs": 65,
  "preflightResult": {
    "status": "available"
  }
}

Same proxy env, but the preflight now mirrors the runner's
withTrustedEnvProxyGuardedFetchMode, so it reaches the real provider through
the proxy in 68ms and returns available. The cron run proceeds like any other
provider.

The cron model preflight used STRICT DNS pinning while the model runner
selects the env HTTP proxy for proxy-routed local vhosts (e.g.
`inference.local`). That mismatch made the preflight false-negative and
skip every run. Apply the same `shouldUseEnvHttpProxyForUrl` selection as
the runner via `withTrustedEnvProxyGuardedFetchMode`; the hostname
allowlist and allowPrivateNetwork policy still apply.

Ref: NVIDIA/NemoClaw#5129
@clawsweeper

clawsweeper Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 8:49 PM ET / July 31, 2026, 00:49 UTC.

ClawSweeper review

What this changes

This PR makes cron’s local-model endpoint preflight use the same eligible environment HTTP proxy mode as the model runner, with regression coverage for both proxy and strict-DNS paths.

Merge readiness

⚠️ Needs maintainer review before merge - 2 items remain

Keep this PR open for maintainer review. The supplied patch is a narrow parity fix with credible live proxy evidence, but its July 8 head is behind current main and this review could not complete the required current-main and dependency-contract source pass. Likely related people: steipete is the discussion-routing candidate (low confidence).

Priority: P2
Reviewed head: 76e78cd5aee064a530e80fc1dc4b283a1f8e7373

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proof is specific and directly relevant, while the branch needs a current-main refresh and guard-contract confirmation before maintainers can rely on the earlier review verdict.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides a concrete before/after run using a real local forward proxy and local OpenAI-compatible endpoint, showing the preflight changes from unavailable to available; it contains no stated private credentials.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides a concrete before/after run using a real local forward proxy and local OpenAI-compatible endpoint, showing the preflight changes from unavailable to available; it contains no stated private credentials.
Evidence reviewed 5 items Proposed runtime boundary: The supplied branch diff constructs the probe URL once, selects environment-proxy use for that URL, and applies the guarded trusted-proxy mode only on that branch; the existing local-provider SSRF policy remains an input to the guarded fetch.
Regression coverage: The supplied branch diff adds tests that assert proxy-mode selection for eligible URLs and preserves strict mode when the environment proxy is not selected.
Real behavior evidence: The PR body records a before/after run through a real local HTTP forward proxy: the non-resolvable proxy-routed host changes from an unavailable preflight result to an available result using the same setup.
Findings None None.
Security None None.

How this fits together

Cron jobs preflight a configured local model endpoint before beginning a scheduled run. The result controls whether the job proceeds to the provider transport or records an unavailable result and skips the run temporarily.

flowchart LR
  A[Cron schedule] --> B[Model provider preflight]
  B --> C[Local provider endpoint]
  C --> D{Environment proxy applies?}
  D -->|Yes| E[Guarded trusted-proxy fetch]
  D -->|No| F[Guarded strict fetch]
  E --> G[Run or recorded skip]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - This changes the preflight from strict DNS resolution to the guarded trusted environment-proxy route for eligible URLs. Before merge, maintainers should refresh the branch against current main and confirm that the current proxy guard preserves the intended hostname allowlist and private-network policy on the preflight path.
  • Complete next step (P2) - A maintainer should refresh this behind branch against current main and confirm the guarded-proxy security contract before merge; no narrow automated repair is identified.
Agent review details

Security

None.

PR surface

Source +14, Tests +73. Total +87 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 4 +14
Tests 1 75 2 +73
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 93 6 +87

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Refresh and prove the guard boundary (recommended)
    Rebase the narrow patch onto current main and show that proxy-routed local endpoints work while the current hostname allowlist and private-network restrictions remain enforced.
  2. Pause if proxy trust semantics changed
    Do not merge this branch if current-main proxy guard semantics no longer match the runner’s trust boundary; replace it with a parity fix against the current shared transport contract.

Technical review

Best possible solution:

Rebase onto current main, retain one shared proxy-selection invariant with the normal provider transport, and revalidate both proxy-routed reachability and the denied-host/private-network guard behavior on the rebased head.

Do we have a high-confidence way to reproduce the issue?

No high-confidence current-main reproduction was completed in this review. The PR supplies a concrete before/after live proxy setup and the proposed source path is clear, so the mechanism is source-reproducible with medium confidence.

Is this the best way to solve the issue?

Unclear pending the current-main contract pass. Mirroring the runner is the right owner boundary if the current guarded trusted-proxy mode retains the preflight’s hostname and private-network restrictions after rebase.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bca8dd9cc162.

Labels

Label justifications:

  • P2: A false-negative preflight can suppress scheduled local-provider runs, but the reported impact is limited to proxy-routed local-provider configurations.
  • merge-risk: 🚨 security-boundary: The patch changes how a security-guarded preflight reaches eligible provider endpoints, so the current SSRF and proxy-trust contract needs confirmation after rebase.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides a concrete before/after run using a real local forward proxy and local OpenAI-compatible endpoint, showing the preflight changes from unavailable to available; it contains no stated private credentials.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a concrete before/after run using a real local forward proxy and local OpenAI-compatible endpoint, showing the preflight changes from unavailable to available; it contains no stated private credentials.

Evidence

What I checked:

  • Proposed runtime boundary: The supplied branch diff constructs the probe URL once, selects environment-proxy use for that URL, and applies the guarded trusted-proxy mode only on that branch; the existing local-provider SSRF policy remains an input to the guarded fetch. (src/cron/isolated-agent/model-preflight.runtime.ts:165, 76e78cd5aee0)
  • Regression coverage: The supplied branch diff adds tests that assert proxy-mode selection for eligible URLs and preserves strict mode when the environment proxy is not selected. (src/cron/isolated-agent/model-preflight.runtime.test.ts:189, 76e78cd5aee0)
  • Real behavior evidence: The PR body records a before/after run through a real local HTTP forward proxy: the non-resolvable proxy-routed host changes from an unavailable preflight result to an available result using the same setup. (76e78cd5aee0)
  • Prior review continuity: The latest completed ClawSweeper review at the same head found no actionable patch findings and recorded sufficient real-behavior proof; no newer branch commit is supplied in this review context. (76e78cd5aee0)
  • Current-base refresh needed: GitHub reports the branch as cleanly mergeable but behind main; the base recorded for the branch is 4ae8d73 while the review target identifies current main as bca8dd9. (bca8dd9cc162)

Likely related people:

  • steipete: The contributor explicitly requested their review in the PR discussion; this is a discussion-routing signal rather than attribution for the underlying code. (role: likely follow-up owner; confidence: low; files: src/cron/isolated-agent/model-preflight.runtime.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and rerun the supplied proxy-routed preflight proof on the exact rebased head.
  • Add or retain focused coverage demonstrating that an ineligible URL still uses strict guarded fetching and remains denied by the current policy.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-07-08T08:41:15.528Z sha 76e78cd :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-08T08:49:51.188Z sha 76e78cd :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-08T11:08:18.769Z sha 76e78cd :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T11:15:26.728Z sha 76e78cd :: needs maintainer review before merge. :: none
  • reviewed 2026-07-08T13:25:17.429Z sha 76e78cd :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 8, 2026
@tonibofarull

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 8, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 8, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 23, 2026
@tonibofarull

Copy link
Copy Markdown
Author

Hi @steipete, can you take a look? I saw you active in the last PRs.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 24, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 31, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S stale Marked as stale due to inactivity status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant