Installs into .claude/skills of the current project.
Are you the author of 2931 Fix Log Service Critical 394dc938?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-2931-fix-log-service-critical-394dc938)
# Critical Fix - LogService Missing is_stream Field
## Problem Found ✅
You were absolutely correct! The database had `is_stream` correctly stored, but the **API was returning `false` for all requests**.
### Root Cause
The `LogService.query()` method (at `backend/app/services/log_service.py`) was manually constructing `RequestLogResponse` objects from `RequestLogModel` objects, but it was **missing the `is_stream` field in the mapping**.
### The Bug
```python
# In LogService.query() - line 84-100
responses = [
RequestLogResponse(
id=log.id,
request_time=log.request_time,
# ... all other fields ...
trace_id=log.trace_id,
# ❌ is_stream=log.is_stream, <-- THIS WAS MISSING!
)
for log in logs
]
```
Because `is_stream` wasn't explicitly passed, Pydantic used the default value from `RequestLogResponse` which is `False`.
### The Fix
Added the missing line:
```python
responses = [
RequestLogResponse(
id=log.id,
# ... all other fields ...
trace_id=log.trace_id,
is_stream=log.is_stream, # ✅ ADDED THIS LINE
)
for log in logs
]
```
## Complete Data Flow - Now Fixed ✅
1. ✅ **Request comes in** → `app/api/proxy/openai.py` detects `stream=true`
2. ✅ **Proxy service** → Sets `is_stream=True` in log data
3. ✅ **Repository writes** → Saves to database with `is_stream=1`
4. ✅ **Repository reads** → Retrieves `is_stream` from database
5. ✅ **Service returns** → **NOW INCLUDES `is_stream` in API response** ← **THIS WAS BROKEN**
6. ✅ **Frontend displays** → Shows wave icon based on `is_stream` value
## Files Modified (All Commits)
### Commit 1: Core Implementation
- `backend/app/db/models.py` - Database schema
- `backend/app/domain/log.py` - Domain models
- `backend/app/services/proxy_service.py` - Set is_stream flag
- `frontend/src/types/log.ts` - Frontend types
- `frontend/src/components/logs/LogList.tsx` - UI display
- `backend/migrations/` - Migration scripts
### Commit 2: Repository Fix
- `backend/app/repositories/sqlalchemy/log_repo.py` - Read/write is_stream
### Commit 3: Documentation
- `TROUBLESHOOTING_STREAM_DISPLAY.md`
- `STREAM_FEATURE_COMPLETE.md`
- `backend/check_migration.py`
### Commit 4: Service Layer Fix (CRITICAL)
- `backend/app/services/log_service.py` - **Include is_stream in API response**
## Testing After Fix
After restarting the backend, the API should now return:
```json
{
"items": [
{
"id": 123,
"is_stream": true, // ← Now correctly reflects database value!
"request_time": "...",
...
}
]
}
```
## Why This Was Hard to Find
The bug was subtle because:
1. ✅ Database was storing correctly
2. ✅ Repository was reading correctly
3. ❌ **Service layer was dropping the field when converting to response**
4. ✅ Frontend was working correctly (just displaying what API returned)
The service layer was manually mapping fields instead of using `.model_dump()` or `**log.dict()`, so the new field needed to be explicitly added to the mapping.
## Action Required
**Restart the backend** and the stream display should work immediately!
No database migration needed if you already have the `is_stream` column - the data is already there, it just wasn't being returned by the API.