feat: add debug traces and failure events to message history - #238
Open
HardeepAsrani wants to merge 1 commit into
Open
feat: add debug traces and failure events to message history#238HardeepAsrani wants to merge 1 commit into
HardeepAsrani wants to merge 1 commit into
Conversation
…istory
Every bot reply now stores a debug trace with the conversation entry: the
answered flag, mode/transport, model, latency, token usage, similarity
threshold, the exact retrieval query, every matched KB chunk with its score
and token count (including chunks dropped for the context budget), the
visitor's page URL, follow-ups offered, and skills executed. The Messages
screen renders it as a collapsed line under each reply ("12:31 pm · Not
answered · 9 sources · Show trace") expanding into a label/value ledger
with score bars and a threshold tick.
Failed turns are no longer invisible: moderation-flagged, rate-limited and
errored turns record the visitor's message plus an event divider (never a
bot bubble). Rate-limit events only land on existing threads and collapse
consecutively, so blocked traffic cannot grow the database.
Also fixes two bugs found along the way: a moderation API failure was
reported to the visitor as "flagged by moderation", and a failed first
turn forked the conversation into a second thread instead of adopting the
real conversation id on the next successful turn.
Ref Codeinwp/hyve#300
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
🌍 i18n String Review Report📊 Summary
➕ Added Strings (39) - Click to expand
|
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
Closes Codeinwp/hyve#300
Pro PR: https://github.com/Codeinwp/hyve/pull/301
Until now, the Messages screen only showed what the visitor and the bot said, with no way to tell why a reply came out the way it did. This PR records a debug trace with every bot reply and surfaces it in the conversation view.
Each bot reply now shows a summary line (answered or not, number of sources used) with a Show trace toggle that expands a detail panel:
Failed turns are no longer lost: messages flagged by moderation, rate-limited visitors and API errors now appear as event markers in the conversation. The visitor's message is kept, and the failure is never recorded as a bot reply. Repeated rate-limit hits collapse into a single event so abuse can't grow the database.
Also fixed along the way:
Works across all four reply paths: self-hosted and Hyve Connect, polling and streaming. Older conversations without traces render exactly as before.
Screenshots
QA instructions