Repository navigation
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.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.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.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.
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
标题
Feishu plugin: token invalid error (99991663) does not trigger automatic retry — requires manual gateway restart
问题描述 (Bug Description)
When the Feishu plugin's tenant_access_token becomes invalid (e.g. expires, clock drift, or server-side revocation), the plugin cannot send messages. Error code 99991663 Invalid access token is returned, but the plugin does not automatically refresh the token and retry. Users must manually run openclaw channels login + openclaw gateway restart to recover.
现象 (Symptoms)
- Feishu WebSocket long connection remains active (message receiving works)
- All outgoing messages fail with
feishu[boob] final reply failedand99991663 Invalid access token - Automatic recovery does not happen; manual intervention is required
根本原因 (Root Cause)
- The plugin caches
tenant_access_tokenin atokenCacheMap with anexpiresAttimestamp getToken()has a proactive refresh mechanism (refreshes 60 seconds before expiry)- However, when the cached token becomes invalid unexpectedly (clock drift between VM and host, Feishu server-side revocation, etc.), there is no passive retry mechanism
requestFeishuApi()only retries on rate-limit errors (429, 11232, 230020). Error code99991663is not handled → thrown immediately
影响范围 (Affected Versions)
- OpenClaw 2026.6.10
- Feishu plugin 2026.6.10
- Likely all versions using the same token-caching pattern
修复建议 (Proposed Fix)
In requestFeishuApi(), add handling for token-invalid errors:
- Detect error codes
99991663and99991664 - Call a token-cache invalidation function (clears the cached token)
- Retry the request once (next call to
getToken()will fetch a fresh token)
function isTokenInvalidError(error) {
const code = error?.response?.data?.code;
return code === 99991663 || code === 99991664;
}
async function requestFeishuApi(request, errorPrefix, options = {}) {
// ... existing retry loop ...
catch (error) {
const isRateLimit = getFeishuSendRateLimitCode(error) !== void 0;
const isTokenInvalid = isTokenInvalidError(error);
if (isTokenInvalid && attempt === 0) {
lastTokenInvalidError = error;
__invalidateTokenCache(); // clear cached token
continue; // retry once
}
if (!(attempt < FEISHU_SEND_MAX_RETRIES && isRateLimit)) {
throw createFeishuApiError(error, errorPrefix, options);
}
}
}
### Steps to reproduce
---
## 复现步骤 (Steps to Reproduce)
1. Deploy OpenClaw on a VM with clock drift (VM clock behind real time)
2. Wait for the Feishu `tenant_access_token` to expire (~2 hours)
3. Send a message via Feishu
4. Message fails with `99991663 Invalid access token`
5. No auto-recovery occurs
### Expected behavior
The Feishu plugin should automatically refresh the invalid token and retry sending the message when error code 99991663 (Invalid access token) is received. No manual intervention (channels login + gateway restart) should be required.
### Actual behavior
When the cached tenant_access_token becomes invalid, all outgoing messages fail with error code 99991663 Invalid access token. The plugin does not automatically refresh the token. Manual intervention via 'openclaw channels login' and 'openclaw gateway restart' is required to recover.
### OpenClaw version
OpenClaw 2026.6.10 (aa69b12)
### Operating system
Ubuntu 24.4
### Install method
_No response_
### Model
MiniMax2.7
### Provider / routing chain
openclaw- minimax-token-plan
### Additional provider/model setup details
_No response_
### Logs, screenshots, and evidence
```shellImpact and severity
No response
Additional information
No response
Reacted by clawsweeper
Reacted by clawsweeper
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.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.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.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
Priority
None yet
Activity
clawsweeper commentedon Jun 27, 2026
Codex review: this still needs some work.
Summary
Current main still lacks rejected-token recovery, and an open maintainer-owned closing PR owns the repair.
Reproducibility: Current CardKit source proves that a still-unexpired rejected token remains cached and subsequent operations can reuse it without recovery; no live Feishu reproduction was run.
Root-cause cluster
Relationship:
canonicalCanonical: #97287
Summary: This issue remains the canonical rejected-token recovery report, with an open maintainer-owned candidate repair.
Members:
fixed_by_candidate: fix(feishu): recover invalid tenant tokens #122193 - The open draft PR explicitly closes this issue and addresses both SDK and CardKit token recovery.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
Resolve conflicts and complete the authenticated SDK/CardKit recovery proof for #122193 before landing it.
Review details
Best possible solution:
Land the existing repair after conflict resolution and authenticated proof establish bounded recovery at both token owners.
Do we have a high-confidence way to reproduce the issue?
Current CardKit source proves that a still-unexpired rejected token remains cached and subsequent operations can reuse it without recovery; no live Feishu reproduction was run.
Is this the best way to solve the issue?
Recovery belongs at the SDK and CardKit token owners, as the existing PR proposes, rather than clearing an unrelated global cache in the message retry wrapper.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against 5d36e6431693.
Label changes
Label changes:
No label changes.
Label justifications:
P1: Rejected cached credentials can interrupt an established Feishu reply workflow until scheduled refresh or manual recovery.impact:message-loss: Outgoing replies and streaming-card writes can fail while inbound connectivity remains healthy.impact:auth-provider: The failure concerns recovery from invalid cached tenant access tokens.Evidence reviewed
What I checked:
extensions/feishu/src/streaming-card.ts:107, 5d36e6431693)extensions/feishu/src/comment-shared.ts:116, 5d36e6431693)extensions/feishu/src/client.ts:420, 5d36e6431693)extensions/feishu/src/streaming-card.ts, 65be9ccf63f3)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 8, 2026, 2:08 PM ET / 19:08 UTC.
62 remaining items