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

推荐订阅源

罗磊的独立博客
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
量子位
博客园 - 三生石上(FineUI控件)
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
Jina AI
Jina AI
L
LangChain Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学

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
feat(status): surface plugin health (#91952) · openclaw/o...
jalehman · 2026-06-16 · via Recent Commits to openclaw:main
1+

// Persists runtime tool-schema quarantines in the shared SQLite-backed core

2+

// plugin-state store so health surfaces can see failures from any live

3+

// runtime process.

4+

import {

5+

createRuntimeHealthRecordEnvelope,

6+

createRuntimeHealthStore,

7+

type RuntimeHealthRecordEnvelope,

8+

} from "../plugin-state/runtime-health-store.js";

9+10+

export type RuntimeToolSchemaQuarantine = {

11+

toolName: string;

12+

owner?: string;

13+

reason: string;

14+

failedAt: Date;

15+

};

16+17+

type PersistedRuntimeToolSchemaQuarantineRecord = RuntimeHealthRecordEnvelope & {

18+

toolName: string;

19+

owner?: string;

20+

reason: string;

21+

};

22+23+

function isNonEmptyString(value: unknown): value is string {

24+

return typeof value === "string" && value.trim().length > 0;

25+

}

26+27+

const quarantineStore = createRuntimeHealthStore<PersistedRuntimeToolSchemaQuarantineRecord>({

28+

ownerId: "core:runtime-tool-quarantine-health",

29+

namespace: "schema-quarantines",

30+

maxEntries: 128,

31+

// Failing runs re-register their quarantine and refresh this TTL, so it only

32+

// expires records that stop recurring (e.g. a schema fixed without restart).

33+

ttlMs: 24 * 60 * 60 * 1_000,

34+

normalizeRecord: (value) => {

35+

if (!isNonEmptyString(value.toolName) || !isNonEmptyString(value.reason)) {

36+

return undefined;

37+

}

38+

return {

39+

toolName: value.toolName,

40+

reason: value.reason,

41+

failedAtMs: value.failedAtMs,

42+

processId: value.processId,

43+

processToken: value.processToken,

44+

processStartTime: value.processStartTime,

45+

...(isNonEmptyString(value.owner) ? { owner: value.owner } : {}),

46+

};

47+

},

48+

displayKey: (record) => JSON.stringify([record.owner ?? "", record.toolName]),

49+

// Latest wins: the most recent violation message is the actionable one.

50+

pick: "latest",

51+

});

52+53+

function recordKey(

54+

record: Pick<PersistedRuntimeToolSchemaQuarantineRecord, "owner" | "toolName" | "processId">,

55+

): string {

56+

return JSON.stringify([record.owner ?? "", record.toolName, record.processId]);

57+

}

58+59+

export type RuntimeToolSchemaQuarantineIdentity = {

60+

toolName: string;

61+

owner?: string;

62+

};

63+64+

function identityKey(identity: RuntimeToolSchemaQuarantineIdentity): string {

65+

return JSON.stringify([identity.owner ?? "", identity.toolName]);

66+

}

67+68+

// Keys this process has persisted. Recovery clearing checks this set first so

69+

// the per-run path does zero store IO unless this process actually recorded a

70+

// quarantine that may have recovered.

71+

const locallyPersistedKeys = new Set<string>();

72+73+

export function recordPersistedRuntimeToolSchemaQuarantine(

74+

quarantine: RuntimeToolSchemaQuarantine,

75+

): void {

76+

const record: PersistedRuntimeToolSchemaQuarantineRecord = {

77+

toolName: quarantine.toolName,

78+

reason: quarantine.reason,

79+

...createRuntimeHealthRecordEnvelope(quarantine.failedAt),

80+

...(quarantine.owner ? { owner: quarantine.owner } : {}),

81+

};

82+

quarantineStore.register(recordKey(record), record);

83+

locallyPersistedKeys.add(identityKey(record));

84+

}

85+86+

/**

87+

* Removes this process's persisted quarantines for tools that now validate

88+

* cleanly. `listHealthyTools` is only invoked when this process has persisted

89+

* quarantines, keeping the common per-run path free of work.

90+

*/

91+

export function clearRecoveredPersistedRuntimeToolSchemaQuarantines(

92+

listHealthyTools: () => readonly RuntimeToolSchemaQuarantineIdentity[],

93+

): void {

94+

if (locallyPersistedKeys.size === 0) {

95+

return;

96+

}

97+

const recoveredKeys = new Set(

98+

listHealthyTools()

99+

.map(identityKey)

100+

.filter((key) => locallyPersistedKeys.has(key)),

101+

);

102+

if (recoveredKeys.size === 0) {

103+

return;

104+

}

105+

quarantineStore.clearForProcess(process.pid, (record) => recoveredKeys.has(identityKey(record)));

106+

for (const key of recoveredKeys) {

107+

locallyPersistedKeys.delete(key);

108+

}

109+

}

110+111+

export function listPersistedRuntimeToolSchemaQuarantines(): RuntimeToolSchemaQuarantine[] {

112+

return quarantineStore.list().map((record) => {

113+

const quarantine: RuntimeToolSchemaQuarantine = {

114+

toolName: record.toolName,

115+

reason: record.reason,

116+

failedAt: new Date(record.failedAtMs),

117+

};

118+

if (record.owner) {

119+

quarantine.owner = record.owner;

120+

}

121+

return quarantine;

122+

});

123+

}