fix(persistence): address 22 review comments from CodeQL, Copilot, and Code Quality

Bug fixes:
- Sanitize log params to prevent log injection (CodeQL)
- Reset threads_meta.status to idle/error when run completes
- Attach messages only to latest checkpoint in /history response
- Write threads_meta on POST /threads so new threads appear in search

Lint fixes:
- Remove unused imports (journal.py, migrations/env.py, test_converters.py)
- Convert lambda to named function (engine.py, Ruff E731)
- Remove unused logger definitions in repos (Ruff F841)
- Add logging to JSONL decode errors and empty except blocks
- Separate assert side-effects in tests (CodeQL)
- Remove unused local variables in tests (Ruff F841)
- Fix max_trace_content truncation to use byte length, not char length

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
rayhpeng
2026-04-05 22:49:26 +08:00
parent 32f69674a5
commit b94383c93a
15 changed files with 94 additions and 55 deletions
+2 -2
View File
@@ -456,7 +456,7 @@ class TestDictContentFlag:
sf = get_session_factory()
store = DbRunEventStore(sf)
record = await store.put(
await store.put(
thread_id="t1",
run_id="r1",
event_type="tool_end",
@@ -480,7 +480,7 @@ class TestDictContentFlag:
sf = get_session_factory()
store = DbRunEventStore(sf)
record = await store.put(
await store.put(
thread_id="t1",
run_id="r1",
event_type="tool_end",