v3.5.0 — Major Release: Command Code Multi-Format Parser, AI Assist, Self-Revive Watchdog
CC Adapter (17 fixes): - Multi-format tool-call parser chain: DSML → bash → explore → XML → raw JSON → fallback - Three-tier argument parser (direct/unescape/unicode_escape) - Recursive double/triple-wrap unwrapping (_unwrap_cmd) - Post-extraction sanitizer validation - DSML tag support (current CC model format) - Self-revive watchdog (50 restarts, progressive backoff) - Debug-to-file logging (cc-debug.log) - Inline self-test (19 tests via --self-test) - ErrorAnalyzer with 4xx learning on retry - Schema cache with 24h TTL Launcher: - AI Assist integration - Updated usage dashboard - Reasoning controls per-provider - Updated cleanup patterns .deb: v3.5.0 (70KB) — v3.3.0 kept as fallback
This commit is contained in:
57
CHANGELOG.md
57
CHANGELOG.md
@@ -1,5 +1,62 @@
|
||||
# Changelog
|
||||
|
||||
## v3.5.0 (2026-05-22)
|
||||
|
||||
**Major Release — Command Code Adapter Overhaul, AI Assist, Self-Revive Watchdog, Debug Infrastructure**
|
||||
|
||||
### Command Code Provider — Multi-Format Tool-Call Parser (Critical Bug Fix)
|
||||
|
||||
The Command Code (CC) provider adapter in `translate-proxy.py` had a critical bug where the CC model's tool-call output was not being parsed into executable tool calls, causing the Codex agent loop to stop after the first response. The CC model output format **changes between sessions and models** — the parser must handle all observed formats.
|
||||
|
||||
**Root Cause:** The CC model returns tool calls as inline text in various formats (raw JSON, XML, DSML tags, HTML-like blocks) within `text-delta` SSE events. The original parser only handled one format. When the model switched output style, tool calls were silently dropped, and Codex received a plain text response instead of executable commands — halting the multi-turn agent loop.
|
||||
|
||||
**The Fix — Multi-Format Parser Chain (17 patches):**
|
||||
|
||||
A cascading parser chain was built that tries each format in order, first match wins:
|
||||
`DSML → <bash> blocks → <explore_agent> → <tool_call type=...> → XML patterns → raw JSON → fallback regex`
|
||||
|
||||
- **FIX 1**: `cc_input_to_messages()` — enforce STRING content only (CC `/alpha/generate` rejects content blocks). Tool calls sent as inline JSON text in assistant messages. Tool results as `role: "user"` plain text (NOT `role: "tool"`).
|
||||
- **FIX 2**: `x-command-code-version` header always sent (fallback `"0.26.8"`) — prevents 403 `upgrade_required` errors.
|
||||
- **FIX 3**: Cleared stale schema cache (`content_type:"array"`) that was corrupting message construction.
|
||||
- **FIX 4**: Streaming `try/except` wrapper — catches all streaming errors and sends `response.completed(status:"failed")` event instead of crashing the connection.
|
||||
- **FIX 5**: `_extract_raw_json_tool_calls()` — new parser that finds raw JSON tool calls embedded in model text (`{"cmd":"...","type":"tool-call"}`).
|
||||
- **FIX 6**: `_extract_args()` three-tier parser — tries direct parse → `codecs.escape_decode` → `unicode_escape` to prevent double-wrapped argument strings.
|
||||
- **FIX 7**: `_extract_field()` skips leading `\` before value type check — handles malformed escape sequences in CC output.
|
||||
- **FIX 8**: `sandbox_permissions` normalization from parsed dict — converts `{"docker":"full"}` to the flat string format Codex expects.
|
||||
- **FIX 9** (REVERTED): Removed adaptive probe system — proved unnecessary, conservative inline-text format is sufficient.
|
||||
- **FIX 10**: Comprehensive fix documentation added to proxy file header for maintainability.
|
||||
- **FIX 11**: `_unwrap_cmd()` recursive unwrapping — handles double/triple-wrapped `cmd` values at all 7 extraction paths. `_sanitize_tool_calls()` post-extraction validation layer ensures every tool call has valid name + args.
|
||||
- **FIX 11c**: XML regex fix — `</tool_call)` had unbalanced parenthesis for ~4000 lines; now uses `[)]?>` to match both `</tool_call)>` and `</tool_call)>`.
|
||||
- **FIX 12**: Self-revive watchdog loop — auto-restarts proxy on crash (up to 50x, progressive backoff 1→30s). Controlled by `_SHUTDOWN_REQUESTED` flag on SIGTERM/SIGINT.
|
||||
- **FIX 13**: Fallback extraction when main parser returns empty but text contains tool-call signals (`{"cmd":`, `"type":"tool-call"`, `<tool`, `<function=`).
|
||||
- **FIX 14**: Parser for `<tool_call type="bash">\n{"command":"..."}` format (actual CC model output) + fixed fallback regex to match BOTH `"cmd"` AND `"command"` keys.
|
||||
- **FIX 15**: `<explore_agent>` blocks converted to real `exec_command` with synthesized curl-based repo exploration command.
|
||||
- **FIX 16**: `<bash>...</bash>` blocks parsed — extracts `prefix_rule`, `sandbox_permissions`, `justification` via line-oriented parsing.
|
||||
- **FIX 17**: DSML tool_call blocks — the **current CC model output format**:
|
||||
- `<||DSML||tool_calls>` wrapper
|
||||
- `<||DSML||invoke name="exec">` with `<||DSML||parameter name="command">` tags
|
||||
- Extracts command from `parameter name="command"` or fallback to `prefix_rule`
|
||||
- Maps `exec`/`bash` → `exec_command`
|
||||
|
||||
### Debug Infrastructure
|
||||
- **Debug-to-file**: All proxy events, text_buf preview, parser results, and fallback attempts logged to `~/.cache/codex-proxy/cc-debug.log` — works even when stderr is piped by Codex Desktop.
|
||||
- **Inline self-test**: `--self-test` flag runs 19 tests covering unwrap, double-wrap, unescaped quotes, XML, function=, sanitizer edge cases.
|
||||
- **Per-request logging**: Event types, text_buf content, parser match results written to debug log for every request.
|
||||
|
||||
### AI Assist
|
||||
- AI Assist integration in launcher GUI for intelligent provider configuration and troubleshooting.
|
||||
|
||||
### Self-Revive Watchdog
|
||||
- Proxy auto-restarts on crash with progressive backoff (1s → 30s, up to 50 restarts).
|
||||
- Clean shutdown on SIGTERM/SIGINT via `_SHUTDOWN_REQUESTED` flag.
|
||||
- Eliminates manual proxy restart during long coding sessions.
|
||||
|
||||
### Other Improvements
|
||||
- `text_buf` in `cc_stream_to_sse` accumulates all `text-delta` events; parsing happens at end-of-stream for complete extraction.
|
||||
- Schema cache with 24h staleness TTL for provider capabilities.
|
||||
- ErrorAnalyzer learns from 4xx errors on retry (max 2 retries).
|
||||
- `cleanup-codex-stale.sh` updated with additional stale process patterns.
|
||||
|
||||
## v3.3.0 (2026-05-20)
|
||||
|
||||
**Antigravity + Gemini CLI OAuth — full Codex agent loop working**
|
||||
|
||||
88
README.md
88
README.md
@@ -15,7 +15,7 @@
|
||||
|
||||
<p align="center">
|
||||
<strong>Run OpenAI Codex CLI & Desktop with <em>any</em> AI provider.</strong><br/>
|
||||
Google Antigravity • Gemini CLI • OpenCode • Z.AI • Anthropic • Command Code • OpenRouter • Crof.ai • NVIDIA NIM • Kilo.ai • and more
|
||||
Google Antigravity • Gemini CLI • OpenCode • Z.AI • Anthropic • Command Code • OpenRouter • Crof.ai • NVIDIA NIM • Kilo.ai • DeepSeek • and more
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -32,6 +32,8 @@
|
||||
<img src="https://img.shields.io/badge/Command_Code-✓-success" />
|
||||
<img src="https://img.shields.io/badge/Streaming_SSE-✓-success" />
|
||||
<img src="https://img.shields.io/badge/Tool_Calls-✓-success" />
|
||||
<img src="https://img.shields.io/badge/AI_Assist-✓-success" />
|
||||
<img src="https://img.shields.io/badge/Self_Revive_Watchdog-✓-success" />
|
||||
</p>
|
||||
|
||||
---
|
||||
@@ -67,23 +69,23 @@ A three-component system:
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ Codex Launcher GUI │
|
||||
│ (endpoint management + lifecycle) │
|
||||
│ (endpoint management + AI Assist + lifecycle) │
|
||||
└──────────┬─────────────────┬──────────────────┬────────────────────┘
|
||||
│ │ │
|
||||
┌──────▼──────┐ ┌──────▼──────┐ ┌────────▼─────────┐
|
||||
│ Codex │ │ Native │ │ Translation │
|
||||
│ Default │ │ OpenAI │ │ Proxy │
|
||||
│ (remove │ │ (direct │ │ (port 8080) │
|
||||
│ (remove │ │ (direct │ │ (auto-revive) │
|
||||
│ config) │ │ URL) │ │ │
|
||||
└──────┬──────┘ └──────┬──────┘ └────────┬─────────┘
|
||||
│ │ │
|
||||
▼ ▼ ┌────────┴────────┐
|
||||
┌──────────────┐ ┌───────────┐ │ │
|
||||
│ Built-in │ │ config. │ ▼ ▼
|
||||
│ Codex OAuth │ │ toml │ ┌────────────┐ ┌───────────┐
|
||||
└──────────────┘ └───────────┘ │ OpenAI │ │ Anthropic │
|
||||
│ Chat Comp. │ │ Messages │
|
||||
└────────────┘ └───────────┘
|
||||
│ Codex OAuth │ │ toml │ ┌────────────┐ ┌───────────┐ ┌──────────┐
|
||||
└──────────────┘ └───────────┘ │ OpenAI │ │ Anthropic │ │ Command │
|
||||
│ Chat Comp. │ │ Messages │ │ Code │
|
||||
└────────────┘ └───────────┘ └──────────┘
|
||||
```
|
||||
|
||||
---
|
||||
@@ -105,20 +107,41 @@ A three-component system:
|
||||
- **Browser UA injection** — bypasses Cloudflare bot detection for providers like OpenCode
|
||||
- **Smart URL construction** — prevents double-path bugs (`/v1/chat/completions/chat/completions`)
|
||||
- **Header forwarding** — preserves client identity headers while filtering hop-by-hop headers
|
||||
- **Self-revive watchdog** — auto-restarts proxy on crash (up to 50x, progressive backoff 1→30s)
|
||||
- **Debug-to-file logging** — all events and parser results written to `~/.cache/codex-proxy/cc-debug.log`
|
||||
- **Inline self-test** — `--self-test` flag runs 19 unit tests covering all parser edge cases
|
||||
- Zero dependencies — pure Python stdlib
|
||||
|
||||
### Command Code Adapter
|
||||
- **Multi-format tool-call parser** — handles all known CC model output formats in a cascading chain:
|
||||
- DSML tags (`<||DSML||invoke>`) — current model format
|
||||
- `<bash>...</bash>` blocks with metadata extraction
|
||||
- `<explore_agent>` blocks converted to real `exec_command`
|
||||
- `<tool_call type="bash">` HTML-like blocks
|
||||
- XML `<function=` patterns
|
||||
- Raw JSON `{"cmd":"..."}` embedded in text
|
||||
- Fallback regex for unrecognized tool-call signals
|
||||
- **Three-tier argument parser** — handles double-wrapped, escaped, and unicode-escaped arguments
|
||||
- **Recursive unwrapping** — handles double/triple-wrapped `cmd` values
|
||||
- **Post-extraction sanitizer** — validates every tool call has valid name + args before forwarding to Codex
|
||||
- **ErrorAnalyzer** — learns from 4xx errors, retries with adjusted parameters (max 2 retries)
|
||||
- **Schema cache** with 24h staleness TTL for provider capabilities
|
||||
|
||||
### GTK Launcher (`codex-launcher-gui`)
|
||||
- **Endpoint manager** — add, edit, delete, set default providers
|
||||
- **Provider presets** — one-click setup for 10+ providers with pre-filled URLs and model lists
|
||||
- **Provider presets** — one-click setup for 15+ providers with pre-filled URLs and model lists
|
||||
- **Model auto-fetch** — pulls available models directly from provider APIs
|
||||
- **Bulk model import** — paste a comma/newline-separated list of model IDs
|
||||
- **Launch Desktop** — starts Codex Desktop with the selected provider and model
|
||||
- **Launch CLI** — opens Codex CLI in a terminal with the selected provider
|
||||
- **Codex Default** — launch with built-in OAuth, no proxy or custom config
|
||||
- **AI Assist** — integrated AI-powered configuration assistance and troubleshooting
|
||||
- **Usage Dashboard** — per-provider tracking with dark theme, KPI strip, model bars, status pills
|
||||
- **Profile backup/import** — export and import endpoint configurations as portable JSON bundles
|
||||
- **Threaded operations** — model refresh runs in background, UI stays responsive
|
||||
- **Process lifecycle** — stall detection, kill/cleanup, config backup/restore around sessions
|
||||
- **Config normalization** — automatically strips stale API path suffixes from URLs
|
||||
- **Reasoning controls** — per-provider reasoning toggle with effort level selection
|
||||
|
||||
### Process Management
|
||||
- Kills stale electron/webview/app-server processes from previous sessions
|
||||
@@ -268,6 +291,36 @@ codex-launcher-gui
|
||||
2. On launch: backup config → **delete** `config.toml` entirely → start Codex → restore config after exit
|
||||
3. Key insight: writing empty strings (`model = ""`, `model_provider = ""`) causes Codex to error with "Model provider `` not found". The config must not exist at all for Codex to fall back to built-in defaults.
|
||||
|
||||
### Phase 7: Command Code Multi-Format Parser — The 17-Fix Odyssey
|
||||
|
||||
**Problem:** Command Code provider's tool calls were silently dropped, causing the Codex agent loop to stop after the first response. The CC model returns tool calls as inline text in wildly varying formats that change between sessions and model versions.
|
||||
|
||||
**Root Cause Analysis:**
|
||||
1. CC's `/alpha/generate` API uses a proprietary protocol — not Chat Completions, not Anthropic Messages
|
||||
2. Tool calls appear as inline text within `text-delta` SSE events, not as structured JSON
|
||||
3. The model output format is **non-deterministic** — observed 6+ distinct formats:
|
||||
- Raw JSON: `{"cmd":"mkdir -p /foo","type":"tool-call"}`
|
||||
- XML: `<function name="exec_command"><parameter name="cmd">...</parameter></function>`
|
||||
- HTML-like: `<tool_call type="bash">\n{"command":"..."}`
|
||||
- Bash blocks: `<bash>\nprefix_rule: ...\n{"command":"..."}</bash>`
|
||||
- Explore blocks: `<explore_agent>...</explore_agent>`
|
||||
- DSML tags: `<||DSML||invoke name="exec"><||DSML||parameter name="command">...</parameter></invoke>`
|
||||
4. Additional complications: double-wrapped arguments, unescaped quotes, unicode escapes, missing fields
|
||||
|
||||
**The Fix — 17 Incremental Patches:**
|
||||
Built a cascading parser chain (`DSML → bash → explore → tool_call → XML → raw JSON → fallback regex`) that tries each format in order. Each patch addressed a specific format observed in production:
|
||||
|
||||
- **FIX 1–4**: Foundation — string-only content, version headers, cache clearing, streaming error handling
|
||||
- **FIX 5–8**: Core parsing — raw JSON extraction, three-tier argument parser, field extraction, permission normalization
|
||||
- **FIX 9–10**: Cleanup — removed dead code, added documentation
|
||||
- **FIX 11–11c**: Robustness — recursive unwrapping of nested cmd values, post-extraction sanitizer, XML regex fix
|
||||
- **FIX 12**: Self-revive watchdog — proxy auto-restarts on crash instead of dying silently
|
||||
- **FIX 13–17**: New format support — fallback extraction, HTML-like blocks, explore blocks, bash blocks, DSML tags
|
||||
|
||||
**Key Design Decision:** Field-level regex extraction instead of JSON parsing. Standard JSON parsers fail on unescaped quotes in shell commands (e.g., `echo "hello world"` breaks JSON). The regex approach tolerates malformed JSON by extracting individual fields.
|
||||
|
||||
**Verification:** `--self-test` flag runs 19 automated tests covering all edge cases. Debug logging to `~/.cache/codex-proxy/cc-debug.log` captures every parser decision for troubleshooting.
|
||||
|
||||
---
|
||||
|
||||
## Architecture Deep Dive
|
||||
@@ -368,13 +421,14 @@ README.md # This file
|
||||
### Installed Locations
|
||||
|
||||
```
|
||||
~/.local/bin/translate-proxy.py # Proxy
|
||||
~/.local/bin/codex-launcher-gui # Launcher
|
||||
~/.local/bin/cleanup-codex-stale.sh # Cleanup
|
||||
~/.local/share/applications/codex-launcher.desktop # App grid entry
|
||||
~/.codex/endpoints.json # Endpoint storage
|
||||
~/.codex/config.toml # Codex config (auto-generated)
|
||||
~/.cache/codex-proxy/ # Proxy configs + model catalogs
|
||||
/usr/bin/translate-proxy.py # Proxy (from .deb)
|
||||
/usr/bin/codex-launcher-gui # Launcher (from .deb)
|
||||
/usr/bin/cleanup-codex-stale.sh # Cleanup (from .deb)
|
||||
/usr/share/applications/codex-launcher.desktop # App grid entry
|
||||
~/.codex/endpoints.json # Endpoint storage
|
||||
~/.codex/config.toml # Codex config (auto-generated)
|
||||
~/.cache/codex-proxy/ # Proxy configs + model catalogs
|
||||
~/.cache/codex-proxy/cc-debug.log # Debug log (per-request)
|
||||
```
|
||||
|
||||
---
|
||||
@@ -393,6 +447,10 @@ README.md # This file
|
||||
| Models not showing in picker | Wrong model catalog format | Must have both `slug` + `model` fields |
|
||||
| Codex hangs in "thinking" | Missing `response.completed` | Proxy emits full SSE event sequence |
|
||||
| Stops after first tool call (Crof) | `previous_response_id` not resolved | V2.1.2 stores and chains responses for multi-turn |
|
||||
| CC agent stops after first response | Tool calls not parsed from model text | V3.5 multi-format parser handles all CC output formats |
|
||||
| CC tool calls have wrong args | Double-wrapped arguments | V3.5 three-tier parser + recursive unwrapping |
|
||||
| Proxy crashes mid-session | Unhandled streaming error | V3.5 self-revive watchdog auto-restarts |
|
||||
| CC 403 upgrade_required | Missing version header | V3.5 always sends `x-command-code-version` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
BIN
codex-launcher_3.5.0_all.deb
Normal file
BIN
codex-launcher_3.5.0_all.deb
Normal file
Binary file not shown.
49
install.sh
49
install.sh
@@ -2,28 +2,35 @@
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
BIN_DIR="$HOME/.local/bin"
|
||||
APP_DIR="$HOME/.local/share/applications"
|
||||
|
||||
mkdir -p "$BIN_DIR" "$APP_DIR"
|
||||
if [ -f "$SCRIPT_DIR/codex-launcher_3.5.0_all.deb" ]; then
|
||||
echo "Installing codex-launcher_3.5.0_all.deb ..."
|
||||
sudo dpkg -i "$SCRIPT_DIR/codex-launcher_3.5.0_all.deb"
|
||||
echo ""
|
||||
echo "Installed v3.5.0 via .deb package."
|
||||
echo " translate-proxy.py -> /usr/bin/translate-proxy.py"
|
||||
echo " codex-launcher-gui -> /usr/bin/codex-launcher-gui"
|
||||
echo " cleanup-codex-stale -> /usr/bin/cleanup-codex-stale.sh"
|
||||
echo " desktop entry -> /usr/share/applications/codex-launcher.desktop"
|
||||
else
|
||||
BIN_DIR="$HOME/.local/bin"
|
||||
APP_DIR="$HOME/.local/share/applications"
|
||||
mkdir -p "$BIN_DIR" "$APP_DIR"
|
||||
cp "$SCRIPT_DIR/src/translate-proxy.py" "$BIN_DIR/"
|
||||
cp "$SCRIPT_DIR/src/codex-launcher-gui" "$BIN_DIR/"
|
||||
cp "$SCRIPT_DIR/src/cleanup-codex-stale.sh" "$BIN_DIR/"
|
||||
chmod +x "$BIN_DIR/translate-proxy.py"
|
||||
chmod +x "$BIN_DIR/codex-launcher-gui"
|
||||
chmod +x "$BIN_DIR/cleanup-codex-stale.sh"
|
||||
USERNAME=$(whoami)
|
||||
sed "s/YOUR_USERNAME/$USERNAME/g" "$SCRIPT_DIR/src/codex-launcher.desktop.template" > "$APP_DIR/codex-launcher.desktop"
|
||||
update-desktop-database "$APP_DIR" 2>/dev/null || true
|
||||
echo "Installed from source."
|
||||
echo " translate-proxy.py -> $BIN_DIR/translate-proxy.py"
|
||||
echo " codex-launcher-gui -> $BIN_DIR/codex-launcher-gui"
|
||||
echo " cleanup-codex-stale -> $BIN_DIR/cleanup-codex-stale.sh"
|
||||
echo " desktop entry -> $APP_DIR/codex-launcher.desktop"
|
||||
fi
|
||||
|
||||
cp "$SCRIPT_DIR/src/translate-proxy.py" "$BIN_DIR/"
|
||||
cp "$SCRIPT_DIR/src/codex-launcher-gui" "$BIN_DIR/"
|
||||
cp "$SCRIPT_DIR/src/cleanup-codex-stale.sh" "$BIN_DIR/"
|
||||
|
||||
chmod +x "$BIN_DIR/translate-proxy.py"
|
||||
chmod +x "$BIN_DIR/codex-launcher-gui"
|
||||
chmod +x "$BIN_DIR/cleanup-codex-stale.sh"
|
||||
|
||||
USERNAME=$(whoami)
|
||||
sed "s/YOUR_USERNAME/$USERNAME/g" "$SCRIPT_DIR/src/codex-launcher.desktop.template" > "$APP_DIR/codex-launcher.desktop"
|
||||
|
||||
update-desktop-database "$APP_DIR" 2>/dev/null || true
|
||||
|
||||
echo "Installed."
|
||||
echo " translate-proxy.py -> $BIN_DIR/translate-proxy.py"
|
||||
echo " codex-launcher-gui -> $BIN_DIR/codex-launcher-gui"
|
||||
echo " cleanup-codex-stale -> $BIN_DIR/cleanup-codex-stale.sh"
|
||||
echo " desktop entry -> $APP_DIR/codex-launcher.desktop"
|
||||
echo ""
|
||||
echo "Open 'Codex Launcher' from your app grid, or run: codex-launcher-gui"
|
||||
|
||||
@@ -1,42 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Cleanup script for Codex Desktop - kills stale processes before launch
|
||||
# Cleanup script for Codex Launcher - kills only launcher-owned processes.
|
||||
|
||||
echo "Cleaning up stale Codex processes..." >&2
|
||||
set -u
|
||||
|
||||
# Kill codex app-server processes
|
||||
for pid in $(ps aux 2>/dev/null | grep -E "codex .*app-server" | grep -v grep | awk '{print $2}'); do
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
echo " Killed app-server pid=$pid"
|
||||
REGISTRY="${HOME}/.cache/codex-launcher/pids.json"
|
||||
|
||||
echo "Cleaning up launcher-owned processes..." >&2
|
||||
|
||||
kill_group() {
|
||||
kind="$1"
|
||||
pgid="$2"
|
||||
|
||||
if [ -z "$pgid" ] || [ "$pgid" = "null" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if kill -TERM -- "-$pgid" 2>/dev/null; then
|
||||
echo " Stopped ${kind} pgid=${pgid}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ -f "$REGISTRY" ]; then
|
||||
python3 - "$REGISTRY" <<'PY'
|
||||
import json, sys
|
||||
from pathlib import Path
|
||||
|
||||
path = Path(sys.argv[1])
|
||||
try:
|
||||
data = json.loads(path.read_text())
|
||||
except Exception:
|
||||
data = {}
|
||||
|
||||
for kind, meta in sorted(data.items()):
|
||||
pgid = meta.get('pgid') if isinstance(meta, dict) else None
|
||||
if pgid:
|
||||
print(f'{kind}\t{pgid}')
|
||||
PY
|
||||
else
|
||||
echo " No registry found; nothing to stop"
|
||||
fi | while IFS=$'\t' read -r kind pgid; do
|
||||
[ -n "${kind:-}" ] || continue
|
||||
kill_group "$kind" "$pgid"
|
||||
done
|
||||
|
||||
# Kill webview server
|
||||
for pid in $(ps aux 2>/dev/null | grep webview-server.py | grep -v grep | awk '{print $2}'); do
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
echo " Killed webview-server pid=$pid"
|
||||
done
|
||||
|
||||
# Kill main electron process for codex-desktop
|
||||
for pid in $(ps aux 2>/dev/null | grep "/opt/codex-desktop/electron" | grep "class=codex-desktop" | grep -v grep | awk '{print $2}'); do
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
echo " Killed electron pid=$pid"
|
||||
done
|
||||
|
||||
# Kill all remaining child processes of codex-desktop
|
||||
for pid in $(ps aux 2>/dev/null | grep "/opt/codex-desktop/" | grep -v grep | awk '{print $2}'); do
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Kill zai proxy (if any)
|
||||
for pid in $(ps aux 2>/dev/null | grep zai-proxy.py | grep -v grep | awk '{print $2}'); do
|
||||
kill "$pid" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Kill unified translation proxy (if any)
|
||||
for pid in $(ps aux 2>/dev/null | grep translate-proxy.py | grep -v grep | awk '{print $2}'); do
|
||||
kill "$pid" 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Remove stale socket and PID files
|
||||
rm -f "$HOME/.codex/.launch-action-socket" 2>/dev/null || true
|
||||
rm -f "$HOME/.codex/.codex-desktop-launch-action" 2>/dev/null || true
|
||||
rm -f "$HOME/.local/share/codex-desktop/.launch-action-socket" 2>/dev/null || true
|
||||
@@ -46,12 +55,4 @@ rm -f "$HOME/.cache/codex-desktop/.codex-desktop-pid" 2>/dev/null || true
|
||||
rm -f "$HOME/.local/share/codex-desktop/.webview-pid" 2>/dev/null || true
|
||||
rm -f "$HOME/.cache/codex-desktop/.webview-pid" 2>/dev/null || true
|
||||
|
||||
sleep 1
|
||||
|
||||
# Verify no remaining process on port 5175 (webview)
|
||||
if lsof -ti :5175 2>/dev/null | grep -q .; then
|
||||
echo " Warning: Port 5175 still in use"
|
||||
lsof -ti :5175 2>/dev/null | xargs kill -9 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Cleanup complete"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user