model switch also switches provider (gpt models were sent to the Claude API)
ci / check (pull_request) Canceled after 0s
ci / check (push) Canceled after 0s

This commit is contained in:
hermes committed 2026-10-01 12:15:39 +00:00
1 parent 658ada46f7
commit ad73e8f1c2
7 files changed
+171 -21

No files matched your search

+8
View File
@@ -18,4 +18,12 @@ echo "$log" | grep -q '"auth": "Bearer fake-token"'
echo "$log" | grep -q 'oauth-2025-04-20'
echo "$log" | grep -q 'hi from hx' # bash tool result sent back to the model
ls "$tmp/home/.hx/sessions/"*/*.jsonl > /dev/null
# a GPT model goes to the Codex endpoint, not to the Claude API (both logged in)
echo '{"claude":{"access":"fake-token","refresh":"r","expires":99999999999999},"codex":{"access":"cx-token","refresh":"r","expires":99999999999999,"account_id":"acc"}}' > "$tmp/home/.hx/auth.json"
HOME="$tmp/home" HX_BASE_URL="http://127.0.0.1:$port" "$root/target/debug/hx" -m gpt-5.6-terra -p "hi" > /dev/null 2> "$tmp/err" || true
curl -s "http://127.0.0.1:$port/" | python3 -c '
import json, sys
last = json.load(sys.stdin)[-1]
assert last["path"].endswith("/responses") and last["body"]["model"] == "gpt-5.6-terra" and last["auth"] == "Bearer cx-token", last
' || { echo "FAIL: gpt model not routed to codex"; cat "$tmp/err"; exit 1; }
echo "e2e ok"
+7 -1
View File
@@ -23,7 +23,13 @@ class H(http.server.BaseHTTPRequestHandler):
def do_POST(self):
body = json.loads(self.rfile.read(int(self.headers["content-length"])))
LOG.append({"auth": self.headers.get("authorization"), "beta": self.headers.get("anthropic-beta"), "body": body})
LOG.append({"path": self.path, "auth": self.headers.get("authorization"), "beta": self.headers.get("anthropic-beta"), "body": body})
if self.path.endswith("/responses"):
# Codex route: only the request matters to the tests
self.send_response(400)
self.end_headers()
self.wfile.write(b'{"detail": "fake codex"}')
return
turn = TURNS[min(len(LOG) - 1, len(TURNS) - 1)]
self.send_response(200)
self.send_header("anthropic-ratelimit-unified-5h-utilization", "0.42")
+3 -1
View File
@@ -69,7 +69,9 @@ check("quota in footer", "5h 42%")
send(b"/usage\r")
check("usage report", "58% left, resets in 2h1")
send(b"/model claude-opus-5-5\r")
check("model switch", "model → claude-opus-5-5 · context 1000k")
check("model switch", "model → claude-opus-5-5 (Claude) · context 1000k")
send(b"/model gpt-5.6-sol\r")
check("gpt model needs codex login", "not logged in to Codex")
send(b"/model claude-sonnet-5-6-preview\r")
check("live catalog window", "context 2000k")
check("live catalog cached", "") if os.path.exists(f"{tmp}/home/.hx/models-claude.json") else (print("FAIL no model cache"), globals().update(ok=False))