Skip to content

fix(gateway): skip eager context warmup for probe#46152

Closed
5345asda wants to merge 1 commit intoopenclaw:mainfrom
5345asda:tao/fix-gateway-probe-min
Closed

fix(gateway): skip eager context warmup for probe#46152
5345asda wants to merge 1 commit intoopenclaw:mainfrom
5345asda:tao/fix-gateway-probe-min

Conversation

@5345asda
Copy link
Copy Markdown

Summary

  • skip eager context-window warmup when running \openclaw gateway probe\
  • avoid loading config/models discovery on the probe fast path
  • keep all other CLI startup behavior unchanged

Testing

  • pnpm exec vitest run src/agents/context.lookup.test.ts
  • pnpm exec vitest run src/cli/gateway-cli.coverage.test.ts src/cli/run-main.test.ts src/cli/program/routes.test.ts src/gateway/probe.test.ts

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 14, 2026

Greptile Summary

This PR extends shouldSkipEagerContextWindowWarmup in src/agents/context.ts to also skip the eager config/model-discovery warmup when the CLI is invoked as openclaw gateway probe, matching the existing behaviour for openclaw config validate. The change keeps the probe fast-path lean by avoiding unnecessary I/O at startup.

  • src/agents/context.ts: Added a second early-return condition (primary === "gateway" && secondary === "probe") to shouldSkipEagerContextWindowWarmup. Logic is correct and consistent with the existing config validate skip.
  • src/agents/context.lookup.test.ts: Added a corresponding test that sets process.argv to a gateway probe invocation, imports the module fresh (via vi.resetModules()), and asserts loadConfig was never called. Test isolation (process.argv snapshot/restore, finally block) follows the same pattern as adjacent tests.

Confidence Score: 5/5

  • This PR is safe to merge — the change is minimal, well-isolated, and covered by a focused test.
  • The change is a single two-condition function extension with no side effects beyond skipping an optional startup optimisation. The new test follows established patterns in the file, correctly uses module-level mock isolation, and verifies both the skip behaviour and process.argv cleanup. No regressions are expected for other CLI commands since the function exclusively guards the eager warmup at module load time.
  • No files require special attention.

Last reviewed commit: baa23c2

@5345asda
Copy link
Copy Markdown
Author

CI failure appears unrelated to this PR's two-file gateway probe change.

The failing job is checks (node, extensions, pnpm test:extensions), and the failures reproduce locally when running the affected extension tests directly:

  • extensions/slack/src/monitor.tool-result.test.ts -> TypeError: App is not a constructor at extensions/slack/src/monitor/provider.ts:196
  • extensions/telegram/src/send.test.ts -> transient retry tests failing around 429 handling

Local repro command:

pnpm exec vitest run extensions/slack/src/monitor.tool-result.test.ts extensions/telegram/src/send.test.ts

The actual PR change is limited to:

  • src/agents/context.ts
  • src/agents/context.lookup.test.ts

and only skips eager context warmup for openclaw gateway probe.

@steipete
Copy link
Copy Markdown
Contributor

Closing this as implemented after Codex review.

Current main already implements the requested behavior via a broader gate: eager context warmup is skipped for all openclaw gateway ... commands, which includes gateway probe, so this PR is obsolete.

What I checked:

  • Broader skip is on main: shouldEagerWarmContextWindowCache() now skips eager warmup whenever the primary CLI command is in SKIP_EAGER_WARMUP_PRIMARY_COMMANDS, and that set includes "gateway". That covers openclaw gateway probe directly. (src/agents/context.ts:133, 564f820efa2b)
  • Gateway probe is still the relevant CLI path: The current CLI still registers gateway probe as the gateway subcommand handled by gatewayStatusCommand, so the primary-command skip applies to the exact PR target. (src/cli/gateway-cli/register.ts:605, c13836804058)
  • Current tests prove the new gate shape: The current context test suite exercises shouldEagerWarmContextWindowCache() as a primary-command gate and verifies non-startup commands do not warm eagerly. The implementation is broader than the PR's one-off gateway probe branch. (src/agents/context.lookup.test.ts:200, 564f820efa2b)
  • Fix commit is already ancestor of current main: git merge-base --is-ancestor 564f820efa2bb81ae49b8f55a93e41492ad31917 c1383680405879a3c3f43dceb20a694f54d3c13c returned success, confirming the implementation is present on current main. (564f820efa2b)

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review notes: reviewed against c13836804058; fix evidence: commit 564f820efa2b.

@steipete steipete closed this Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants