Skip to content

Commit 2eada03

Browse files
committed
fix(trace-spans): extend final model segment by position not by stale constant name
1 parent 41e1a66 commit 2eada03

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

apps/sim/lib/logs/execution/trace-spans/span-factory.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import type {
1414

1515
const logger = createLogger('SpanFactory')
1616

17-
const STREAMING_SEGMENT_NAME = 'Streaming response'
18-
1917
/** A BlockLog that has already passed the id/type validity check. */
2018
type ValidBlockLog = BlockLog & { blockType: string }
2119

@@ -168,9 +166,10 @@ function buildChildrenFromTimeSegments(
168166
let segmentEndTime = new Date(segment.endTime).toISOString()
169167
let segmentDuration = segment.duration
170168

171-
// Streaming segments sometimes close before the block ends; extend the
172-
// trailing streaming segment to the block endTime so the bar fills.
173-
if (segment.name === STREAMING_SEGMENT_NAME && log.endedAt) {
169+
// The final model segment sometimes closes before the block ends (e.g. when
170+
// post-processing runs after the stream). Extend it to the block endTime so
171+
// the Gantt bar fills to the edge rather than leaving a trailing gap.
172+
if (index === segments.length - 1 && segment.type === 'model' && log.endedAt) {
174173
const blockEndMs = new Date(log.endedAt).getTime()
175174
const segmentEndMs = new Date(segment.endTime).getTime()
176175
if (blockEndMs > segmentEndMs) {

0 commit comments

Comments
 (0)