Merge remote-tracking branch 'origin/CODEX' into sub_laptop_2

This commit is contained in:
2026-10-09 14:41:33 +09:00
2 changed files with 36 additions and 3 deletions
+6 -1
View File
@@ -36,7 +36,7 @@ def test_missing_api_key_is_reported_before_search(monkeypatch):
assert error.value.status_code == 503
def test_busy_gemini_is_retried_and_reported(monkeypatch):
def test_busy_gemini_is_retried_and_reported(monkeypatch, caplog):
monkeypatch.setenv("GEMINI_API_KEY", "test-key")
monkeypatch.setattr(chat, "search", lambda _question: [])
calls = []
@@ -64,6 +64,9 @@ def test_busy_gemini_is_retried_and_reported(monkeypatch):
asyncio.run(chat.ask_knowledge_chat(chat.ChatRequest(question="일위대가가 뭐야"), {}))
assert len(calls) == 3
assert "요청이 몰려" in error.value.detail
assert [f"attempt={n} status=503" in caplog.text for n in (1, 2, 3)] == [True] * 3
assert "test-key" not in caplog.text
assert "일위대가가 뭐야" not in caplog.text
def test_gemini_timeout_is_reported(monkeypatch):
@@ -132,11 +135,13 @@ def test_chat_searches_all_knowledge_markdown_except_excluded_folders(monkeypatc
async def post(self, url, *, headers, json):
sent["prompt"] = json["contents"][0]["parts"][0]["text"]
sent["thinking_level"] = json["generationConfig"]["thinkingConfig"]["thinkingLevel"]
return Response()
monkeypatch.setattr(chat.httpx, "AsyncClient", Client)
result = asyncio.run(chat.ask_knowledge_chat(chat.ChatRequest(question="임도 기준"), {}))
assert result["answer"] == "설명 [1]"
assert sent["thinking_level"] == "low"
paths = {source["path"] for source in result["sources"]}
assert paths == {"original/법률/현행.md"}
assert "실무문서" not in sent["prompt"]