fix(app): log hub masks dotted tokens, keeps worker errors and drops the oldest lines by time
- redact: a token with sentence dots around it is masked too. - Worker error messages are always logged (code and id), so the log screen and the error report show them without debug logging. - The voice worker logs with stt, llm and tts categories, so its lines land in those tabs. - The zip leaves out the oldest lines by the time they were logged, across every tab's file, not by file name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1105,3 +1105,28 @@ def test_a_reply_waits_for_a_pick_still_being_prepared_for_its_text(tmp_path, mo
|
||||
b.reply("100", "자비스 날씨 어때?", HistoryContext())
|
||||
t.join()
|
||||
assert seen["prepared"] == [plan]
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_worker_logs_name_their_service_so_the_app_puts_them_in_its_tab(store, monkeypatch, capfd):
|
||||
"""The app's log screen puts a worker line in the stt, llm or tts tab by its category
|
||||
(app/src/admin.spec.md, "Logs"); the worker must send those categories."""
|
||||
from voice_worker import log as worker_log
|
||||
monkeypatch.setattr(worker_log._jarvis_debug, "_is_debug_enabled", lambda: True)
|
||||
|
||||
def broken(user, text):
|
||||
raise RuntimeError("model down")
|
||||
|
||||
async def body(url):
|
||||
async with connect(url) as ws:
|
||||
await hello(ws, stt={"partials": False})
|
||||
await say(ws, "100", 0.9)
|
||||
await send(ws, type="reply", id="r1", user="100", text="hi", via="voice", speak=False)
|
||||
await recv_until(ws, lambda m: isinstance(m, dict) and m.get("type") == "reply_text")
|
||||
await send(ws, type="tts", id="t1", text="안녕하세요.", more=False)
|
||||
await recv_until(ws, lambda m: isinstance(m, dict) and m.get("type") == "tts_done")
|
||||
|
||||
asyncio.run(with_worker(body, store=store, brain=FakeBrain(answer=broken), tts=FakeTts()))
|
||||
err = capfd.readouterr().err
|
||||
for cat, what in (("stt", "utterance end"), ("llm", "brain reply r1 failed"), ("tts", "tts sentence id=t1")):
|
||||
assert any(line.startswith(f"[{cat:^10}]") and what in line for line in err.splitlines()), (cat, err[-2000:])
|
||||
|
||||
Reference in New Issue
Block a user