演示真实运行记录 · claude-opus-5-5 · 2026年10月
Write a commit message for this staged diff:
```diff
--- a/src/auth/session.py
+++ b/src/auth/session.py
@@ -8,9 +8,15 @@ SESSION_TTL = timedelta(hours=12)
def is_session_valid(session) -> bool:
- return session.created_at + SESSION_TTL > datetime.now()
+ # created_at is stored in UTC; naive local now() made sessions expire
+ # early or late depending on the server's timezone.
+ return session.created_at + SESSION_TTL > datetime.now(timezone.utc)
--- a/tests/test_session.py
+++ b/tests/test_session.py
@@ -20,3 +20,12 @@ def test_session_expires_after_ttl():
assert not is_session_valid(old)
+
+
+def test_session_valid_on_non_utc_server(monkeypatch):
+ monkeypatch.setenv("TZ", "Asia/Shanghai")
+ time.tzset()
+ fresh = make_session(created_at=datetime.now(timezone.utc))
+ assert is_session_valid(fresh)
```
Users on our Singapore and Shanghai servers were being logged out about 8 hours early. This fixes issue #214.
Skill: caveman-commit
fix(auth): compare session expiry against UTC now
created_at is stored in UTC, but expiry was checked against naive
local datetime.now(). On UTC+8 servers (Singapore, Shanghai) users
were logged out ~8 hours early.
Closes #214
The diff doesn't show any import changes, so check two things before you commit:
session.pyneedstimezoneimported fromdatetime.- The test file needs
timeandtimezoneimported.
created_at also has to be timezone-aware. If it's ever stored as a naive datetime, comparing it with datetime.now(timezone.utc) will raise a TypeError.
Real run recorded with claude-code / claude-opus-5-5. Output is shown verbatim, unmodified.
它做什么
按 Conventional Commits 格式为你的改动写提交信息:<类型>(<范围>): <祈使句摘要>,最好不超过 50 个字符,最多 72 个。
工作方式
- 说 "write a commit"、"commit message",或输入 /commit、/caveman-commit 时触发。
- 只有原因不明显时才写正文;破坏性变更、安全修复、数据迁移和回滚则一定写正文。
- 不写"本次提交做了……"、表情符号和 AI 署名行;除非你自己的规则要求加署名 trailer。
适合场景
让 git 历史简短、统一,方便以后排查问题的人看懂。
需要了解
它只以代码块输出提交信息,不会暂存文件、提交或修改上一次提交。
说明与风险
纯指令文件:没有脚本、不联网、不写文件。 压缩包里另有原仓库的 README、LICENSE 和 NOTICE。 它不会执行任何 git 命令。
SKILL.md 原文包内共 4 个文件