{
  "scenario": "bad-truncated-stream",
  "expectFaults": true,
  "violations": [],
  "warnings": [
    "chat.user_message emitted 2× for the same session+content (Introduce yourself briefly — who are you…) — possible double-persist"
  ],
  "stats": {
    "total": 33,
    "types": {
      "connected": 1,
      "session.created": 1,
      "chat.user_message": 2,
      "chat.event": 2,
      "session.stream": 24,
      "chat.response": 2,
      "chat.message": 1
    },
    "streamFrames": {
      "thinking.chunk": 7,
      "done": 2,
      "inference.chunk": 15
    },
    "sessions": 1
  },
  "events": [
    {
      "type": "connected",
      "timestamp": 1783816026551,
      "_rxAt": 1783816026551,
      "_seq": 0
    },
    {
      "type": "session.created",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "mode": "chat",
        "parentSessionId": null,
        "instanceName": null,
        "timestamp": 1783816026812
      },
      "_rxAt": 1783816026813,
      "_seq": 1
    },
    {
      "type": "chat.user_message",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "content": "Introduce yourself briefly — who are you and what can you do?",
        "timestamp": 1783816026815
      },
      "_rxAt": 1783816026816,
      "_seq": 2
    },
    {
      "type": "chat.event",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "type": "iteration.start",
        "iteration": 1,
        "tokensSoFar": 0,
        "timestamp": 1783816026823
      },
      "_rxAt": 1783816026823,
      "_seq": 3
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": "The user is asking me to introduce myself briefly."
      },
      "_rxAt": 1783816026916,
      "_seq": 4
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": " I should explain who I am (Helper) and what I can"
      },
      "_rxAt": 1783816026917,
      "_seq": 5
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": " do. Let me keep it concise and friendly as per "
      },
      "_rxAt": 1783816026917,
      "_seq": 6
    },
    {
      "type": "chat.response",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "content": null,
        "toolCount": 0,
        "timestamp": 1783816026924
      },
      "_rxAt": 1783816026925,
      "_seq": 7
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "done",
      "data": {
        "session": {
          "id": "sess_8b9160dd8bd44432",
          "agent_name": "helper",
          "mode": "chat",
          "instance_folder": "/home/ixi/khacloud/drive/Plugins/VeilCli/test/advanced-test-projects/bad-truncated-stream",
          "status": "active",
          "model": "moonshotai/kimi-k2.5",
          "title": null,
          "message_count": 2,
          "total_input_tokens": 0,
          "total_output_tokens": 0,
          "total_cache_tokens": 0,
          "context_size": 0,
          "context_size_limit": 262144,
          "cost": 0,
          "compaction_count": 0,
          "created_at": "2026-07-12T00:27:06.808Z",
          "updated_at": "2026-07-12T00:27:06.923Z",
          "model_thinking": null,
          "compact_summary": null,
          "compact_size": 0,
          "compact_count": 50,
          "compact_auto_threshold": null,
          "compact_enabled": 1,
          "compact_model": "default",
          "compact_custom_instructions": null,
          "temperature": null,
          "max_tokens": null,
          "reasoning": "{\"effort\":\"low\"}",
          "parent_session_id": null,
          "instance_name": null,
          "objective": null,
          "success_criteria": null,
          "token_budget": null,
          "max_wall_seconds": null,
          "max_spawn_depth": null,
          "spawn_depth": 0,
          "trace_id": "trace_ee94c766706a8ee7",
          "claude_session_id": null,
          "effort": null
        },
        "agentName": "helper",
        "model": "moonshotai/kimi-k2.5",
        "iterations": 1,
        "durationMs": 109,
        "tokenUsage": {
          "input": 0,
          "output": 0,
          "cache": 0,
          "cost": 0
        },
        "toolCalls": [],
        "cancelled": false
      },
      "_rxAt": 1783816026925,
      "_seq": 8
    },
    {
      "type": "chat.user_message",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "content": "Introduce yourself briefly — who are you and what can you do?",
        "timestamp": 1783816026935
      },
      "_rxAt": 1783816026935,
      "_seq": 9
    },
    {
      "type": "chat.event",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "type": "iteration.start",
        "iteration": 1,
        "tokensSoFar": 0,
        "timestamp": 1783816026936
      },
      "_rxAt": 1783816026937,
      "_seq": 10
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": "The user is asking me to introduce myself briefly."
      },
      "_rxAt": 1783816026950,
      "_seq": 11
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": " I should explain who I am (Helper) and what I can"
      },
      "_rxAt": 1783816026954,
      "_seq": 12
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": " do. Let me keep it concise and friendly as per "
      },
      "_rxAt": 1783816026959,
      "_seq": 13
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "thinking.chunk",
      "data": {
        "content": "my instructions."
      },
      "_rxAt": 1783816026964,
      "_seq": 14
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": "I'm **Helper**, a friendly"
      },
      "_rxAt": 1783816026967,
      "_seq": 15
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " AI assistant here to help"
      },
      "_rxAt": 1783816026973,
      "_seq": 16
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " you with a variety of tasks."
      },
      "_rxAt": 1783816026980,
      "_seq": 17
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": "\n\nI can:\n- **Answer questions**"
      },
      "_rxAt": 1783816026981,
      "_seq": 18
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " and explain concepts\n- "
      },
      "_rxAt": 1783816026986,
      "_seq": 19
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": "**Write and edit code** "
      },
      "_rxAt": 1783816026993,
      "_seq": 20
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": "in many languages\n- **Analyze"
      },
      "_rxAt": 1783816026995,
      "_seq": 21
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " files** and documents you"
      },
      "_rxAt": 1783816026999,
      "_seq": 22
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " share\n- **Search the web**"
      },
      "_rxAt": 1783816027003,
      "_seq": 23
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " for current information"
      },
      "_rxAt": 1783816027008,
      "_seq": 24
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": "\n- **Run shell commands**"
      },
      "_rxAt": 1783816027011,
      "_seq": 25
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " and manage files\n- **Spawn"
      },
      "_rxAt": 1783816027016,
      "_seq": 26
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " specialized sub-agents**"
      },
      "_rxAt": 1783816027020,
      "_seq": 27
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " for complex tasks\n\nJust"
      },
      "_rxAt": 1783816027025,
      "_seq": 28
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "inference.chunk",
      "data": {
        "content": " tell me what you need!"
      },
      "_rxAt": 1783816027029,
      "_seq": 29
    },
    {
      "type": "chat.message",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "id": 4,
        "session_id": "sess_8b9160dd8bd44432",
        "role": "assistant",
        "content": "I'm **Helper**, a friendly AI assistant here to help you with a variety of tasks.\n\nI can:\n- **Answer questions** and explain concepts\n- **Write and edit code** in many languages\n- **Analyze files** and documents you share\n- **Search the web** for current information\n- **Run shell commands** and manage files\n- **Spawn specialized sub-agents** for complex tasks\n\nJust tell me what you need!",
        "tool_calls": null,
        "tool_call_id": null,
        "thinking_content": "The user is asking me to introduce myself briefly. I should explain who I am (Helper) and what I can do. Let me keep it concise and friendly as per my instructions.",
        "thinking_tokens": 37,
        "created_at": "2026-07-12T00:27:07.034Z",
        "finishReason": "stop",
        "iteration": 1,
        "tokenUsage": {
          "input": 3382,
          "output": 128,
          "cache": 0,
          "cost": 0.0019574082
        },
        "timestamp": 1783816027034
      },
      "_rxAt": 1783816027034,
      "_seq": 30
    },
    {
      "type": "chat.response",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "event": {
        "content": "I'm **Helper**, a friendly AI assistant here to help you with a variety of tasks.\n\nI can:\n- **Answer questions** and explain concepts\n- **Write and edit code** in many languages\n- **Analyze files** and documents you share\n- **Search the web** for current information\n- **Run shell commands** and manage files\n- **Spawn specialized sub-agents** for complex tasks\n\nJust tell me what you need!",
        "toolCount": 0,
        "timestamp": 1783816027035
      },
      "_rxAt": 1783816027035,
      "_seq": 31
    },
    {
      "type": "session.stream",
      "sessionId": "sess_8b9160dd8bd44432",
      "agentName": "helper",
      "eventType": "done",
      "data": {
        "session": {
          "id": "sess_8b9160dd8bd44432",
          "agent_name": "helper",
          "mode": "chat",
          "instance_folder": "/home/ixi/khacloud/drive/Plugins/VeilCli/test/advanced-test-projects/bad-truncated-stream",
          "status": "active",
          "model": "moonshotai/kimi-k2.5",
          "title": null,
          "message_count": 4,
          "total_input_tokens": 3382,
          "total_output_tokens": 128,
          "total_cache_tokens": 0,
          "context_size": 3510,
          "context_size_limit": 262144,
          "cost": 0.0019574082,
          "compaction_count": 0,
          "created_at": "2026-07-12T00:27:06.808Z",
          "updated_at": "2026-07-12T00:27:07.034Z",
          "model_thinking": null,
          "compact_summary": null,
          "compact_size": 0,
          "compact_count": 50,
          "compact_auto_threshold": null,
          "compact_enabled": 1,
          "compact_model": "default",
          "compact_custom_instructions": null,
          "temperature": null,
          "max_tokens": null,
          "reasoning": "{\"effort\":\"low\"}",
          "parent_session_id": null,
          "instance_name": null,
          "objective": null,
          "success_criteria": null,
          "token_budget": null,
          "max_wall_seconds": null,
          "max_spawn_depth": null,
          "spawn_depth": 0,
          "trace_id": "trace_ee94c766706a8ee7",
          "claude_session_id": null,
          "effort": null
        },
        "agentName": "helper",
        "model": "moonshotai/kimi-k2.5",
        "iterations": 1,
        "durationMs": 100,
        "tokenUsage": {
          "input": 3382,
          "output": 128,
          "cache": 0,
          "cost": 0.0019574082
        },
        "toolCalls": [],
        "cancelled": false
      },
      "_rxAt": 1783816027035,
      "_seq": 32
    }
  ]
}