惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
Check Point Blog
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
博客园_首页
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
T
The Blog of Author Tim Ferriss
The Cloudflare Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(bedrock): bound discovery cache expiry · openclaw/ope...
steipete · 2026-05-31 · via Recent Commits to openclaw:main

File tree

  • extensions/amazon-bedrock

Original file line numberDiff line numberDiff line change

@@ -256,6 +256,28 @@ describe("bedrock discovery", () => {

256256

expect(sendMock).toHaveBeenCalledTimes(2);

257257

});

258258
259+

it("skips cache when refreshInterval expiry overflows", async () => {

260+

sendMock

261+

.mockResolvedValueOnce({ modelSummaries: [baseActiveAnthropicSummary] })

262+

.mockResolvedValueOnce({ inferenceProfileSummaries: [] })

263+

.mockResolvedValueOnce({ modelSummaries: [baseActiveAnthropicSummary] })

264+

.mockResolvedValueOnce({ inferenceProfileSummaries: [] });

265+
266+

await discoverBedrockModels({

267+

region: "us-east-1",

268+

config: { refreshInterval: 1 },

269+

now: () => 8_640_000_000_000_000,

270+

clientFactory,

271+

});

272+

await discoverBedrockModels({

273+

region: "us-east-1",

274+

config: { refreshInterval: 1 },

275+

now: () => 8_640_000_000_000_000,

276+

clientFactory,

277+

});

278+

expect(sendMock).toHaveBeenCalledTimes(4);

279+

});

280+
259281

it("skips cache when refreshInterval is 0", async () => {

260282

sendMock

261283

.mockResolvedValueOnce({ modelSummaries: [baseActiveAnthropicSummary] })

Original file line numberDiff line numberDiff line change

@@ -5,6 +5,10 @@ import {

55

} from "@aws-sdk/client-bedrock";

66

import { createSubsystemLogger } from "openclaw/plugin-sdk/core";

77

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

8+

import {

9+

isFutureDateTimestampMs,

10+

resolveExpiresAtMsFromDurationSeconds,

11+

} from "openclaw/plugin-sdk/number-runtime";

812

import type {

913

BedrockDiscoveryConfig,

1014

ModelDefinitionConfig,

@@ -503,11 +507,16 @@ export async function discoverBedrockModels(params: {

503507
504508

if (refreshIntervalSeconds > 0) {

505509

const cached = discoveryCache.get(cacheKey);

506-

if (cached?.value && cached.expiresAt > now) {

507-

return cached.value;

510+

if (cached && isFutureDateTimestampMs(cached.expiresAt, { nowMs: now })) {

511+

if (cached.value) {

512+

return cached.value;

513+

}

514+

if (cached.inFlight) {

515+

return cached.inFlight;

516+

}

508517

}

509-

if (cached?.inFlight) {

510-

return cached.inFlight;

518+

if (cached) {

519+

discoveryCache.delete(cacheKey);

511520

}

512521

}

513522

@@ -581,19 +590,27 @@ export async function discoverBedrockModels(params: {

581590

})();

582591
583592

if (refreshIntervalSeconds > 0) {

584-

discoveryCache.set(cacheKey, {

585-

expiresAt: now + refreshIntervalSeconds * 1000,

586-

inFlight: discoveryPromise,

587-

});

593+

const expiresAt = resolveExpiresAtMsFromDurationSeconds(refreshIntervalSeconds, { nowMs: now });

594+

if (expiresAt !== undefined) {

595+

discoveryCache.set(cacheKey, {

596+

expiresAt,

597+

inFlight: discoveryPromise,

598+

});

599+

}

588600

}

589601
590602

try {

591603

const value = await discoveryPromise;

592604

if (refreshIntervalSeconds > 0) {

593-

discoveryCache.set(cacheKey, {

594-

expiresAt: now + refreshIntervalSeconds * 1000,

595-

value,

605+

const expiresAt = resolveExpiresAtMsFromDurationSeconds(refreshIntervalSeconds, {

606+

nowMs: now,

596607

});

608+

if (expiresAt !== undefined) {

609+

discoveryCache.set(cacheKey, {

610+

expiresAt,

611+

value,

612+

});

613+

}

597614

}

598615

return value;

599616

} catch (error) {