refactor: resolve codex via PATH

This commit is contained in:
banteg
2025-12-29 03:33:35 +04:00
parent daccc6e0b2
commit e807428cfd
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ chat_id = 123456789
Optional keys: Optional keys:
- exec/resume: `codex_cmd`, `codex_workspace`, `codex_exec_args`, `max_workers` - exec/resume: `codex_workspace`, `codex_exec_args`, `max_workers`
## Option 1: exec/resume ## Option 1: exec/resume
@@ -4,6 +4,7 @@ import json
import os import os
import re import re
import shlex import shlex
import shutil
import subprocess import subprocess
import threading import threading
import time import time
@@ -368,7 +369,9 @@ def run(
startup_pwd = os.getcwd() startup_pwd = os.getcwd()
startup_msg = f"codex exec bridge has started\npwd: {startup_pwd}" startup_msg = f"codex exec bridge has started\npwd: {startup_pwd}"
codex_cmd = config.get("codex_cmd", "codex") codex_cmd = shutil.which("codex")
if not codex_cmd:
raise RuntimeError("codex not found on PATH")
workspace = workdir if workdir is not None else config.get("codex_workspace") workspace = workdir if workdir is not None else config.get("codex_workspace")
raw_exec_args = config.get("codex_exec_args", "") raw_exec_args = config.get("codex_exec_args", "")
if isinstance(raw_exec_args, list): if isinstance(raw_exec_args, list):