* fix(mcp): keep OAuth token expiry independent of the process time zone
mcp_oauth_tokens.expires_at is a naive TIMESTAMP column. The token store
computes the expiry from the process clock, the column drops its offset,
and the driver reads the stored wall clock back as UTC. When the
application runs outside UTC, every stored expiry is therefore shifted
by the process offset: with TZ=Asia/Shanghai, the docker compose default,
a token is reported as expiring eight hours after it really does.
WeKnora trusts that value. The OAuth status endpoint reports a token as
authorized for those extra hours, and the runtime neither refreshes it
ahead of time nor asks for authorization again. It sends the expired
access token to the MCP server and only recovers after the server
rejects it.
Promote the token and client timestamps to TIMESTAMP WITH TIME ZONE, as
migration 000072 did for API keys and resource grants, and normalize the
values the repository writes to UTC, so new rows are right even before
the migration is applied. The status endpoint keeps reporting the expiry
in UTC as before: the driver returns timestamptz values in the process
time zone, and the response would otherwise vary by deployment.
The migration cannot repair existing rows, because the time zone of the
process that wrote them is unknown. Like 000072, it reads them as UTC,
so they keep their shifted value until the token is authorized or
refreshed again.
* fix(migrations): renumber MCP OAuth timestamptz migration to 000118
000117 is now taken on main by messages_attachment_lookup.
---------
Co-authored-by: wizardchen <wizardchen@tencent.com>