refactor: align cd and worker defaults

This commit is contained in:
banteg
2025-12-29 03:35:10 +04:00
parent e807428cfd
commit eb97756132
2 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ chat_id = 123456789
Optional keys: Optional keys:
- exec/resume: `codex_workspace`, `codex_exec_args`, `max_workers` - exec/resume: `cd`, `codex_exec_args`
## Option 1: exec/resume ## Option 1: exec/resume
@@ -39,7 +39,7 @@ Optional flags:
- `--progress-silent/--no-progress-silent` (default silent) - `--progress-silent/--no-progress-silent` (default silent)
- `--final-notify/--no-final-notify` (default notify via new message) - `--final-notify/--no-final-notify` (default notify via new message)
- `--ignore-backlog/--process-backlog` (default ignore pending updates) - `--ignore-backlog/--process-backlog` (default ignore pending updates)
- `--workdir PATH` (override `codex_workspace`) - `--cd PATH` (pass through to `codex --cd`)
- `--model NAME` (pass through to `codex exec`) - `--model NAME` (pass through to `codex exec`)
To resume an existing thread without a database, reply with (or include) the session id shown at the end of the bot response: To resume an existing thread without a database, reply with (or include) the session id shown at the end of the bot response:
@@ -350,10 +350,10 @@ def run(
"--log-file", "--log-file",
help="Write detailed debug logs to this file (set to empty to disable).", help="Write detailed debug logs to this file (set to empty to disable).",
), ),
workdir: str | None = typer.Option( cd: str | None = typer.Option(
None, None,
"--workdir", "--cd",
help="Override codex workspace (--cd) for this exec-bridge run.", help="Pass through to `codex --cd` (defaults to `cd` in ~/.codex/telegram.toml).",
), ),
model: str | None = typer.Option( model: str | None = typer.Option(
None, None,
@@ -372,7 +372,7 @@ def run(
codex_cmd = shutil.which("codex") codex_cmd = shutil.which("codex")
if not codex_cmd: if not codex_cmd:
raise RuntimeError("codex not found on PATH") raise RuntimeError("codex not found on PATH")
workspace = workdir if workdir is not None else config.get("codex_workspace") workspace = cd if cd is not None else config.get("cd")
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):
extra_args = [str(v) for v in raw_exec_args] extra_args = [str(v) for v in raw_exec_args]
@@ -405,8 +405,7 @@ def run(
codex_cmd=codex_cmd, workspace=workspace, extra_args=extra_args codex_cmd=codex_cmd, workspace=workspace, extra_args=extra_args
) )
max_workers = config.get("max_workers") pool = ThreadPoolExecutor(max_workers=16)
pool = ThreadPoolExecutor(max_workers=max_workers or 4)
offset: int | None = None offset: int | None = None
ignore_backlog = bool(ignore_backlog) ignore_backlog = bool(ignore_backlog)