Skip to content

fix(web): 登录后将浏览器时区同步到用户资料 - #1161

Open
qqqqqf-q wants to merge 2 commits into
felinics:mainfrom
qqqqqf-q:codex/login-browser-timezone
Open

fix(web): 登录后将浏览器时区同步到用户资料#1161
qqqqqf-q wants to merge 2 commits into
felinics:mainfrom
qqqqqf-q:codex/login-browser-timezone

Conversation

@qqqqqf-q

@qqqqqf-q qqqqqf-q commented Sep 5, 2026

Copy link
Copy Markdown
Member

登录成功后,Web 读取浏览器的 IANA 时区,通过现有 PUT /users/me 更新用户资料,并更新本地用户状态,解决浏览器时区没有传到后端的问题。

  • 同步发生在新 token 生效后;浏览器时区与账户一致或无法读取时跳过。
  • 同步请求使用 3 秒 AbortSignal 超时;失败或超时单独提示,不把成功登录变成凭据错误,仍进入首页,避免请求悬挂阻塞导航。
  • 每次显式登录同步;普通页面刷新不重复提交。没有新增后端设置、字段或迁移,也不做历史用户补偿。登录时会用浏览器时区更新不同的账户时区。
  • 仅修改 OSS 登录入口的三个文件;Cloud 登录入口不在本 PR 范围内。

验证:8 个登录测试、相关 ESLint、UI contract 和 diff 检查通过。Chromium 使用真实本地 OSS 后端验证:模拟 Asia/Tokyo 登录后资料写回并在刷新后保留;改回 Asia/Singapore 后刷新不覆盖;拦截时区 PUT 使其不返回,约 3.4 秒后仍进入应用。测试账号时区已恢复 Asia/Singapore。此前 mock API 检查确认请求携带新 token。本次超时修复未新增测试代码。

全量提交钩子未通过:go test ./... 在未修改的 internal/agent/application 出现 TestIdleTimeoutToolCallRearmsCurrentWindowTestDirectChatMintsRunAndPersistsCompletedLifecycleAfterAssistant 超时相关失败。约十分钟后停止剩余全量 Go 测试与 Go lint(lint 未完成),保留前端检查结果,以 HUSKY=0 提交,未修改测试断言或校验规则。

Fixes #1148

⚠️ No human QA — this PR has not been verified by a human yet. Remove this line once a human confirms the happy path.

@qqqqqf-q
qqqqqf-q requested a review from a team as a code owner September 5, 2026 12:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-05T12:12:58.349443Z caad469 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: caad469419

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

timezone: data.timezone ?? 'UTC',
}, data.access_token)

await syncBrowserTimezone(data.timezone ?? 'UTC', dependencies)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not block login on timezone synchronization

When authentication succeeds and the browser timezone differs, this awaits the profile update before navigating. The generated client uses an unbounded fetch, so a request that stalls rather than rejects leaves the form busy and the user stuck on the login page even though the fresh token has already been stored; the error handler never runs. Run this best-effort sync without blocking navigation or give it a bounded timeout.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

时区默认 UTC,未跟随用户本地时区

1 participant