Repository navigation
[PR] fix(logger): stamp ALL bili.log writers in local time (#4535) - #4798
Conversation
bili.log 每行都用 `new Date().toISOString()` 打戳:永远是 UTC 并以 Z 结尾, 而系统时钟(`date` / timedatectl)给的是本地时间。排查时两者差着整个时区 偏移(本机 CST 是 8 小时),日志里刚发生的事件看起来像是几小时前,必须 手工换算才能和终端、浏览器、宿主日志对齐。 - `logTimestamp()` 输出本地墙上时间 `YYYY-MM-DDTHH:mm:ss.SSS`(无后缀), 与 `date` 逐字对齐;两处打戳点(file+stderr 与降级 warn)统一走它; - 读侧兼容:该格式没有时区标记,历史日志里全是 `Z` 结尾,`logs-query` 的 时间窗过滤与 `acp-cache-diff` 的 usage 行解析都放宽为"时区段可选", 同一文件里新旧两种戳都能解析(裸戳按本地时间解释); - 测试:格式与本地字段、`Date.parse` 回环、新旧混合时间窗、usage 行解析。 验证:定向 suite 49/49、`npm run typecheck`、`npm run build`(dist 导入与 外部依赖检查 OK);时区矩阵(Shanghai/UTC/New_York/Kathmandu +05:45/ St_Johns -02:30)日志与 `date` 同刻;真实 `dist` 起代理在隔离 XDG 下三个 时区 e2e,日志文件时间与系统时间一致。全量回归以远程 CI 为准。
Followup to the author's log-local-time change: host-log (logHostEvent), server writeSpawnPortLog and the launcher debug stderr lane keep writing UTC 'Z' stamps into the same bili.log, leaving adjacent lines 8h apart with no marker — the file was internally inconsistent for incident grepping. Unified all writers on logTimestamp(); updated the five pinned Z assertions; added the mixed-generation window test (legacy-Z + bare rows in one file) from the reviewed followup branch b64e160.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 这是 #4535 的完成 PR,PR 描述已声明 Supersedes #4537(#4537 的 head 缺 host-log / writeSpawnPortLog / launcher debug stderr 三个写者,且 fork 分支不可维护者编辑,完成版落在本 PR)。无其他在途同机制条目。 标签: bug + scope/other + p3(日志格式一致性问题——同一 bili.log 内 UTC Z 与本地时间戳混排,属诊断体验缺陷;日志写读面跨车道共享,不打客户端标;p3 因不影响任何功能路径)。 状态: 正在按 PR review 规范独立审核(不照抄 PR 描述结论)——已核完 diff 全量(9 文件,+90/−21)、全部 bili.log 写者清点、两个时间戳读取方的解析语义;CI 在 PR head 与 master head 上均还在排队,结果出来后给结构化八问结论。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.849-master.e22a57b # this exact build
npm install -g billion-context@master # always the newest merged build
|
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6035-pr.4798.76b6252This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4798.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Completes #4537 (author: @yanhuojiyusheng — original change + rebased head) with the reviewed followup branch b64e160.
Why: PR #4537's head stamps logger.ts + the two readers in local time, but host-log (logHostEvent), server writeSpawnPortLog and the launcher debug stderr lane keep writing UTC Z stamps into the SAME bili.log — adjacent lines 8h apart with no marker, internally inconsistent for incident grepping.
This PR = the author's head 63fcf8d cherry-picked + the followup applied:
proxyEnvOrigin()把临时 origin 冻结进 BILLION_CONTEXT_PROXY,绕过 ensureProxyRunning() 的 instance 验活;工具调用全部 fetch failed,需重启宿主 #983/方式一安装的dsh 原生插件:llm-pi-ai 传输(OpenAI SDK + options.fetch 注入)绕过 globalThis.fetch 拦截,模型请求不进代理、压缩完全不生效 #1158/persistClientEvent, launcher [Pi native][启动日志] 正常的 native-attach 候选跳过信息不应默认输出到用户终端 #3200/[Bug][Pi native/TUI] Attach startup banner pollutes the Pi input area after herdr session restore | [Bug][Pi native/TUI] herdr 恢复会话后 attaching 启动提示污染输入区(剩余启动 banner) #3404)Verified locally: logger-local-time 4/4, launcher #3200/#3404 7/7, persistClientEvent 1/1, tsc clean. (The local #983 attach-timeout failures reproduce identically on a master-equivalent control worktree — machine-environment, not this diff; GitHub CI runs them green.)
Closes #4535. Supersedes #4537 (its head lacks the 4 remaining writers; fork branch is not maintainer-editable so the completion lands here with full credit).