Skip to content

Add raw Spotter output mode behind a flag - #200

Merged
mouryabalabhadra merged 2 commits into
mainfrom
add-raw-spotter-output-mode
Aug 8, 2026
Merged

Add raw Spotter output mode behind a flag#200
mouryabalabhadra merged 2 commits into
mainfrom
add-raw-spotter-output-mode

Conversation

@Rifdhan

@Rifdhan Rifdhan commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator
  • Client can specify via URL flag if they want the full raw Spotter output instead of the simplified version we are providing
  • Pass along the unmodified Spotter event stream if this flag has been set
  • No impact when using v1 tools, this is only for v2 tools
  • Update tests and add coverage

- Client can specify via URL flag if they want the full raw Spotter
  output instead of the simplified version we are providing
- Pass along the unmodified Spotter event stream if this flag has
  been set
- No impact when using v1 tools, this is only for v2 tools
- Update tests and add coverage
@Rifdhan

Rifdhan commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot review this change. Make suggestions or identify any gaps but don't make any code changes yourself.

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@copilot review this change. Make suggestions or identify any gaps but don't make any code changes yourself.

A couple of gaps I’d call out from the review:

  • Raw mode now stores arbitrary upstream items, but the internal storage types still model messages as the simplified Message[] union (src/thoughtspot/types.ts, src/storage-service/storage-service.ts, and the StreamingMessagesState usage in callGetSessionUpdates). Runtime behavior may still work, but the type system no longer matches what can actually be persisted/retrieved in raw mode.
  • I don’t see coverage that the URL flag itself flips the advertised get_session_updates schema/tool variant during listTools(), or that the server path selects SpotterResponseFormat.RAW when enable-raw-session-updates=true. Most of the new tests exercise the parser/service behavior directly, which is good, but there’s still a small integration gap around flag-to-tool exposure.

Comment thread src/servers/tool-definitions.ts Outdated
},
},
{
...GET_SESSION_UPDATES_BASE_TOOL_DEFINITION,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

description is same for both

1. Synthesize answer_id on RAW answer events, so the get_session_updates
   -> create_dashboard handoff keeps working when
   enable-raw-session-updates is on (callCreateDashboard unconditionally
   JSON.parses answer_id).
2. Split the get_session_updates tool description into structured vs
   raw variants instead of sharing one description across both output
   schemas; the raw description now reflects the unfiltered z.unknown()
   contract instead of promising complete/filtered results.
3. Raw mode now still classifies each event by type to record
   recordUpstreamStreamMessageMetric counts and flag span errors on
   upstream error events, closing the observability blind spot where
   raw-mode metrics/error spans went dark. Messages are still passed
   through unmodified otherwise.
4. Widen Message[] to (Message | RawMessage)[] through the
   streaming-utils -> thoughtspot-service -> storage-service ->
   conversation-storage-server chain, since raw mode's pass-through
   items are not guaranteed to match the Message shape.

Updated test/streaming-utils.spec.ts to match the new raw-mode
behavior for answer_id synthesis, error observability, and metrics.

@rohitthughtspot rohitthughtspot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mouryabalabhadra
mouryabalabhadra merged commit 79e9786 into main Aug 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants