agentscope-ai / agentscope-ai/QwenPaw

[Bug]: Vector store timestamp inconsistency — MemoryNode uses naive datetime while collection metadata uses UTC

Abierto
#4,710 2 comentarios 0 reacciones 1 asignado Reclamado por @jinliyl Ver en GitHub
bug
Lenguaje dominante
Python
Estrellas
34.9k
Forks
3.1k
Merge medio
1 d 15 h
PR fusionados (30 d)
225

Descripción

## QwenPaw Version

`1.1.8.post1` (commit `68cd42d2`)

## Description

`MemoryNode.get_now_time()` in the `reme` package uses `datetime.datetime.now()` which returns a **naive datetime** (no timezone info) in the system's local time. However, collection/dataset-level metadata in the vector store uses UTC timestamps. This causes an 8-hour discrepancy in regions using UTC+8 (e.g., Asia/Shanghai).

The mismatch means:
- Individual memory node timestamps (`time_created`, `time_modified`) are in local time (e.g., `2026-05-26 14:30:00`)
- Collection-level metadata (creation time, update time) are in UTC (e.g., `2026-05-26 06:30:00`)
- Queries or displays that mix both levels show inconsistent times

## Component(s) Affected

- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [ ] Channels (DingTalk, Feishu, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [ ] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy

## Environment

- **QwenPaw version:** `1.1.8.post1`
- **OS:** Windows 11 (AMD64, timezone: Asia/Shanghai, UTC+8)
- **Install method:** from source
- **Python version:** 3.12

## Steps to Reproduce

1. Configure QwenPaw with timezone `Asia/Shanghai` (UTC+8)
2. Interact with the Agent to trigger memory storage (vector DB write)
3. Compare timestamps at the memory node level vs. collection/dataset level
4. Observe ~8 hour difference between the two

## Actual vs Expected

- **Actual:** `MemoryNode.time_created` uses local time (e.g., `2026-05-26 14:30:00`) while collection metadata uses UTC (e.g., `2026-05-26 06:30:00`)
- **Expected:** All timestamps should use the same timezone base, preferably timezone-aware datetimes or consistently UTC.

## Logs / Screenshots

**Affected code** (`reme/core/schema/memory_node.py:17-23`):

```python
def get_now_time() -> str:
"""Get current timestamp in YYYY-MM-DD HH:MM:SS format."""
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
```

`datetime.datetime.now()` returns a naive datetime in the system's local time. If QwenPaw is configured for `Asia/Shanghai`, but the vector store backend (e.g., ChromaDB) uses UTC for collection metadata, the two timestamps diverge by the UTC offset.

## Additional Notes

This affects users in non-UTC timezones. Users in UTC timezone (offset 0) would not observe this issue.

The fix would need to be in the `reme` package (dependency), not in QwenPaw core. Suggested approaches:
- Use `datetime.datetime.now(datetime.timezone.utc)` and store all timestamps in UTC
- Or make `get_now_time()` accept a timezone parameter

(These are suggestions for maintainers to evaluate, not prescribed solutions.)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.