Use when the user wants to enable, disable, restore, verify, or diagnose user-level proxy environment variables for Codex or Codex App connectivity, especially HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, WebSocket reconnects, codex-auto-review timeouts, or local proxies such as Clash, Verge, Mihomo, V2Ray, or sing-box.

0 stars
0 forks
PowerShell
24 views

SKILL.md


name: codex-proxy-env description: Use when the user wants to enable, disable, restore, verify, or diagnose user-level proxy environment variables for Codex or Codex App connectivity, especially HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, WebSocket reconnects, codex-auto-review timeouts, or local proxies such as Clash, Verge, Mihomo, V2Ray, or sing-box.

Codex Proxy Env

Use this skill to manage Codex-related proxy environment variables on Windows in a repeatable way. Prefer the bundled script instead of hand-writing registry or environment commands.

Workflow

  1. Decide the action:
    • Enable proxy env vars: user asks to fix Codex reconnects, WebSocket timeout, or auto-review timeout by using a local proxy.
    • Disable proxy env vars: user asks to remove the proxy variables or test the pre-fix behavior.
    • Restore: user wants the pre-change values restored from backup.
    • Status/verify: user wants to inspect the current state or confirm WebSocket health.
  2. Use scripts/Manage-CodexProxyEnv.ps1.
  3. After enable/disable/restore, tell the user that already-running apps need to be restarted to inherit user-level environment changes.

Commands

From the skill directory:

# Inspect current user-level values.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action status

# Enable using an explicit local HTTP proxy.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action enable -Proxy http://127.0.0.1:7897

# Enable with local proxy auto-detection. If multiple ports are open, pass -Proxy explicitly.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action enable

# Delete the proxy variables this skill manages.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action disable

# Restore values captured before the first enable.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action restore

# Run codex doctor with the current user env values.
powershell.exe -NoProfile -ExecutionPolicy Bypass -File .\scripts\Manage-CodexProxyEnv.ps1 -Action verify

Safety Rules

  • Do not overwrite existing non-empty user-level HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, or NO_PROXY values unless the user has approved it or -Force is appropriate for the task.
  • The script stores the first backup at $CODEX_HOME\codex-proxy-env.backup.json, or %USERPROFILE%\.codex\codex-proxy-env.backup.json when CODEX_HOME is unset.
  • Prefer restore when the user asks to return to the exact pre-change state. Prefer disable when they explicitly want these proxy variables removed.
  • For local proxies, use an HTTP proxy URL such as http://127.0.0.1:7897. The proxy app still chooses the final node.
  • Keep NO_PROXY broad enough to avoid breaking local and private-network work. The default covers localhost, common private IPv4 ranges, and link-local IPv6.

Verification

Run codex doctor --ascii --no-color --all through the script after enabling unless the user only asked for configuration.

Successful proxy configuration usually shows:

proxy env vars present
websocket connected (HTTP 101 Switching Protocols)

After disabling, a clean no-proxy state usually shows:

no proxy env vars

If WebSocket still times out while proxy env vars are present, check that the local proxy app is running, the port matches, and the selected proxy node supports WebSocket traffic.