Pull requests / #3335
#3335 [Other] Serialize conversation-cache log polling
open · @oscarlius · 0 comments · View on GitHub
Setup & installServer & APIWindows
Description
## Problem and result Concurrent `/metrics` readers could read the same conversation-cache log range and replay an event. This change serializes access to the shared log cursor, so direct and HTTP metrics readers count each event once. ## Related discussion Continues #3041 after the 0.2.0-beta tracker reset. The original passed the new format check, but GitHub refused to reopen the rebased branch; [the reset bot](https://github.com/Niko1221/Strata/pull/3041#issuecomment-6282591930) explicitly suggested a new linked pull request. Closes #3039. ## Approach Guard the existing log-poll operation with the cache object's lock and add direct-reader and local loopback `/metrics` concurrency regressions. Cache parsing and native inference behavior are unchanged. ## Validation Rebased on upstream main `e88ee39d1d6be6e3364183af3b39b62a7ed6f211` (0.2.0-beta); tested candidate `04796fa0427beaa6b8628d6e2ab914c7059ca8c0` on Windows, Python 3.14.3. Each test command starts a fresh local process. **Passed:** - `py -3.12 -m ruff check --output-format json serve/server.py serve/test_monitor.py` (Ruff 0.2.1): 10 existing diagnostics, same as unmodified main; zero new diagnostics. - `python -m unittest -v serve.test_monitor serve.test_prometheus` — 18 tests passed. - `python -m py_compile serve/server.py serve/test_monitor.py`. - `git diff --check e88ee39d1d6be6e3364183af3b39b62a7ed6f211..HEAD`. **Failed:** - With the exact base production file restored, the direct concurrency test replayed the park event twice. The initial two-test run also had one environment error before the local `regex` dependency was installed. The subsequent fresh loopback HTTP `/metrics` red test failed as expected with `(parks, restores) = (2, 0)` instead of `(1, 0)`. **Not run:** - No GPU, native backend, model download, or hardware inference test. ## Limits The proof covers concurrent Python readers, the repository mock engine, and a local loopback HTTP server. It does not exercise a real model process or hardware runtime.
Related on this site
Quick links to related pages.