fix(agent): avoid Codex stream for compression summaries - #23617
Conversation
|
Small follow-up on the Root cause appears to be macOS Bash 3.2 + ARGS=("$@")
...
"${ARGS[@]}"With no args, Bash 3.2 reports |
|
Closing — the compression-timeout problem this addressed was fixed via PR #59807 (salvage of #54943), which floors config-derived compression timeouts at 300s instead of rerouting away from the Codex stream. That approach keeps compression on the main model per the current auxiliary main-model-first design while honoring explicit per-call timeouts. Thanks for the early work on this — it correctly identified the failure mode. |
What does this PR do?
Fixes a compression-summary failure mode for sessions whose main provider is Codex. Compression uses the text auxiliary
autoprovider path; with Codex as the main provider,autowas main-first and routed compression through the Codex Responses stream. If that stream stays alive but emits too slowly, compression can exceed its total timeout and fall back to a context marker instead of a summary.This PR keeps the existing main-model-first behavior for normal auxiliary tasks, but adds a targeted exception for
task == "compression"on Codex main sessions: try the faster auxiliary fallback chain first, then fall back to Codex if no auxiliary backend is available. It also makesautoclient caching task-aware only when a task is supplied, so compression and non-compression routes do not reuse the wrong cached client.While validating the timeout path, this also tightens Codex stream total-timeout enforcement so blocking/slow stream iteration can be interrupted by the configured total timeout and still evicts the poisoned cached client.
Related Issue
No issue filed yet.
Type of Change
Changes Made
agent/auxiliary_client.pytaskthrough auxiliary provider resolution and cached-client construction.autorouting for non-compression tasks.provider == "auto"with a supplied task.tests/agent/test_auxiliary_main_first.pytests/agent/test_auxiliary_client.pyHow to Test
task="compression"andprovider="auto".session_searchstill resolves to the Codex main provider.Automated checks run locally on macOS 15.7.2:
python scripts/check-windows-footguns.py --diff HEAD~1 python -m pytest tests/agent/test_auxiliary_main_first.py tests/agent/test_auxiliary_client.py tests/run_agent/test_provider_parity.py::TestAuxiliaryClientProviderPriority tests/run_agent/test_async_httpx_del_neuter.py tests/run_agent/test_compression_feasibility.py -q -o 'addopts=' scripts/run_tests.sh tests/agent/test_auxiliary_main_first.py tests/agent/test_auxiliary_client.py tests/run_agent/test_provider_parity.py::TestAuxiliaryClientProviderPriority tests/run_agent/test_async_httpx_del_neuter.py tests/run_agent/test_compression_feasibility.pyChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Targeted CI-parity subset:
Note:
scripts/run_tests.shwithout arguments currently exits early withARGS[@]: unbound variableon this checkout. Running the full suite asscripts/run_tests.sh tests/executed but failed broadly outside this change area in this local environment; the focused affected suites above pass under the wrapper.