Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1780-digest-needs-a-look.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The timeline report's `## Team` roll-up now names the same Bots its own per-Bot sections flag: a Bot whose failed turns began before the window (so it has more failures than turns inside it) appears under `needs a look` again instead of being dropped while its section still reads `3 of 3 turns failed` ([#1780](https://github.com/ThinkFlowLab/FlyBot/issues/1780)).
4 changes: 3 additions & 1 deletion plugins/timeline/src/digest.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export function buildDigest(window = {}, { title = 'Team report', now = Date.now
counted: bots.reduce((sum, bot) => sum + bot.counted, 0),
tokens: { input: sumTokens('input'), output: sumTokens('output'), cacheRead: sumTokens('cacheRead'), cacheWrite: sumTokens('cacheWrite'), calls: sumTokens('calls') },
longestWait: longest === undefined ? null : { id: longest.id, from: longest.from, to: longest.to, waitedMs: longest.waitedMs ?? 0 },
unhealthy: bots.filter(bot => bot.turns >= ERROR_TURNS_MIN && bot.errorRate >= ERROR_RATE_MIN).map(bot => bot.id),
// The same denominator as the per-Bot flag above: a failure that began before the window is
// counted there, so naming against `turns` alone drops a Bot the report itself flags (#1780).
unhealthy: bots.filter(bot => bot.counted >= ERROR_TURNS_MIN && bot.errorRate >= ERROR_RATE_MIN).map(bot => bot.id),
}

const from = clock(window.from)
Expand Down
13 changes: 13 additions & 0 deletions plugins/timeline/test/digest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,19 @@ test('#582: a Bot that fails most turns is named as needing a look', () => {
assert.match(digest.markdown, /- look: 3 of 4 turns failed/)
})

// The per-Bot flag counts against `max(turns, errors)` (#1579): a failure that began before the
// window still belongs to a turn the window carries. `## Team` must name that Bot too, or the
// report's roll-up disagrees with the section above it (#1780).
test('#1780: needs a look names a Bot whose failures began before the window', () => {
const digest = buildDigest(make({
lanes: [{ id: 'b1', kind: 'bot', name: 'Writer' }],
utilization: [{ lane: 'b1', windowMs: 100_000, busyMs: 1000, turns: 2, errors: 3, running: false }],
}), { now: 100_000 })
assert.deepEqual(digest.bots[0].flags, ['3 of 3 turns failed'])
assert.deepEqual(digest.team.unhealthy, ['b1'])
assert.match(digest.markdown, /- needs a look: b1/)
})

// The rollup is the sum of the per-Bot numbers, never a separate count: a report a person reads
// must not disagree with the lines above it.
test('#582: the team rollup equals the Bot sections', () => {
Expand Down
Loading