Fix infer CLI reliability gaps#63263
Conversation
Greptile SummaryThis PR fixes three Confidence Score: 5/5Safe to merge — all remaining findings are P2 style suggestions. The three bug fixes are logically correct and fully tested. The only finding is a duplicate import statement from the same module in runtime.ts, which is a pure style issue with no behavioral impact. No files require special attention.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9fdef1f0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| allowFallback && | ||
| executed && | ||
| typeof executed === "object" && | ||
| "error" in executed && | ||
| typeof executed.error === "string" |
There was a problem hiding this comment.
Limit structured-error fallback to availability/auth failures
In runWebSearch, any auto-selected provider response with a top-level string error now triggers fallback, but several providers use this same shape for user-input validation errors (for example invalid freshness/date combinations) rather than provider unavailability. In auto mode this can silently switch to a different provider and return results that ignore the original constraints, instead of surfacing an actionable validation error from the selected provider.
Useful? React with 👍 / 👎.
| _requestPromptOverride: params.prompt.trim(), | ||
| prompt: params.prompt.trim(), |
There was a problem hiding this comment.
Ensure image --prompt overrides per-model prompts
The CLI --prompt wiring only injects tools.media.image.prompt, but image execution resolves prompt precedence as entry.prompt ?? config.prompt in the media runner. That means if a configured image model entry already has prompt, the new --prompt option is ignored, so users cannot reliably override prompts per request despite the command flag implying that behavior.
Useful? React with 👍 / 👎.
|
Codex automated review: keeping this open. Keep this PR open. Current main has superseded the local infer model-run session collision part by using the lean local completion path and already passes agentDir for image description, but main still does not implement the remaining user-visible fixes: image describe metadata advertises --prompt while the command/runtime do not accept or thread it, web_search still returns structured provider error payloads as successful results, and openai-codex still lacks image media-understanding autoPriority in current manifest/runtime metadata. Best possible solution: Keep this PR open as an implementation candidate. Rebase it onto current main, drop or adapt the obsolete local session-key change, register and thread What I checked:
Remaining risk / open question:
Codex Review notes: model gpt-5.5, reasoning high; reviewed against 5828dcdb05aa. |
2445ca2 to
f93debc
Compare
|
Merged in 12aaef9 after representative verification with |
Summary
Fix three
openclaw inferreliability gaps that showed up in real use:infer model runcalls onto their own infer session key instead of the shared main-session laneweb searchfall through when an auto-selected provider returns a structured error payload likemissing_brave_api_keyimage describeparser/runtime behavior by registering--prompt, threading prompt overrides into media config, and passingagentDirautoPriorityforopenai-codexWhat changed
src/cli/capability-cli.tsrunModelRun(...)now setssessionKey: agent:${agentId}:infer:model-run:${randomIdempotencyKey()}image describeandimage describe-manynow accept--prompt <text>tools.media.image.promptand_requestPromptOverrideagentDirsrc/web-search/runtime.tserror, treat it as a failed attempt and continue fallbackextensions/openai/media-understanding-provider.tssrc/media-understanding/bundled-defaults.tsautoPriorityforopenai-codexsrc/config/types.tools.tssrc/cli/capability-cli.test.tssrc/web-search/runtime.test.tssrc/media-understanding/defaults.test.tsVerification
Targeted source tests passed on this branch:
Observed:
Real-world verification
I also rebuilt and exercised the same logic on a live OpenClaw install while debugging
inferon a host that had all three failures:openclaw infer model run --prompt "Reply with exactly: infer-ok" --local --jsonopenclaw infer model run --prompt "Reply with exactly: infer-ok" --gateway --jsonopenclaw infer web search --query "OpenClaw infer CLI" --limit 3 --jsonopenclaw infer web search --provider duckduckgo --query "OpenClaw infer CLI" --limit 3 --jsonopenclaw infer image describe --file ... --jsonopenclaw infer image describe --file ... --prompt "Describe this image in one sentence." --jsonObserved:
infer-okduckduckgoinstead of dying on Brave missing-key--prompt