fix(run-journal): drop obsolete writer lock state

This commit is contained in:
Frank Song committed 2026-09-23 13:10:19 +08:00
1 parent 2bd87a002d
commit 68a068c2e5
2 files changed
+7 -2

No files matched your search

-2
View File
@@ -451,8 +451,6 @@ class RunJournalWriter:
self.session_id = _validate_id(session_id, "session_id")
self.run_id = _validate_id(run_id, "run_id")
self.session_dir = Path(session_dir) if session_dir is not None else None
self._path = _run_path(self.session_id, self.run_id, session_dir=self.session_dir)
self._lock = _lock_for(self._path)
def append_sse_event(self, event_name: str, payload=None) -> dict | None:
# Live-UI-only telemetry (metering) has no recovery value in the journal:
@@ -72,3 +72,10 @@ def test_metering_skip_still_does_not_reserve_or_write(tmp_path):
assert writer.append_sse_event("metering", {"tps": 10}) is None
assert not (tmp_path / "_run_journal" / "meter_session" / "meter_run.jsonl").exists()
assert writer.append_sse_event("token", {"text": "kept"})["seq"] == 1
def test_unused_writer_does_not_allocate_a_registry_lock(tmp_path):
parent = str(tmp_path / run_journal.RUN_JOURNAL_DIR_NAME / "unused_session")
writer = run_journal.RunJournalWriter("unused_session", "unused_run", session_dir=tmp_path)
assert writer.append_sse_event("metering", {"tps": 10}) is None
assert not any(key[0] == parent for key in run_journal._WRITER_LOCKS)