botonic-react: infer a function to get ai agent event using authenticated api endpoint to webchat preview #BLT-2535 - #3261
Open
Iru89 wants to merge 9 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Davidhidalgo
approved these changes
Aug 6, 2026
…event-using-authenticated-api-endpoint-to-webchat-preview
vanbasten17
approved these changes
Aug 7, 2026
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.
Description
Adds automatic rehydration of truncated AI Agent debug events in the webchat preview by fetching the full event payload through the authenticated
getMessageByIdAPI.Context
AI Agent debug events shown in the webchat preview can be truncated when the payload is too large to send over Pusher. In that case, the event is delivered with
truncated: trueand ahubtype_message_id, but the UI cannot display tools, guardrails, or other details without the fullevent_data.The webchat preview already exposes
previewUtils.getMessageByIdas an authenticated endpoint to retrieve message details. This PR wires that endpoint into the AI Agent debug trace component so truncated events are automatically enriched when preview utilities are available.Approach taken / Explain the design
rehydrate-ai-agent-event.ts— Pure functions that:previewUtils.getMessageById(hubtypeMessageId, { includeDebugEvents: true }).event_datainto the truncated props while preservingactionandmessageId.hubtype_message_id.use-rehydrated-ai-agent-event.ts— React hook that:truncated,hubtype_message_id, andpreviewUtilsare all present).isRehydratingflag.ai-agent.tsx— Uses the hook to render the resolved event. While rehydrating, or when rehydration returns noevent_data, the "No tools executed" label is suppressed to avoid misleading empty states.PreviewUtilstyping —getMessageByIdnow accepts an optionalincludeDebugEventsflag viaGetMessageByIdOptions.To document / Usage example
Rehydration is automatic when the host application provides
previewUtilswith agetMessageByIdimplementation that supportsincludeDebugEvents:No changes are required in bot code — the
AiAgentcomponent readspreviewUtilsfromWebchatContext.Testing
The pull request...
Unit tests cover rehydration via
getMessageById, cache/deduplication, and the UI behavior while rehydrating. System debug trace tests were migrated from.jsxto.tsxto type the new rehydration scenarios.