# Todo 40: Chat Message Stream Audit Boundaries ## Goal Add audit events around ChatAgent visible message streaming so replay can show when user-visible text starts and when it ends. ## Plan 1. Emit `chat_message_stream_started` before the first `message_delta` reaches the output queue. 2. Emit `chat_message_stream_finished` after the model stream ends and before `chat_agent_response`. 3. Keep `chat_agent_response` as the complete aggregated visible ChatAgent text for that call. 4. Add readable Audit Replay summaries for the new events. ## Verification - `uv run pytest tests/test_debug_runtime.py::test_runtime_audits_chat_message_stream_boundaries_in_output_order -q` - `uv run pytest tests/test_debug_runtime.py::test_runtime_emits_audit_events_and_backend_logs -q` - `uv run pytest tests/test_websocket_api.py::test_static_app_handles_audit_messages -q` - `uv run pytest` - `node --check src/agent_lab/presentation/static/app.js` - `git diff --check`