fix: preserve chronological position of deduplicated token events#64
Merged
Conversation
The previous token dedup replaced content at the first token's array position. Since the first token appears before tool calls but the final cumulative token appears after, this caused the complete response text to render above tool calls instead of below them. Instead, null out the old slot and push the latest token at its actual chronological position, then filter nulls before grouping.
Contributor
Greptile OverviewGreptile SummaryFixed token deduplication to preserve chronological position of assistant responses. The previous implementation replaced tokens at the first occurrence's array index, causing complete responses to render before tool calls instead of after them. The fix nulls out old positions and pushes the latest token at its actual chronological position, then filters nulls before grouping. |
bleleve
added a commit
to bleleve/background-agents
that referenced
this pull request
May 22, 2026
…feedback on ColeMurray#64) fountain-reef reviewer flagged that `slack.channel_info.missing` was overloaded: it fired both for Slack-returned `ok: false` (operator- actionable — missing scope, channel_not_found) and for the anomalous `ok: true` / no `channel` field case. Mixed events make alerting harder. Split into three distinct event names so each failure mode can be filtered or alerted on independently: - `slack.channel_info.api_error` — Slack API returned `ok: false` with a structured error (typically a permission or configuration issue). - `slack.channel_info.missing` — `ok: true` but no `channel` field (Slack-side anomaly; should not happen per the API contract). - `slack.channel_info.fetch_failed` — transport-level exception before any envelope was parsed (renamed from `slack.channel_info.error` to avoid name overlap with the API-error case). No behaviour change; only log-event naming. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bleleve
added a commit
to bleleve/background-agents
that referenced
this pull request
May 22, 2026
…feedback on ColeMurray#64) fountain-reef reviewer flagged that `slack.channel_info.missing` was overloaded: it fired both for Slack-returned `ok: false` (operator- actionable — missing scope, channel_not_found) and for the anomalous `ok: true` / no `channel` field case. Mixed events make alerting harder. Split into three distinct event names so each failure mode can be filtered or alerted on independently: - `slack.channel_info.api_error` — Slack API returned `ok: false` with a structured error (typically a permission or configuration issue). - `slack.channel_info.missing` — `ok: true` but no `channel` field (Slack-side anomaly; should not happen per the API contract). - `slack.channel_info.fetch_failed` — transport-level exception before any envelope was parsed (renamed from `slack.channel_info.error` to avoid name overlap with the API-error case). No behaviour change; only log-event naming. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bleleve
added a commit
to bleleve/background-agents
that referenced
this pull request
May 22, 2026
…feedback on ColeMurray#64) fountain-reef reviewer flagged that `slack.channel_info.missing` was overloaded: it fired both for Slack-returned `ok: false` (operator- actionable — missing scope, channel_not_found) and for the anomalous `ok: true` / no `channel` field case. Mixed events make alerting harder. Split into three distinct event names so each failure mode can be filtered or alerted on independently: - `slack.channel_info.api_error` — Slack API returned `ok: false` with a structured error (typically a permission or configuration issue). - `slack.channel_info.missing` — `ok: true` but no `channel` field (Slack-side anomaly; should not happen per the API contract). - `slack.channel_info.fetch_failed` — transport-level exception before any envelope was parsed (renamed from `slack.channel_info.error` to avoid name overlap with the API-error case). No behaviour change; only log-event naming. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes a regression from #63 where the assistant's complete response text rendered above tool calls instead of below them.
The previous token dedup replaced content at the first token's array slot. Since the first token for a message appears before tool calls but the final cumulative token appears after them, this placed the complete response text before all tool call cards in the UI.
Fix: Instead of replacing at the first occurrence's position, null out the old slot and push the latest token at its actual chronological position. Nulls are filtered out before grouping.
Before/After
Before: Summary response appears above tool calls
After: Summary response appears at its correct position after tool calls
Test plan
npm run typecheck -w @open-inspect/webnpm run test -w @open-inspect/webnpm run build -w @open-inspect/web