feat: codex supports web-search natively but needs to be turned on, run-server script asks if the user would like this done
fix: improved prompt for codex to avoid calling apilookup in a loop thinking it's a web-tool
This commit is contained in:
@@ -1748,6 +1748,59 @@ check_codex_cli_integration() {
|
|||||||
print_success "Successfully configured Codex CLI"
|
print_success "Successfully configured Codex CLI"
|
||||||
echo " Config: $codex_config"
|
echo " Config: $codex_config"
|
||||||
echo " Restart Codex CLI to use Zen MCP Server"
|
echo " Restart Codex CLI to use Zen MCP Server"
|
||||||
|
|
||||||
|
if ! grep -Eq '^\s*web_search\s*=' "$codex_config" 2>/dev/null; then
|
||||||
|
echo ""
|
||||||
|
print_info "Web search lets Codex pull fresh documentation for Zen's API lookup tooling."
|
||||||
|
read -p "Enable Codex CLI web search tool? (Y/n): " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
if grep -Eq '^\s*\[tools\]' "$codex_config" 2>/dev/null; then
|
||||||
|
if ! python3 - "$codex_config" <<'PY'
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
cfg_path = Path(sys.argv[1])
|
||||||
|
content = cfg_path.read_text().splitlines()
|
||||||
|
output = []
|
||||||
|
in_tools = False
|
||||||
|
added = False
|
||||||
|
|
||||||
|
for line in content:
|
||||||
|
stripped = line.strip()
|
||||||
|
if stripped.startswith("[") and stripped.endswith("]"):
|
||||||
|
if in_tools and not added:
|
||||||
|
output.append("web_search = true")
|
||||||
|
added = True
|
||||||
|
in_tools = stripped == "[tools]"
|
||||||
|
output.append(line)
|
||||||
|
continue
|
||||||
|
if in_tools and stripped.startswith("web_search"):
|
||||||
|
added = True
|
||||||
|
output.append(line)
|
||||||
|
|
||||||
|
if in_tools and not added:
|
||||||
|
output.append("web_search = true")
|
||||||
|
|
||||||
|
cfg_path.write_text("\n".join(output) + "\n")
|
||||||
|
PY
|
||||||
|
then
|
||||||
|
print_error "Failed to enable Codex web search tool. Add 'web_search = true' under [tools] in $codex_config manually."
|
||||||
|
else
|
||||||
|
print_success "Enabled Codex web search tool"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
echo "[tools]"
|
||||||
|
echo "web_search = true"
|
||||||
|
} >> "$codex_config" && print_success "Enabled Codex web search tool" || \
|
||||||
|
print_error "Failed to enable Codex web search tool. Add 'web_search = true' under [tools] in $codex_config manually."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
print_info "Skipping Codex web search tool enablement"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
print_error "Failed to update Codex CLI config"
|
print_error "Failed to update Codex CLI config"
|
||||||
echo "Manual config location: $codex_config"
|
echo "Manual config location: $codex_config"
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ class LookupRequest(ToolRequest):
|
|||||||
LOOKUP_PROMPT = """
|
LOOKUP_PROMPT = """
|
||||||
MANDATORY: You MUST perform this research in a SEPARATE SUB-AGENT SUB-PROCESS using your web search tool.
|
MANDATORY: You MUST perform this research in a SEPARATE SUB-AGENT SUB-PROCESS using your web search tool.
|
||||||
|
|
||||||
|
CRITICAL RULES:
|
||||||
|
- NEVER call `apilookup` / `zen.apilookup` or any other zen tool again for this mission. Launch your environment's dedicated web search capability
|
||||||
|
(for example `websearch`, `web_search`, or another native web-search tool such as the one you use to perform a web search online) to gather sources.
|
||||||
|
- ALWAYS run the search from a separate sub-agent/sub-process so the research happens outside this tool invocation.
|
||||||
|
- If the environment does not expose a web search tool, immediately report that limitation instead of invoking `apilookup` again.
|
||||||
|
- Once you have current, authoritative documentation that answers the prompt, stop researching immediately and return with those sources—do not continue exploring tangential links or extra queries.
|
||||||
|
|
||||||
MISSION:
|
MISSION:
|
||||||
Research the latest, most authoritative documentation for the requested API, SDK, library, framework, programming language feature, or tool to answer the user's question accurately using a SUB-AGENT in a separate process.
|
Research the latest, most authoritative documentation for the requested API, SDK, library, framework, programming language feature, or tool to answer the user's question accurately using a SUB-AGENT in a separate process.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user