Skip to content

[PR] fix(logger): stamp ALL bili.log writers in local time (#4535) - #4798

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-26_4535-log-local-time-complete
Oct 26, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-26_4535-log-local-time-complete

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

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:

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).

yanhuojiyusheng and others added 2 commits October 26, 2026 10:52
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.
@ranxianglei ranxianglei changed the title fix(logger): stamp ALL bili.log writers in local time (#4535) [PR] fix(logger): stamp ALL bili.log writers in local time (#4535) Oct 26, 2026
@ranxianglei
ranxianglei merged commit e22a57b into master Oct 26, 2026
25 checks passed
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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 上均还在排队,结果出来后给结构化八问结论。

@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.849-master.e22a57b (rolling master tag).

npm install -g billion-context@0.0.849-master.e22a57b  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_4535-log-local-time-complete (775ab62)

Latest build — install this exact version

npm install -g billion-context@0.0.6035-pr.4798.76b6252

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
775ab62 billion-context@0.0.6035-pr.4798.76b6252 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4798.tgz
npm install -g package

Install instructions are refreshed on each push.

ranxianglei pushed a commit that referenced this pull request Oct 26, 2026
…mestamp swap inside the #4762 EADDRINUSE diag block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p3 scope/other

Projects

None yet

2 participants