Repository navigation
fix(acp): integrate #31 with robust Codex config parsing - #41
Merged
Merged
Conversation
The npm @agentclientprotocol/codex-acp adapter (v1.1.0+, verified against 1.1.2) does not parse -c overrides from argv — it reads its startup configuration from the CODEX_CONFIG env var (JSON), parsed at src/CodexAcpClient.ts and spread unchanged into codex's thread/start config. The -c flags appended by _augment_acp_command (sandbox_mode, approval_policy, model_reasoning_effort) were silently discarded — sandbox, approval policy, and reasoning effort never reached the worker (issue #27). Build CODEX_CONFIG in _acp_subprocess_env in three layers, each overriding the previous: 1. User-supplied CODEX_CONFIG (ambient env). 2. -c overrides parsed from the augmented command string, via _parse_codex_c_overrides (handles both double- and single-quoted values). 3. Zenith's three safety keys (sandbox_mode, approval_policy, model_reasoning_effort) — always win, since sandbox/approval are autonomy-safety requirements and effort is the per-role resolved value. The -c flags remain in argv for -c-honoring codex-acp builds (harmless if ignored by the npm adapter). _acp_subprocess_env now accepts reasoning_effort and acp_command; both call sites (run_node, run_terminal_review) thread role_config.worker_reasoning_effort and the augmented command through. Additionally, routing all -c overrides through CODEX_CONFIG lets a user-specified codex model reach the adapter — previously dropped for the same reason. A model supplied via ZENITH_*_ACP_COMMAND (-c model="...") or ambient CODEX_CONFIG is preserved (layers 1–2) while zenith's safety keys still override (layer 3). This model-override support was requested in the issue #27 comments; it is not part of the original issue but rides on the same mechanism. Verified end-to-end against the installed adapter: the adapter's startup log (app-server.log) shows codexConfig with model, sandbox_mode, approval_policy, and model_reasoning_effort all received. Tests: - _parse_codex_c_overrides extracts model + sandbox from double and single quoted -c flags; empty when no flags present. - CODEX_CONFIG JSON present with correct effort; defaults to xhigh. - User CODEX_CONFIG merged (preserves ambient model); command-string model wins over ambient model. - Custom model from augmented command preserved alongside zenith's safety keys. - Zenith's safety keys override user-supplied safety values; invalid user JSON replaced. Claude path has no CODEX_CONFIG. Fixes #27.
…/Intelligent-Internet/zenith into integration/codex-acp-config
DiegoMMF
added a commit
to DiegoMMF/zenith
that referenced
this pull request
Sep 6, 2026
fix(acp): integrate Intelligent-Internet#31 with robust Codex config parsing (Intelligent-Internet#41)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates #31 by @stephanbrez, preserving the contributor’s original commit and authorship.
The original change routes Codex
-coverrides throughCODEX_CONFIG, which the npm ACP adapter reads, so model and per-role reasoning settings reach workers and terminal reviewers.This PR also addresses two issues found during review:
--config, with the last assignment taking precedence.CODEX_CONFIGinstead of silently replacing it with defaults.Configuration is validated before starting MCP helpers, preventing invalid configuration from leaving helper processes running. Regression tests cover quoting, repeated overrides, invalid JSON, and validation before startup across worker, validator, and terminal-reviewer roles. The existing sandbox and approval policy remains unchanged.
Supersedes #31 for integration purposes, Fixes #27 .
Validation:
Live ACP smoke tests were skipped.