[codex] Preserve agent continuity across cache and compression paths - #47639
Draft
changw98ic wants to merge 1 commit into
Draft
[codex] Preserve agent continuity across cache and compression paths#47639changw98ic wants to merge 1 commit into
changw98ic wants to merge 1 commit into
Conversation
Several agent paths were losing continuity at boundaries: config writes coerced string enums as booleans, Codex backend requests dropped request-level cache identifiers, compression could rotate sessions before flushing the current tail, Anthropic text-emitted tool calls were left as plain text, and early agent construction could miss MCP discovery results. This keeps the fixes narrow to existing provider, config, compression, and startup paths, with regression coverage for each behavior instead of adding new core surface. Constraint: Per-conversation prompt caching and session persistence are load-bearing Hermes invariants. Rejected: Add new tool or provider surfaces | these were boundary fixes in existing code paths. Confidence: medium Scope-risk: moderate Directive: Do not remove Codex backend request-level session_id / x-client-request-id headers without re-running a live cache-hit probe. Tested: git diff --check Tested: .venv/bin/python -m pytest tests/hermes_cli/test_set_config_value.py tests/hermes_cli/test_mcp_startup.py tests/tui_gateway/test_wait_for_mcp_discovery.py -q (45 passed) Tested: .venv/bin/python -m pytest tests/agent/transports/test_codex_transport.py tests/agent/transports/test_transport.py -q (80 passed, 1 warning) Tested: .venv/bin/python -m pytest tests/run_agent/test_compression_boundary_hook.py tests/run_agent/test_compression_persistence.py -q (13 passed, 1 warning) Tested: live Codex cache probe with request-level session headers: second request reported cached_tokens=5376. Not-tested: Green full-suite in this macOS/DNS environment; scripts/run_tests.sh completed earlier with 30975 passed, 57 failed, and 4 file timeouts, traced to local DNS/SSRF behavior, optional extras, macOS systemd gaps, path normalization, and runner timeout limits.
Contributor
|
Thanks for collecting several continuity cases. One configuration bug is still present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
This was referenced Aug 3, 2026
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.
Summary
This PR tightens several continuity boundaries in the agent runtime:
session_idandx-client-request-idheaders for stable prompt-cache keys.hermes config setvalues based on the known default type, avoiding boolean coercion for string enums such asapprovals.mode=off.Validation
git diff --check.venv/bin/python -m pytest tests/hermes_cli/test_set_config_value.py tests/hermes_cli/test_mcp_startup.py tests/tui_gateway/test_wait_for_mcp_discovery.py -q45 passed.venv/bin/python -m pytest tests/agent/transports/test_codex_transport.py tests/agent/transports/test_transport.py -q80 passed, 1 warning.venv/bin/python -m pytest tests/run_agent/test_compression_boundary_hook.py tests/run_agent/test_compression_persistence.py -q13 passed, 1 warningcached_tokens=5376.Full-suite note
I also ran
scripts/run_tests.shafter creating a local.venv. The run completed with30975 passed,57 failed, and4per-file timeouts. I did not treat that as a green full-suite because the failures were traced to local environment and runner constraints:github.com,example.com, andcdn.discordapp.comto198.18.0.x, triggering SSRF protections in browser/web/Discord/Matrix tests;wecomoptional extra was missing initially; installing it madetests/gateway/test_wecom_callback.pypass;systemctl/ user D-Bus for systemd tests;/tmpresolves to/private/tmpon macOS;tests/run_agent/test_run_agent.pypassed standalone in 322s.