Skip to content

[None][fix] fix chat hamony api token ids propagation - #14451

Closed
reasonsolo wants to merge 3 commits into
NVIDIA:feat/bench_xfrom
reasonsolo:fix_router_test_v3
Closed

[None][fix] fix chat hamony api token ids propagation#14451
reasonsolo wants to merge 3 commits into
NVIDIA:feat/bench_xfrom
reasonsolo:fix_router_test_v3

Conversation

@reasonsolo

@reasonsolo reasonsolo commented May 22, 2026

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • If PR introduces API changes, an appropriate PR label is added - either api-compatible or api-breaking. For api-breaking, include BREAKING in the PR title.

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

brb-nv added 2 commits May 22, 2026 01:15
When `/v1/chat/completions` is served with the harmony adapter (gpt-oss
family), the gen-worker handler unconditionally re-runs
`HarmonyAdapter.openai_to_harmony_tokens` on the incoming messages,
producing a second tokenization of work already done on the ctx worker.

Lizhi's NVIDIA#14420 propagates `prompt_token_ids` from the ctx-worker
response onto the gen-worker request, but the gen handler still ignored
them in this code path. Use the propagated `prompt_token_ids` when
present and fall back to the harmony adapter only for the agg path.

Measured impact on RWLT (gpt-oss-120b, multi-turn coding workload):
`gen_preproc_ms` p50 drops from 32.7 ms to 3.5 ms and the disagg-vs-agg
TTFT gap p50 narrows from +140.7 ms to +112.4 ms.

Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
Two related gaps prevented `GET /perf_metrics` from returning per-
request timing data on the chat endpoints, despite server-level
`return_perf_metrics: true` and `TRTLLM_KVCACHE_TIME_OUTPUT_PATH` being
set:

1. The chat handlers (`openai_chat`, `chat_harmony`) never propagated
   `return_perf_metrics` onto the per-request `SamplingParams`, so the
   pyexecutor's `request.update_perf_metrics` call in `py_executor.py`
   was a no-op for these requests. Add the same `TRTLLM_KVCACHE_TIME_
   OUTPUT_PATH` gate already used by `openai_completion`.

2. The harmony streaming generator (`create_streaming_generator` inside
   `chat_harmony`) never called `_extract_metrics`, which is the only
   site that appends an item to `self.perf_metrics`. It also never
   stamped `raw_request.state.server_first_token_time`. Mirror the
   structure of `chat_stream_generator` in `openai_chat`: pull the
   first response with `anext`, stamp first-token time, stream the
   rest, then call `_extract_metrics` after `[DONE]`.

With both fixes, harmony chat requests (gpt-oss family) populate
`/perf_metrics` with correct `server_arrival_time`,
`server_first_token_time`, `first_scheduled_time`, `first_token_time`,
`last_token_time`, and KV-cache block counters per request, which the
disaggregated proxy also collects via `/perf_metrics`.

Signed-off-by: Balaram Buddharaju <169953907+brb-nv@users.noreply.github.com>
@reasonsolo
reasonsolo requested review from a team as code owners May 22, 2026 08:23
@reasonsolo
reasonsolo requested review from dongxuy04 and hchings and removed request for a team May 22, 2026 08:23
…te in test

_make_gen_request did not set is_disagg_generation_transmission_complete,
causing _sync_disagg_generation_trans_complete_draft_tokens to try iterating
over a Mock object instead of skipping non-transmission-complete requests.

Signed-off-by: Lizhi Zhou <1432185+reasonsolo@users.noreply.github.com>
@reasonsolo
reasonsolo force-pushed the fix_router_test_v3 branch from 972da6f to 6f8ceeb Compare May 22, 2026 08:25
@reasonsolo

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49900 [ run ] triggered by Bot. Commit: 6f8ceeb Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #49900 [ run ] completed with state SUCCESS. Commit: 6f8ceeb
/LLM/main/L0_MergeRequest_PR pipeline #39479 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@reasonsolo

Copy link
Copy Markdown
Collaborator Author

Balaram's PR #14506

@reasonsolo reasonsolo closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants