Skip to content

[bug] backend chat SSE: non-finite floats emit invalid JSON + tool_result.summary unset on success #174

Description

@VforVitorio

Two backend root causes the Chat webapp currently defends against client-side (Chat #39 C5) but that should be fixed at the source:

  1. _sse / chat_engine serialize Phase-1 tool payloads with Python json that emits bare NaN/Infinity literals (e.g. PaceOutput.delta_vs_median at a new circuit). Standard JSON.parse rejects these, so a client without a sanitized-retry drops the whole tool_result frame. Fix: sanitize non-finite floats to null (or use allow_nan=False + replace) when building the SSE data.
  2. _build_tool_result_payload sets summary only on tool_error (empty string on success), so any consumer using summary as the human-readable line gets nothing for successful runs. Fix: populate a short success summary.
    Also noted: is_valid on lap_times actually carries IsPersonalBest (telemetry_service.py:216) — a semantic wart that makes nearly every lap render as an 'invalid' dot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions