fix: add PYTHONUNBUFFERED=1 for real-time logging
- Python buffers stdout when running as systemd service (no TTY)
- This prevented journalctl from showing real-time turn captures
- Added Environment='PYTHONUNBUFFERED=1' to disable buffering
- Now shows '✅ Turn N (role) → Qdrant' in real-time via journalctl -f
Fixes issue where watcher captured turns but only logged on restart.
This commit is contained in:
30
CHANGELOG.md
30
CHANGELOG.md
@@ -2,6 +2,36 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [v1.4] - 2026-03-13
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
#### Real-Time Logging Not Visible in journalctl
|
||||||
|
|
||||||
|
**Error:** Watcher was capturing turns to Qdrant but `journalctl -u mem-qdrant-watcher -f` showed no output between restarts.
|
||||||
|
|
||||||
|
**Root Cause:**
|
||||||
|
- Python buffers stdout when not connected to a TTY (systemd service)
|
||||||
|
- `print()` statements in the watcher were buffered, not flushed
|
||||||
|
- Logs only appeared on service restart when buffer was flushed
|
||||||
|
|
||||||
|
**Impact:** Impossible to monitor real-time capture status, difficult to debug
|
||||||
|
|
||||||
|
**Fix:**
|
||||||
|
- Added `Environment="PYTHONUNBUFFERED=1"` to systemd service file
|
||||||
|
- This disables Python's stdout buffering, forcing immediate flush
|
||||||
|
|
||||||
|
**Changed Files:**
|
||||||
|
- `watcher/mem-qdrant-watcher.service` - Added PYTHONUNBUFFERED environment variable
|
||||||
|
|
||||||
|
**Validation:**
|
||||||
|
```bash
|
||||||
|
journalctl -u mem-qdrant-watcher -f
|
||||||
|
# Now shows: ✅ Turn 170 (assistant) → Qdrant (in real-time)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [v1.3] - 2026-03-10
|
## [v1.3] - 2026-03-10
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ Environment="QDRANT_COLLECTION=memories_tr"
|
|||||||
Environment="OLLAMA_URL=http://localhost:11434"
|
Environment="OLLAMA_URL=http://localhost:11434"
|
||||||
Environment="EMBEDDING_MODEL=snowflake-arctic-embed2"
|
Environment="EMBEDDING_MODEL=snowflake-arctic-embed2"
|
||||||
Environment="USER_ID=rob"
|
Environment="USER_ID=rob"
|
||||||
|
Environment="PYTHONUNBUFFERED=1"
|
||||||
ExecStart=/usr/bin/python3 /root/.openclaw/workspace/.local_projects/openclaw-true-recall-base/watcher/realtime_qdrant_watcher.py --daemon
|
ExecStart=/usr/bin/python3 /root/.openclaw/workspace/.local_projects/openclaw-true-recall-base/watcher/realtime_qdrant_watcher.py --daemon
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|||||||
Reference in New Issue
Block a user