Skip to content

Commit aa2a5c9

Browse files
authored
feat(channels): record account lifecycle facts and retire inferred health vocabularies (#117300)
* fix(channels): record account lifecycle facts * fix(channels): bound recorded lifecycle grace * fix(channels): preserve authored health state * test: dedupe health snapshot type literal and fix spread order
1 parent 3edbe19 commit aa2a5c9

43 files changed

Lines changed: 594 additions & 151 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ bba5540be7cf9613a163663decdb2affe2af9bbd3ad7914989ab186f9c2abec1 module/channel
4545
0ceb4378709eb2d92a62a275f87fa04e18f77df8f942a9a0acef81019ebc1e24 module/channel-secret-runtime
4646
7c90157a95bc0523fc66b1f78ce140f7ec7dbf809dfa3a480244efc01f972754 module/channel-send-result
4747
fb123c1b557ed2527e335f13c3d6de41ab0c3305151001cf2b1075d1da8034c5 module/channel-setup
48-
16fe7770b385f46ba17b4e11fea7ebaf953b3a08ffe45cb9f94380d364210123 module/channel-status
48+
aeac9bb8127faf636dde79772a577d9cb003660ef3d1df03ddf606101020c402 module/channel-status
4949
d904e33114f056022ef9fec184edcfe37c30b539b268e28b0ff485f0a02b9c59 module/channel-streaming
5050
14f0103adb14627b662fbe9fdd5ed08596ed702a250853e8beb8bb8dd1361588 module/cli-argv
5151
c89ec1b194b76f67a6f4dd108dccf460da6065646cba31374c8aa748f23a39e4 module/collection-runtime
@@ -63,7 +63,7 @@ c1ea9510dfda047609a99d5d2cd1f1560f5d469a36e6b695766213d695c25b0f module/convers
6363
f70c93d28053ca2e8353e45e6515ce7acef188097c6117d1545965d0699c8004 module/device-bootstrap
6464
6215d3af5923bf5a616d73062534968b69f448e3e30adc64ae9caebdd1a46d71 module/diagnostic-runtime
6565
ea81ef06956c1bc0853fa00afbbc2b5a4019116aaf8a436e1b27d06f7a2c9e88 module/directory-runtime
66-
82eb830878b9fa58a62a0a4f3dd0dc12790986a8a6d9bf6e6ed67d9e4df4b9b4 module/discord
66+
e8adcff47c1b677cd2c01a2130fe4d226ac30ab3c88a3ceb4df5a8660316c4a9 module/discord
6767
f65408d85477bb362ebe6ed9148c1bb6b9eb7839733e5e3119f4ff8f1cfd0567 module/error-runtime
6868
b013053a61e7d9be3d0c683c02baf57fa7e4393ec54e0df6a46ab0f2fe2348fd module/extension-shared
6969
ceacad83db01c66e7be6aa21a291597020f13f737b697690eae7d47098e6499a module/gateway-method-runtime
@@ -132,7 +132,7 @@ ae469f32799380e6b045abaefefee6eb3f00d714ffbf36b6eeef5025dc529472 module/speech-
132132
9e521fe9073dfd1a6a6855f909fa6befe8613e18403f0a65faaba973a8b630c1 module/ssrf-policy
133133
f85d5be0f635de6a77bbd9224a37c373998e098a8dcf2048ddc2c9ac735b47ef module/ssrf-runtime
134134
ff35f9f74d35d37a2eb6126b57f3dc5a4d580b6222fe3a34c9368779ad32eab7 module/state-paths
135-
64c51c24cfaaf93199e4734abbb64c3eb50dc75488400c65a412eedeefe21f61 module/status-helpers
135+
44cc071d9ba2baa26d6f33ba9407867fb07c33384f49d3e3d5210232022c1b5f module/status-helpers
136136
537047854c21ad20ea0572f8019503cbda3bbafece8194a28c30b0639bde2fde module/string-coerce-runtime
137137
1b5b9a4532db991fce807ba736b550de27aa5f9de2e1f508a8f4f09cae76ea29 module/telegram-account
138138
110944726884fca94f38c9c329b5950629438b9a719f4782c4beeade8bd67746 module/temp-path

‎extensions/discord/src/status-issues.test.ts‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,27 +72,4 @@ describe("collectDiscordStatusIssues", () => {
7272
},
7373
]);
7474
});
75-
76-
it("reports degraded runtime transport state", () => {
77-
const issues = collectDiscordStatusIssues([
78-
{
79-
accountId: "ops",
80-
enabled: true,
81-
configured: true,
82-
running: true,
83-
connected: true,
84-
healthState: "stale-socket",
85-
} as ChannelAccountSnapshot,
86-
]);
87-
88-
expect(issues).toEqual([
89-
{
90-
channel: "discord",
91-
accountId: "ops",
92-
kind: "runtime",
93-
message: "Discord gateway transport is degraded (stale-socket; account is running).",
94-
fix: "Check gateway event-loop health and Discord connectivity, then restart the Discord channel or gateway if the transport does not recover.",
95-
},
96-
]);
97-
});
9875
});

