-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
[Bug]: Feishu embedded agent returns HTTP 401 "Invalid token" to user instead of retrying with refreshed token #56197
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Feishu embedded agent returns raw HTTP 401 "Invalid token" error to user instead of retrying with refreshed token
Steps to reproduce
1.Configure Feishu as a messaging channel with model routing through AutoGLM proxy (zai provider)
2.Wait for the model API's JWT token to expire (or start a new session when the token is near expiry)
3.Send any message from the Feishu client
4.The bot replies with "HTTP 401: Invalid token"
Expected behavior
The embedded agent should detect the 401, trigger a token refresh, and retry the request. At minimum, it should not surface the raw HTTP error message to the end user.
Actual behavior
The 401 error is passed directly as the reply text to the Feishu user. Logs show the token refresh (config reload) occurs after the error has already been returned. The webchat session recovers after refresh, but the Feishu embedded agent continues to fail intermittently on subsequent requests.
[feishu] received message from ou_cb34... (p2p)
[feishu] dispatching to agent (session=agent:main:feishu:direct:ou_cb34...)
[pi-ai] request POST .../chat/completions status=401
[agent/embedded] embedded run agent end: isError=true error=HTTP 401: "Invalid token"
[feishu] dispatch complete (queuedFinal=true, replies=1)
[reload] config change detected; evaluating reload (models.providers.zai.models)
[reload] config change applied
OpenClaw version
2026.2.25
Operating system
Windows 10 (x64)
Install method
No response
Model
pony-alpha-2 (GLM-5-Turbo)
Provider / routing chain
zai → autoglm-api.zhipuai.cn/autoclaw-proxy/proxy/autoclaw
Additional provider/model setup details
No response
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response