[autofix] gemini/deep-research: "Deep Research" tool moved behind "More tools" submenu
- Dominant language
- JavaScript
- Stars
- 29.3k
- Forks
- 2.9k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 70
Description
## Summary
OpenCLI autofix repaired this adapter locally, and the retry passed.
## Adapter
- Site: gemini
- Command: gemini/deep-research
- OpenCLI version: 1.8.3
## Original failure
- Error code: tool-not-found
- Reproduction: `opencli gemini deep-research ""`
- Output: `status: tool-not-found, url: https://gemini.google.com/app`
The adapter returns `tool-not-found` immediately after `selectGeminiTool` returns empty.
## Root cause
Gemini's Web UI has been restructured. "Deep Research" is no longer a top-level entry in the tools menu; it now lives behind a submenu:
1. Click `上传和工具` button (aria-label="上传和工具") → opens first menu containing `上传文件`, `从云端硬盘添加`, `制作图片`, `制作视频`, `Canvas`, `更多工具`.
2. Click `更多工具` button (aria-label="更多工具") → opens a submenu containing `Deep Research`, `制作音乐`, `学习辅导`, etc.
`openGeminiToolsMenu` (utils.js) only opens the first-level menu. `selectGeminiToolScript` searches already-visible `[role="menu"]` / `[role="listbox"]` roots and never expands the `更多工具` submenu, so it cannot reach "Deep Research".
Confirmed via `opencli browser` inspection of the live page.
## Local fix summary
Modified `clis/gemini/utils.js` — `selectGeminiToolScript`:
After the first scan of visible menus fails to find a matching label, look for a "More tools" / `更多工具` expander button inside any open menu, click it, wait ~600 ms for the submenu to render, then re-scan once. Tools in the first menu still match on the first pass, so other adapters (canvas, image, video) are unaffected.
Diff sketch:
```js
let match = findAndClickInVisibleMenus();
if (match) return match;
const moreToolsTokens = ['more tools', '更多工具'];
const openMenus = Array.from(document.querySelectorAll('[role="menu"], [role="listbox"], [aria-modal="true"]')).filter(isVisible);
let expanded = false;
for (const menu of openMenus) {
const expandables = Array.from(menu.querySelectorAll('button, [role="button"], [role="menuitem"]')).filter(isInteractable);
const more = expandables.find((node) => {
const text = (node.textContent || '').trim().toLowerCase();
const aria = (node.getAttribute('aria-label') || '').trim().toLowerCase();
return moreToolsTokens.some((token) => (text && text.includes(token)) || (aria && aria.includes(token)));
});
if (more instanceof HTMLElement) { more.click(); expanded = true; break; }
}
if (expanded) {
await new Promise((resolve) => setTimeout(resolve, 600));
match = findAndClickInVisibleMenus();
if (match) return match;
}
return '';
```
Note: the script changed from a sync IIFE `((targetLabels) => { ... })(labels)` to an async IIFE `(async () => { ... })()` — callers already `await page.evaluate(...)`, so this is compatible.
## Verification
```
$ opencli gemini deep-research "test" --timeout 20
status: started
url: https://gemini.google.com/app/dc7728bdd2612061
```
Status flipped from `tool-not-found` → `started`.
_Issue filed after a verified local repair._
Contributor guide
Research direction
Start in clis/gemini/utils.js at selectGeminiToolScript and review how openGeminiToolsMenu exposes visible menus. Run opencli gemini deep-research "test" --timeout 20 against the Gemini page; done means the command reports started rather than tool-not-found, without regressing other Gemini tools.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100