Repository navigation
improve(gateway): measure time to first streamed answer delta - #272
Merged
Merged
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Kova's Gateway session benchmark currently finds the first assistant text by polling history. That poll interval adds timing error to comparisons of cold first answers.
User Impact
A caller can opt in to a direct time-to-first-answer measurement in the JSON receipt. The measurement follows the submitted run's streamed text and reports a missing sample explicitly.
Why This Change Was Made
Subscribe before sending so the first delta can be recorded even if it arrives before the send acknowledgment. Match the canonical session, run ID, and expected answer prefix. Keep the existing history-based completion and correctness checks.
Evidence
node tests/gateway-session-send-turn.mjspassed, including an early matching delta and a completed run without a matching delta. Syntax and diff checks passed. The disposable Linux check oncd728270f24used OpenClaw 2026.11.6 and Node 24.22.1. OCM reported a running process, but Gateway readiness never passed: the assigned loopback port refused connections for 90 seconds. The session call therefore produced no stream sample. AWS Crabbox readiness receiptAll checks passed on the reviewed head. Exact-head CI