fix(feishu): cache probeFeishu() results with 10-min TTL to reduce API calls#28907
fix(feishu): cache probeFeishu() results with 10-min TTL to reduce API calls#28907Takhoffman merged 3 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryAdded in-memory caching to Key changes:
Implementation notes:
Confidence Score: 5/5
Last reviewed commit: 0daca23 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0daca238df
ℹ️ 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".
extensions/feishu/src/probe.ts
Outdated
| } | ||
|
|
||
| // Return cached result if still valid | ||
| const cacheKey = creds.appId; |
There was a problem hiding this comment.
Include account identity in Feishu probe cache key
probeFeishu caches by appId only, so two accounts that share an appId but have different appSecret/domain can reuse the same cached success result. In that case, a healthy account can mask a misconfigured one (for example after secret rotation), because the second probe returns cached ok: true without making an API call, causing status/health checks to report a false positive for that account. The cache key should include the full credential context (or account ID) to prevent cross-account cache pollution.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aac96d8e63
ℹ️ 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".
| // Use accountId when available; otherwise include appSecret prefix so two | ||
| // accounts sharing the same appId (e.g. after secret rotation) don't | ||
| // pollute each other's cache entry. | ||
| const cacheKey = creds.accountId ?? `${creds.appId}:${creds.appSecret.slice(0, 8)}`; |
There was a problem hiding this comment.
Include credential fingerprint in account-scoped probe key
Using accountId alone as the cache key means a successful probe is reused even after that account’s appId, appSecret, or domain is changed, so status checks can report ok: true for up to 10 minutes against now-invalid credentials (for example right after secret rotation or a bad config edit). This regresses probe correctness for the most common call path where probeFeishu receives a resolved account object with accountId set.
Useful? React with 👍 / 👎.
|
You have reached your Codex rate limits. Please try again later. |
7fce831 to
b4c97d1
Compare
|
PR #28907 - fix(feishu): cache probeFeishu() results with 10-min TTL to reduce API calls (#28907) Merged via squash.
Thanks @Glucksberg! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4c97d1939
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| // Use accountId when available; otherwise include appSecret prefix so two | ||
| // accounts sharing the same appId (e.g. after secret rotation) don't | ||
| // pollute each other's cache entry. | ||
| const cacheKey = creds.accountId ?? `${creds.appId}:${creds.appSecret.slice(0, 8)}`; |
There was a problem hiding this comment.
Include credential fingerprint in account cache key
When accountId is present, probeFeishu keys the cache only by that ID, so a successful probe is reused even after that account’s appId/appSecret/domain changes; this can report ok: true for up to 10 minutes after a secret rotation or domain misconfiguration while real API calls are already failing. This is especially impactful because status probing passes resolved account objects into probeFeishu, so the stale-hit path is the common runtime path rather than an edge case.
Useful? React with 👍 / 👎.
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 98b8afa)
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 98b8afa)
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 98b8afa)
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 60ef923) # Conflicts: # CHANGELOG.md
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> (cherry picked from commit 60ef923) # Conflicts: # CHANGELOG.md # extensions/feishu/src/probe.ts
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…I calls (openclaw#28907) thanks @Glucksberg Verified: - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: Glucksberg <80581902+Glucksberg@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
/open-apis/bot/v3/infoendpoint is called every minute by Gateway health check. This results in ~43,200 API calls/month, exceeding Feishu's free tier (50,000). #26684Test plan
🤖 Generated with Claude Code