feat(agent): bridge Hermes context and tools into Codex App Server - #63798
feat(agent): bridge Hermes context and tools into Codex App Server#63798FPSUnleashed wants to merge 13 commits into
Conversation
Register Hermes skill roots with Codex App Server, force metadata reloads between turns, and attach newly created or modified skills as native turn inputs. Preserve pending changes across transient RPC failures and confine discovered skill paths to configured roots.
Pass assembled developer context and resumed history into Codex threads, attach recall ephemerally, and expose allowlisted stateful Hermes tools through correlated dynamic calls to the live parent agent.
8595710 to
c27f7c5
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for extending the opt-in Codex runtime with Hermes context, stateful tools, and live event projection.
Problems
agent/codex_runtime.py:880starts a Codex turn without resetting Hermes' per-response stream state, even though its event handler sends deltas through_fire_stream_delta()(agent/codex_runtime.py:622-625). The standard provider path resets that state before every request atagent/conversation_loop.py:1188. Without the reset,_current_streamed_assistant_textand the stateful think/context scrubbers can leak from one Codex turn into the next.
Suggested changes
- Call
agent._reset_stream_delivery_tracking()immediately beforecodex_session.run_turn(...), and cover two sequential streamed Codex turns.
Automated hermes-sweeper review.
| "partial": True, | ||
| "error": str(exc), | ||
| } | ||
| turn = codex_session.run_turn(user_input=codex_turn_input) |
There was a problem hiding this comment.
Reset Hermes' stream delivery state immediately before this call. This path emits deltas through _fire_stream_delta(), but unlike the normal provider loop (agent/conversation_loop.py:1188) it never clears _current_streamed_assistant_text or the stateful think/context scrubbers between turns.
There was a problem hiding this comment.
Thank you, I am trying to make it so codex can be a seamless replacement of the main agent loop, there is still a lot of work but it will be done.
SummaryThree PRs address or reference #36801: #37196 exposes Codex token usage, #48485 adds threshold-based retire-and-handoff, and #63798 substantially expands the Codex App Server bridge while hardening native compaction event handling. The issue's exact unbounded Codex-owned-thread failure was subsequently fixed on main through Codex-native compaction in #60114. Related pull requests
Suggested consolidationKeep #63798 open with a salvage path focused on its distinct context/tool bridge and live event projection, contingent on resolving the contributor's stream-reset review and preferably splitting the reviewable bridge components from the 7,528-line aggregate. Leave #37196 and #48485 closed: #48485's recorded best-fix status is superseded by the documented Codex-native implementation on main, while #37196 is a narrower observability precursor rather than the implemented compaction solution. Cross-PR triage: Reviewed 3 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 444 kB of PR diffs, 14 kB of issue/PR text, 6 kB of discussion (7 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Related Issue
Fixes #36801
Type
Summary
Adds a first-class Hermes ↔ Codex App Server runtime and makes Codex turns stream live through the existing Hermes TUI/Desktop/Web gateway instead of appearing only after completion.
The bridge preserves Codex-native tools and MCP behavior while giving Codex the same Hermes context and recall capabilities as the default runtime.
Changes Made
codex_app_serverruntime support and persistent Codex thread/session handling.hermes_history,hermes_session_search,hermes_memory, andhermes_contextas Codex dynamic tools.threadId+turnIdcorrelation, post-terminal quarantine, stale approval rejection, replay/orphan suppression, and fail-closed malformed identity handling.requestUserInputdraining: accepted snapshot requests may finish past the normal turn deadline, while overflow is explicitly rejected.Verification
Exact published commit:
26585ed4723f2e1b8dd34c1e4f1b75fbdf05e52bPre-commit staged artifact fingerprint:
Independent read-only release gate: approved, zero blockers. The reviewer independently exercised malformed/whitespace item types and IDs, MCP/dynamic discriminators, immutable start identities, forward-compatible opaque items, strict callback gating, and deterministic call-ID parity.
Automated results:
The repository-wide Python and Desktop test baselines are not fully green in this macOS worktree for unrelated existing environment/fixture failures; no bridge-focused or changed-file failure remained.
Real Codex App Server smokes passed locally and after atomic deployment:
The deployed candidate passed pre-switch and post-switch protocol gates, created a rollback snapshot, restarted cleanly, and passed the full active-runtime gate after activation.
Security Notes
force=Truebefore truncation or UI delivery.Screenshots
Not applicable — protocol/runtime change with automated TUI coverage.