Files
hermes-agent/evals/codex_echo/fixture_server.py
Teknium a9ef4a7625 fix(codex): keep transport echoes out of durable user history
Port the exact submitted-wire-text ownership boundary from #93546 onto
current topical runtime code. Do not add the candidate's mocked-result
fallback or storage-level content deduplication. Preserve later distinct
and identical user events, separate identical accepted turns, and keyless
inputs. Add two regression invariants and offline subprocess-wire A/B.

Local wire A/B: 4/8 control matrix passing on base, 8/8 after.
Broader tests queued behind campaign lock; not ready for merge.

Refs #104653
Original diagnosis: @gitszabolcs (#38254)
Original implementation: #43127, submitted by @vashkartik
Focused salvage and wire-text correction: @fancyboi999 (#93546)
Current-main carry-forward considered: #104698

Co-authored-by: Xinmin Zeng <135568692+fancyboi999@users.noreply.github.com>
Co-authored-by: VECTOR <vector.hq@outlook.com>
2026-09-07 08:09:57 -07:00

39 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""Offline Codex JSON-RPC peer; no provider or authentication calls."""
import json
import os
import sys
def send(value):
print(json.dumps(value), flush=True)
for line in sys.stdin:
request = json.loads(line)
if "id" not in request:
continue
method = request["method"]
result = {}
if method == "thread/start":
result = {"thread": {"id": "fixture-thread"}}
elif method == "turn/start":
result = {"turn": {"id": "fixture-turn"}}
send({"jsonrpc": "2.0", "id": request["id"], "result": result})
if method != "turn/start":
continue
text = request["params"]["input"][0]["text"]
mode = os.environ.get("ECHO_FIXTURE_MODE", "echo")
items = []
if mode != "assistant_only":
items.append({"type": "userMessage", "id": "input", "content": [
{"type": "text", "text": "different" if mode == "different" else text}]})
items.append({"type": "agentMessage", "id": "reply", "text": "fixture reply"})
if mode == "later_equal":
items.append({"type": "userMessage", "id": "steer", "content": [{"type": "text", "text": text}]})
for item in items:
send({"method": "item/completed", "params": {
"threadId": "fixture-thread", "turnId": "fixture-turn", "item": item}})
send({"method": "turn/completed", "params": {
"threadId": "fixture-thread", "turn": {"id": "fixture-turn", "status": "completed", "error": None}}})