Description
When an Agent Studio input guardrail fires (e.g. off_topic_questions), the backend emits a data-guardrail-violation event containing a fallbackResponse string. @docsearch/sidepanel-js has no handler for this event type, so the fallback string is dropped and the UI renders only the aborted text-delta chunks — typically a single letter (e.g. "I").
Steps to reproduce
- In Agent Studio, enable a guardrail, such as
off_topic_questions input guardrail on your assistant
- Mount
@docsearch/sidepanel-js with agentStudio: true and that assistant's ID
- Ask an off-topic question, e.g. "What's the capital of France?"
Raw EventStream (verbatim from the streaming API response):
data: {"type": "start", "messageId": "alg_msg_tVT46Wu8tMHAe2jK", "messageMetadata": {}}
data: {"type": "start-step"}
data: {"type": "text-start", "id": "alg_msg_tVT46Wu8tMHAe2jK"}
data: {"type": "text-delta", "id": "alg_msg_tVT46Wu8tMHAe2jK", "delta": "I"}
data: {"type": "text-end", "id": "alg_msg_tVT46Wu8tMHAe2jK"}
data: {"type": "finish-step"}
data: {"type": "data-guardrail-violation", "data": {"category": "off_topic_questions", "guardrailType": "input", "fallbackResponse": "I'm sorry I couldn't respond to that, I can only answer questions about Workato's documentation."}}
data: {"type": "finish"}
data: [DONE]
The fallbackResponse field contains the full intended message; nothing in the compiled library consumes it.
Suspected root cause
grep of the compiled @docsearch/sidepanel-js@4.7.0 bundle for guardrail or fallbackResponse returns zero matches. The library's stream reducer switches on:
start, start-step, text-start, text-delta, text-end, finish-step, finish, tool-call, tool-calls, tool-input-start, tool-input-delta, tool-input-available, tool-input-error, tool-output-available, tool-output-error, tool-result, data-code
data-guardrail-violation is not in that set, so the event has no effect on the message-parts state.
Expected behavior
The fallbackResponse string from the data-guardrail-violation event renders as the assistant's message.
Actual
Only the first token from the aborted text-delta stream renders. On repeated near-duplicate off-topic asks, the delta content shrinks further (single letter → nothing).
[Attach: Screenshot 2026-07-29 at 2.43.11 PM.png — shows the empty response bar with just a cursor and the feedback buttons, after asking "what's the capital of sweden"]
Environment
- OS: macOS
- Browser: Chrome, Chrome Incognito
@docsearch/sidepanel-js: 4.7.0 (reproduced on 4.6.2 as well)
@docsearch/css: 4.7.0
- Panel variant:
inline
agentStudio: true
- Guardrail:
off_topic_questions, guardrailType: input
Contrast case
docs.algolia.com uses the same library version (@docsearch/sidepanel-js@4, currently resolving to 4.7.0) and does not exhibit this bug — because its assistant does not have any input guardrails enabled, so data-guardrail-violation events are never emitted. Off-topic behavior there is handled by the model via its system prompt, producing normal text-delta chunks that the library renders correctly.
[Attach: Screenshot 2026-07-29 at 3.15.53 PM.png — EventStream from docs.algolia.com showing only start/start-step/tool-input-* events, no data-guardrail-violation]
Suggested fix
In the stream reducer, add a case for data-guardrail-violation: append a new message part rendering data.fallbackResponse as the assistant's text, replacing (or appending after) the truncated text-* sequence. Any consumer of an Agent Studio input guardrail is currently unusable without this.
Description
When an Agent Studio input guardrail fires (e.g.
off_topic_questions), the backend emits adata-guardrail-violationevent containing afallbackResponsestring.@docsearch/sidepanel-jshas no handler for this event type, so the fallback string is dropped and the UI renders only the abortedtext-deltachunks — typically a single letter (e.g."I").Steps to reproduce
off_topic_questionsinput guardrail on your assistant@docsearch/sidepanel-jswithagentStudio: trueand that assistant's IDRaw EventStream (verbatim from the streaming API response):
The
fallbackResponsefield contains the full intended message; nothing in the compiled library consumes it.Suspected root cause
grepof the compiled@docsearch/sidepanel-js@4.7.0bundle forguardrailorfallbackResponsereturns zero matches. The library's stream reducer switches on:start,start-step,text-start,text-delta,text-end,finish-step,finish,tool-call,tool-calls,tool-input-start,tool-input-delta,tool-input-available,tool-input-error,tool-output-available,tool-output-error,tool-result,data-codedata-guardrail-violationis not in that set, so the event has no effect on the message-parts state.Expected behavior
The
fallbackResponsestring from thedata-guardrail-violationevent renders as the assistant's message.Actual
Only the first token from the aborted
text-deltastream renders. On repeated near-duplicate off-topic asks, the delta content shrinks further (single letter → nothing).[Attach:
Screenshot 2026-07-29 at 2.43.11 PM.png— shows the empty response bar with just a cursor and the feedback buttons, after asking "what's the capital of sweden"]Environment
@docsearch/sidepanel-js:4.7.0(reproduced on4.6.2as well)@docsearch/css:4.7.0inlineagentStudio: trueoff_topic_questions,guardrailType: inputContrast case
docs.algolia.com uses the same library version (
@docsearch/sidepanel-js@4, currently resolving to4.7.0) and does not exhibit this bug — because its assistant does not have any input guardrails enabled, sodata-guardrail-violationevents are never emitted. Off-topic behavior there is handled by the model via its system prompt, producing normaltext-deltachunks that the library renders correctly.[Attach:
Screenshot 2026-07-29 at 3.15.53 PM.png— EventStream from docs.algolia.com showing onlystart/start-step/tool-input-*events, nodata-guardrail-violation]Suggested fix
In the stream reducer, add a case for
data-guardrail-violation: append a new message part renderingdata.fallbackResponseas the assistant's text, replacing (or appending after) the truncatedtext-*sequence. Any consumer of an Agent Studio input guardrail is currently unusable without this.