mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 19:04:50 +07:00
[PR #652] serve: keep final statistics when a reply ends or is cancelled #651
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#651
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/652
Author: @LostVector
Created: 10/29/2026
Status: 🔄 Open
Base:
main← Head:upstream/serve-drain-stats📝 Commits (1)
d84955aserve: retain final STAT snapshots when draining a stopped consumer📊 Changes
2 files changed (+41 additions, -0 deletions)
View changed files
📝
serve/server.py(+3 -0)📝
serve/test_server.py(+38 -0)📄 Description
When a reply ends, the engine sends its final statistics just after the last token. The server was throwing that snapshot away while finishing an EOS, token-budget stop, or cancellation. This keeps it, so the dashboard and
/metricsshow the completed reply instead of stale or missing counters. We found this on a three-token reply whose metrics were stillNoneafter completion.The serial
StrataEngine.generate()drain now parsesSTATlines before continuing toDONE. This preserves the last timing, expert-cache/read counters, and any other native statistic through the same parser used during generation. It adds no model calls or device synchronization.The regression test uses a fake native process that sends an intermediate snapshot, a token, then a final snapshot and
DONE. It fails on current main because closing the token consumer leaves the intermediate values, and passes with this fix. It also checks that the next request reads its own tokens rather than a stale completion.Validation on
f031a23: 465 server tests pass (11 skipped), 585 tools tests pass (31 skipped), and HIP compatibility check passes. The same regression also passes against a backport onto our pinned private API source. No inference speedup is claimed; this fixes reporting needed for reliable measurements.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.