‎extensions/discord/src/status-issues.ts‎

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function collectDiscordStatusIssues(
9696
): ChannelStatusIssue[] {
9797
const issues: ChannelStatusIssue[] = [];
9898
for (const entry of accounts) {
99-
const account = readAccountStatusSnapshot(entry, ["healthState", "application", "audit"]);
99+
const account = readAccountStatusSnapshot(entry, ["application", "audit"]);
100100
if (!account) {
101101
continue;
102102
}
@@ -105,32 +105,6 @@ export function collectDiscordStatusIssues(
105105
continue;
106106
}
107107

108-
const running = account.running === true;
109-
const healthState = asString(account.healthState);
110-
if (
111-
healthState === "stale-socket" ||
112-
healthState === "stuck" ||
113-
healthState === "disconnected" ||
114-
healthState === "not-running"
115-
) {
116-
const runningLabel = running ? "running" : "not running";
117-
issues.push({
118-
channel: "discord",
119-
accountId,
120-
kind: "runtime",
121-
message: `Discord gateway transport is degraded (${healthState}; account is ${runningLabel}).`,
122-
fix: "Check gateway event-loop health and Discord connectivity, then restart the Discord channel or gateway if the transport does not recover.",
123-
});
124-
} else if (running && account.connected === false) {
125-
issues.push({
126-
channel: "discord",
127-
accountId,
128-
kind: "runtime",
129-
message: "Discord gateway transport is running but disconnected.",
130-
fix: "Check gateway logs for Discord websocket errors and wait for reconnect; restart the Discord channel or gateway if it does not recover.",
131-
});
132-
}
133-
134108
const app = readDiscordApplicationSummary(account.application);
135109
const messageContent = app.intents?.messageContent;
136110
if (messageContent === "disabled") {

‎extensions/qa-lab/src/gateway-child.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ export async function startQaGatewayChild(params: {
10691069
claudeCliAuthMode?: QaCliBackendAuthMode;
10701070
controlUiEnabled?: boolean;
10711071
enabledPluginIds?: string[];
1072+
allowUnhealthyStartup?: boolean;
10721073
forwardHostHome?: boolean;
10731074
mockAuthAgentIds?: readonly string[];
10741075
onListening?: (context: QaGatewayChildListeningContext) => Promise<void> | void;
@@ -1423,13 +1424,15 @@ export async function startQaGatewayChild(params: {
14231424
configPath,
14241425
runtimeEnv: env,
14251426
});
1426-
await waitForGatewayReady({
1427-
baseUrl,
1428-
logs,
1429-
child: attemptChild,
1430-
getChildFailure: getAttemptChildFailure,
1431-
timeoutMs: 120_000,
1432-
});
1427+
if (!params.allowUnhealthyStartup) {
1428+
await waitForGatewayReady({
1429+
baseUrl,
1430+
logs,
1431+
child: attemptChild,
1432+
getChildFailure: getAttemptChildFailure,
1433+
timeoutMs: 120_000,
1434+
});
1435+
}
14331436
const attemptRpcClient = await startQaGatewayRpcClient({
14341437
wsUrl,
14351438
token: gatewayToken,

‎extensions/qa-lab/src/scenario-catalog.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@ describe("qa scenario catalog", () => {
233233
it("loads scenario-declared gateway runtime options from YAML", () => {
234234
const scenario = readQaScenarioById("control-ui-qa-channel-image-roundtrip");
235235
const otelStdout = readQaScenarioById("otel-stdout-log-smoke");
236+
const blockedSlack = readQaScenarioById("slack-blocked-lifecycle-no-restart");
236237

237238
expect(scenario.gatewayRuntime?.forwardHostHome).toBe(true);
238239
expect(otelStdout.gatewayRuntime?.preserveDebugArtifacts).toBe(true);
240+
expect(blockedSlack.gatewayRuntime?.allowUnhealthyStartup).toBe(true);
239241
});
240242

241243
it.each([

‎extensions/qa-lab/src/scenario-catalog.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ const qaScenarioCoverageSchema = z
163163
}));
164164

165165
const qaScenarioGatewayRuntimeSchema = z.object({
166+
allowUnhealthyStartup: z.boolean().optional(),
166167
forwardHostHome: z.boolean().optional(),
167168
preserveDebugArtifacts: z.boolean().optional(),
168169
});

‎extensions/qa-lab/src/suite-planning.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,13 @@ describe("qa suite planning helpers", () => {
715715
plugins: ["diagnostics-otel"],
716716
gatewayRuntime: { preserveDebugArtifacts: true },
717717
}),
718+
makeQaSuiteTestScenario("blocked-channel", {
719+
gatewayRuntime: { allowUnhealthyStartup: true },
720+
}),
718721
];
719722

720723
expect(collectQaSuiteGatewayRuntimeOptions(scenarios)).toEqual({
724+
allowUnhealthyStartup: true,
721725
forwardHostHome: true,
722726
preserveDebugArtifacts: true,
723727
});

‎extensions/qa-lab/src/suite-planning.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,23 @@ function collectQaSuiteGatewayConfigPatch(
223223
function collectQaSuiteGatewayRuntimeOptions(
224224
scenarios: ReturnType<typeof readQaBootstrapScenarioCatalog>["scenarios"],
225225
) {
226+
let allowUnhealthyStartup = false;
226227
let forwardHostHome = false;
227228
let preserveDebugArtifacts = false;
228229
for (const scenario of scenarios) {
230+
if (scenario.gatewayRuntime?.allowUnhealthyStartup === true) {
231+
allowUnhealthyStartup = true;
232+
}
229233
if (scenario.gatewayRuntime?.forwardHostHome === true) {
230234
forwardHostHome = true;
231235
}
232236
if (scenario.gatewayRuntime?.preserveDebugArtifacts === true) {
233237
preserveDebugArtifacts = true;
234238
}
235239
}
236-
return forwardHostHome || preserveDebugArtifacts
240+
return allowUnhealthyStartup || forwardHostHome || preserveDebugArtifacts
237241
? {
242+
...(allowUnhealthyStartup ? { allowUnhealthyStartup: true } : {}),
238243
...(forwardHostHome ? { forwardHostHome: true } : {}),
239244
...(preserveDebugArtifacts ? { preserveDebugArtifacts: true } : {}),
240245
}

‎extensions/qa-lab/src/suite-run-standard.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export async function runQaFlowSuiteStandard(
128128
claudeCliAuthMode: params?.claudeCliAuthMode,
129129
controlUiEnabled: params?.controlUiEnabled ?? true,
130130
enabledPluginIds,
131+
allowUnhealthyStartup: gatewayRuntimeOptions?.allowUnhealthyStartup,
131132
forwardHostHome: gatewayRuntimeOptions?.forwardHostHome,
132133
mutateConfig: gatewayConfigPatch
133134
? (cfg) => applyQaMergePatch(cfg, gatewayConfigPatch) as OpenClawConfig

‎extensions/qa-lab/src/suite-test-helpers.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export function makeQaSuiteTestScenario(
1111
config?: Record<string, unknown>;
1212
plugins?: string[];
1313
gatewayConfigPatch?: Record<string, unknown>;
14-
gatewayRuntime?: { forwardHostHome?: boolean; preserveDebugArtifacts?: boolean };
14+
gatewayRuntime?: {
15+
allowUnhealthyStartup?: boolean;
16+
forwardHostHome?: boolean;
17+
preserveDebugArtifacts?: boolean;
18+
};
1519
runtimePairLane?: QaSuiteTestScenario["runtimePairLane"];
1620
suiteIsolation?: "isolated";
1721
surface?: string;

0 commit comments

Comments
 (0)