[Bug] 侧边栏空会话("新任务"占位条目)相对时间显示为 20691 天(时间戳回退到 Unix 纪元零点)
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
提交前确认 · Pre-submission checklist
- 我已搜索过现有 issue,确认这不是重复 / I searched existing issues and confirmed this isn't a duplicate.
- 我已阅读 CONTRIBUTING.md
问题类别 · Category
UI / 界面体验 · UI / UX
涉及的 Agent 框架 · Agent framework
ZCode Agent(自研)
严重程度 · Severity
轻微 · Minor(小问题不影响主流程 / minor, no impact on main flow)
复现频率 · Reproducibility
必现 · Always
问题描述 · Description
侧边栏会话列表中,点击"新建任务"后从未发送任何消息的空会话条目,显示默认占位标题"新任务",其右侧相对时间显示为 "20691天"。
20691 天恰好等于 1970-01-01(Unix 纪元零点)到 2026-08-26 的天数,且该数字每天 +1 随日期增长。说明空会话的时间戳为 0 或未初始化,相对时间计算时回退到了纪元零点。
复现步骤 · Steps to reproduce
- 打开 ZCode 桌面版(Windows)
- 侧边栏点击"新建任务"
- 不发送任何消息,保持空会话存在
- 观察侧边栏列表顶部的占位条目 → 右侧时间显示"20691天"(数值 = 当天日期距 1970-01-01 的天数)
期望表现 · Expected behavior
空会话占位条目的时间应显示"—"或"刚刚",或以实际创建时间为准,不应回退到 1970-01-01。
实际表现 · Actual behavior
显示"20691天"(2026-08-26 观测值),并随日期每天自动 +1。同列表中正常会话(如刚更新 21 分钟的会话)时间显示均正常。
补充证据 · Additional evidence
- 数学验证:1970-01-01 → 2026-08-26 = 56 年 × 365 天 + 14 个闰日 + 237 天 = 20691 天,与显示值完全一致
- 数据库验证:
%ZCODE_DATA%\.zcode\v2\tasks-index.sqlite的tasks表中不存在标题为"新任务"、空标题或created_at=0的记录——即这些空会话尚未落库,是前端占位态,时间戳未初始化 - 推测修复点:渲染相对时间前对
timestamp == null || timestamp === 0做保护即可
ZCode 版本 · ZCode version
3.9.1.5853
设备 / 系统 / 浏览器 · Device / OS / Browser
Windows 台式机 / Windows 11 (10.0.26200) x64 / 桌面版
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction steps in issue #371 and review CONTRIBUTING.md. Inspect the desktop frontend path that renders relative time for the unsaved “新任务” placeholder, using %ZCODE_DATA%.zcode\v2\tasks-index.sqlite to confirm it has no persisted task record. Done means an empty session shows “—”, “刚刚”, or its actual creation time instead of a Unix-epoch-derived value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100