fix(gateway): route SessionDB calls through AsyncSessionDB

This commit is contained in:
yoniebans 2026-06-29 12:04:44 +02:00 committed by Teknium
parent ea26f22710
commit 0896facce8
12 changed files with 203 additions and 142 deletions

View file

@ -1,3 +1,4 @@
from hermes_state import AsyncSessionDB
"""Tests for gateway /usage command — agent cache lookup and output fields."""
import threading
@ -197,8 +198,8 @@ class TestUsageAccountSection:
@pytest.mark.asyncio
async def test_usage_command_uses_persisted_provider_when_agent_not_running(self, monkeypatch):
runner = _make_runner(SK)
runner._session_db = MagicMock()
runner._session_db.get_session.return_value = {
runner._session_db = AsyncSessionDB(MagicMock())
runner._session_db._db.get_session.return_value = {
"billing_provider": "openai-codex",
"billing_base_url": "https://chatgpt.com/backend-api/codex",
}