[PR #3049] [CLOSED] [Other] Synchronize cache metrics after completed recovery clears #4421

Closed
opened 2026-11-07 15:35:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3049
Author: @oscarlius
Created: 10/18/2026
Status: ❌ Closed

Base: main ← Head: fix/conversation-cache-clear-metrics-20261018


📝 Commits (1)

  • e55f006 fix(serve): synchronize cache metrics after completed recovery clears

📊 Changes

2 files changed (+116 additions, -0 deletions)

View changed files

📝 serve/server.py (+8 -0)
➕ serve/test_cache_log_clear.py (+108 -0)

📄 Description

Problem and result

Issue #3047 can leave the Monitor conversation-cache current values stale after either completed non-finite-logit recovery clear message. The observer now recognizes only the two completed engine messages and resets parked and bytes while preserving cumulative cache history.

Fixes #3047.

Approach

  • Add strict full-line recognition for the two completed recovery-clear messages in serve/server.py.
  • Reset only the current cache values, leaving eviction, park, restore, and last-event history unchanged.
  • Add local file and local HTTP regression coverage in serve/test_cache_log_clear.py.

Validation

Rebased on upstream main e88ee39d1d6be6e3364183af3b39b62a7ed6f211 (0.2.0-beta); tested candidate bc1a4e54b722d985c9205542bfc4fe17226d7987 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_cache_log_clear.py (Ruff 0.2.1): 10 existing diagnostics, same as unmodified main; zero new diagnostics.
    python -m unittest serve.test_cache_log_clear (4 tests); python -m unittest serve.test_monitor serve.test_server serve.test_prometheus (357 tests, 3 skipped); python -m py_compile serve/server.py; git diff --check e88ee39d1d6be6e3364183af3b39b62a7ed6f211..HEAD.

Failed: Red reproduction used git restore --source=e88ee39d1d6be6e3364183af3b39b62a7ed6f211 -- serve/server.py, then python -m unittest serve.test_cache_log_clear, then git restore --source=HEAD -- serve/server.py. The test ran 4 tests and failed 8 assertions, including the local /metrics fixture retaining stale cache values.

Not run: Native backend builds and real GPU/model tests. Only Python observer code changed. The Python 3.14.3 test environment had no Ruff; the separate Python 3.12.7 lint comparison above completed successfully.

Limits

The parser intentionally accepts only complete known engine recovery messages. Validation used local file fixtures and a local MockEngine HTTP server; it did not use a real engine or a production service.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/3049 **Author:** [@oscarlius](https://github.com/oscarlius) **Created:** 10/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/conversation-cache-clear-metrics-20261018` --- ### 📝 Commits (1) - [`e55f006`](https://github.com/Niko1221/Strata/commit/e55f006bffa2588802cffdbf5053baf8526d8340) fix(serve): synchronize cache metrics after completed recovery clears ### 📊 Changes **2 files changed** (+116 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+8 -0) ➕ `serve/test_cache_log_clear.py` (+108 -0) </details> ### 📄 Description ## Problem and result Issue #3047 can leave the Monitor conversation-cache current values stale after either completed non-finite-logit recovery clear message. The observer now recognizes only the two completed engine messages and resets `parked` and `bytes` while preserving cumulative cache history. ## Related discussion Fixes #3047. ## Approach - Add strict full-line recognition for the two completed recovery-clear messages in `serve/server.py`. - Reset only the current cache values, leaving eviction, park, restore, and last-event history unchanged. - Add local file and local HTTP regression coverage in `serve/test_cache_log_clear.py`. ## Validation Rebased on upstream main `e88ee39d1d6be6e3364183af3b39b62a7ed6f211` (0.2.0-beta); tested candidate `bc1a4e54b722d985c9205542bfc4fe17226d7987` 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_cache_log_clear.py` (Ruff 0.2.1): 10 existing diagnostics, same as unmodified main; zero new diagnostics. `python -m unittest serve.test_cache_log_clear` (4 tests); `python -m unittest serve.test_monitor serve.test_server serve.test_prometheus` (357 tests, 3 skipped); `python -m py_compile serve/server.py`; `git diff --check e88ee39d1d6be6e3364183af3b39b62a7ed6f211..HEAD`. **Failed:** Red reproduction used `git restore --source=e88ee39d1d6be6e3364183af3b39b62a7ed6f211 -- serve/server.py`, then `python -m unittest serve.test_cache_log_clear`, then `git restore --source=HEAD -- serve/server.py`. The test ran 4 tests and failed 8 assertions, including the local `/metrics` fixture retaining stale cache values. **Not run:** Native backend builds and real GPU/model tests. Only Python observer code changed. The Python 3.14.3 test environment had no Ruff; the separate Python 3.12.7 lint comparison above completed successfully. ## Limits The parser intentionally accepts only complete known engine recovery messages. Validation used local file fixtures and a local MockEngine HTTP server; it did not use a real engine or a production service. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:35:36 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4421
No description provided.