A thinking block that says how long and how much
Each block reports its own round now. `reasoning_ms` was the reply's first burst, written once, so on the fifteen-block reply GPT-OSS actually produces only the first could claim a duration and the other fourteen said "Thought" and nothing at all. `Generation.thinking_ms` accumulates per round and `close_step` stamps it cumulatively, so steps.py diffs it exactly as it already diffs the three lengths beside it. The interval between a round's first and last reasoning delta, deliberately, not a sum of gaps between deltas -- that would count the network's latency as the model's thinking. While it runs: "Thinking" with an ellipsis that types itself, and the seconds and tokens climbing beside it. The ellipsis is a `content` keyframe, so there is no timer to start, stop or clean up when the block is swapped away -- it stops existing when the element does. The numbers come from a `think` frame, and `round_thinking_ms` is written by the producer rather than computed by the follower from a start time: a model that has stopped thinking and moved on to a tool should show a settled number, not a clock that keeps running. Tokens read exactly up to 200 and as `0.4k` above it, from one helper shared by the live label and the stored one, so the two cannot drift into two conventions. The live duration is terser than the finished one -- `6s` against `6 seconds` -- because it sits beside an animating word and changes every second, where "less than a second" flickering into "1 second" reads as a glitch. Checked against the real endpoint: fourteen marks carrying 919ms through 14223ms, per-block labels from "less than a second · 111" to "4 seconds · 0.5k", and the live frames resetting each round rather than accumulating. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1044,3 +1044,24 @@ def test_the_composer_form_answers_only_its_own_request():
|
||||
assert "event.target === this" in handler.group(1), (
|
||||
"a descendant's request will run this handler without the guard"
|
||||
)
|
||||
|
||||
|
||||
def test_the_think_frame_lands_beside_the_reasoning_body_not_around_it():
|
||||
"""The live block has two swap targets inside one static `<details>` -- the
|
||||
label and the body. Two siblings is fine; one inside the other is what
|
||||
blanked every agent chat, because the outer swap tears out the inner
|
||||
element while the frames aimed at it are still arriving."""
|
||||
from pathlib import Path
|
||||
|
||||
import lembas
|
||||
|
||||
source = (
|
||||
Path(lembas.__file__).parent / "web/templates/chat/_message.html"
|
||||
).read_text()
|
||||
|
||||
label = source.index('sse-swap="think"')
|
||||
body = source.index('sse-swap="reasoning"')
|
||||
between = source[min(label, body) : max(label, body)]
|
||||
# Neither element may open a tag that the other closes: siblings, not nested.
|
||||
assert "</span>" in between or "</div>" in between
|
||||
assert between.count("<div") <= 1
|
||||
|
||||
Reference in New Issue
Block a user