search-bots: fix reliability (diagnosed) - gemini 3-retry + grok xsearch auto-fallback to gemini
Mike's must-fix. Diagnosed from RAW output of failing queries (not guessed): - grok xsearch = TIMEOUT: grok-4.20-multi-agent web_search runs past budget on multi-part queries (286s/280s, rc=124, still searching - 183 thoughts, only progress-noise text); buffered json => total loss. - gemini search = INTERMITTENT empty turn (a clean re-run gave a real 2.6KB answer in 122s); the wrapper retried only once, so two empties in a row failed spuriously. Fixes: - ask-gemini.sh emit_or_fail: retry up to 3x with 3s/6s backoff (was 1). - ask-grok.sh xsearch: --output-format streaming-json (salvage partials) + AUTO-FALLBACK to ask-gemini.sh search when grok doesn't finish (rc!=0 or empty). Validated e2e: grok timed out (rc=124) -> fell back -> gemini returned a real sourced answer (UniFi Teleport invite-link API). grok's own multi-agent timeout is an xAI-side limitation; the fallback makes xsearch reliable regardless. Docs: grok SKILL.md xsearch row + CT_THOUGHTS Thought 2 Resolution. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,7 @@ bash "$CLAUDETOOLS_ROOT/.claude/skills/grok/scripts/ask-grok.sh" <mode> ...
|
||||
| `review-diff` | `ask-grok.sh review-diff [-C <repo-dir>] [-i "<instr>"] <gitref> [-- <pathspec>]` | Review a **git diff** (`git diff <gitref>` from `<repo-dir>`; default repo root, use `-C` for a submodule e.g. `-C projects/msp-tools/guru-rmm`). The diff goes via the prompt file (not a shell arg); grok can `read_file` changed files for full context (cwd = repo dir). |
|
||||
| `image` | `ask-grok.sh image "<prompt>" [out.png]` | `image_gen` (Imagine) → copies the artifact to `out` (default `grok-image.png`). |
|
||||
| `video` | `ask-grok.sh video "<motion prompt>" <input-image> [out.mp4]` | `image_to_video` on an input image → copies to `out`. ~60-90s. |
|
||||
| `xsearch` | `ask-grok.sh xsearch "<query>"` | Live `web_search` + X/Twitter tools; returns text with citations. |
|
||||
| `xsearch` | `ask-grok.sh xsearch "<query>"` | Live web search, returns text with citations. **Grok's multi-agent `web_search` frequently TIMES OUT on multi-part queries**, so xsearch uses `streaming-json` and **auto-falls-back to `gemini search`** when grok doesn't finish (you'll see `[grok xsearch timed out -> answered via gemini search]`). Net: reliable answers; gemini is the workhorse engine. |
|
||||
| `raw` | `ask-grok.sh raw <grok args...>` | Escape hatch — passes args straight to `grok`. |
|
||||
|
||||
The script captures JSON (`--output-format json`), parses the result, and for
|
||||
|
||||
Reference in New Issue
Block a user