[PR #5307] [CLOSED] [Engine] Count batch admission and slot decode work exactly once #5380

Closed
opened 2026-11-07 16:34:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/5307
Author: @shoucandanghehe
Created: 11/5/2026
Status: ❌ Closed

Base: main ← Head: upstream/batch-leg-accounting


📝 Commits (2)

  • 08519d4 Serving metrics: count admission and slot decode work exactly once
  • d4a0db4 Serving tests: simplify batch accounting regressions

📊 Changes

3 files changed (+131 additions, -20 deletions)

View changed files

📝 serve/server.py (+30 -14)
📝 serve/test_parallel.py (+82 -5)
📝 serve/test_request_accounting.py (+19 -1)

📄 Description

Problem

A batch request reports an admission DONE followed by a slot BDONE. The slot’s token count includes the admission token, but its duration covers only the slot phase. The server currently replaces the admission duration with the slot duration.

For example, a 20 ms admission followed by a slot report of 10 total tokens / 1 ms should be recorded as 10 tokens / 21 ms.

Requests interrupted before final slot statistics arrive can also publish incomplete work as complete totals.

Fix

  • Add admission and slot decode durations; count the admission token once.
  • Keep unfinished native work unknown until final statistics arrive.
  • Preserve missing counts and durations through slot-to-solo transitions and reasoning continuations.

Related: #1869.

Validation

Tested d4a0db48 on Linux/WSL2, Python 3.14.4, using the real server with a subprocess fake native engine.

python -m unittest -v \
  serve.test_parallel serve.test_parallel_yield serve.test_request_accounting \
  serve.test_stream_ownership serve.test_answer_speed serve.test_prometheus \
  serve.test_restart_waiters

All 120 tests passed. The seven retained regressions fail against the unpatched server. They cover completion, interruption, zero slot duration and accounting across continuations.


🔄 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/5307 **Author:** [@shoucandanghehe](https://github.com/shoucandanghehe) **Created:** 11/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `upstream/batch-leg-accounting` --- ### 📝 Commits (2) - [`08519d4`](https://github.com/Niko1221/Strata/commit/08519d46405ec720cda411f08af556bee54c9df0) Serving metrics: count admission and slot decode work exactly once - [`d4a0db4`](https://github.com/Niko1221/Strata/commit/d4a0db48afda0a85da56b95fd07563f266968abe) Serving tests: simplify batch accounting regressions ### 📊 Changes **3 files changed** (+131 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+30 -14) 📝 `serve/test_parallel.py` (+82 -5) 📝 `serve/test_request_accounting.py` (+19 -1) </details> ### 📄 Description ## Problem A batch request reports an admission `DONE` followed by a slot `BDONE`. The slot’s token count includes the admission token, but its duration covers only the slot phase. The server currently replaces the admission duration with the slot duration. For example, a 20 ms admission followed by a slot report of 10 total tokens / 1 ms should be recorded as **10 tokens / 21 ms**. Requests interrupted before final slot statistics arrive can also publish incomplete work as complete totals. ## Fix - Add admission and slot decode durations; count the admission token once. - Keep unfinished native work unknown until final statistics arrive. - Preserve missing counts and durations through slot-to-solo transitions and reasoning continuations. Related: #1869. ## Validation Tested `d4a0db48` on Linux/WSL2, Python 3.14.4, using the real server with a subprocess fake native engine. ```sh python -m unittest -v \ serve.test_parallel serve.test_parallel_yield serve.test_request_accounting \ serve.test_stream_ownership serve.test_answer_speed serve.test_prometheus \ serve.test_restart_waiters ``` All 120 tests passed. The seven retained regressions fail against the unpatched server. They cover completion, interruption, zero slot duration and accounting across continuations. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:34:46 +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#5380
No description provided.