Skip to content

Commit a25ebf2

Browse files
committed
fix(health): prune Claude speed-test cleanup state
1 parent 585990e commit a25ebf2

2 files changed

Lines changed: 37 additions & 3 deletions

File tree

tests/unit/agents-modal-guards.test.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,16 @@ test('deleteSelectedHealthCheckFailedProviders bulk-deletes Claude configs and p
541541
ok: false,
542542
issues: [
543543
{ provider: 'bad', message: 'bad failed' },
544-
{ provider: 'worse', message: 'worse failed' }
544+
{ providerName: 'worse', message: 'worse failed' }
545545
],
546-
remote: null
546+
remote: {
547+
type: 'speed-test',
548+
speedTests: {
549+
bad: { ok: false, error: 'bad failed' },
550+
worse: { ok: false, error: 'worse failed' },
551+
ok: { ok: true, durationMs: 12, status: 200 }
552+
}
553+
}
547554
},
548555
saved: 0,
549556
refreshed: 0,
@@ -594,7 +601,13 @@ test('deleteSelectedHealthCheckFailedProviders bulk-deletes Claude configs and p
594601
assert.deepStrictEqual(context.applied, ['ok']);
595602
assert.deepStrictEqual(context.healthCheckFailedProviderSelections, {});
596603
assert.deepStrictEqual(context.healthCheckResult.issues, []);
604+
assert.deepStrictEqual(context.healthCheckResult.remote.speedTests, {
605+
ok: { ok: true, durationMs: 12, status: 200 }
606+
});
597607
assert.strictEqual(context.healthCheckResult.ok, true);
608+
assert.strictEqual(context.healthCheckBatchTotal, 1);
609+
assert.strictEqual(context.healthCheckBatchDone, 1);
610+
assert.strictEqual(context.healthCheckBatchFailed, 0);
598611
assert.strictEqual(context.showHealthCheckModal, false);
599612
assert.deepStrictEqual(context.shownMessages, [{ message: '已删除 2 个失败提供商', type: 'success' }]);
600613
});

web-ui/modules/app.methods.codex-config.mjs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,10 @@ export function createCodexConfigMethods(options = {}) {
656656
const result = this.healthCheckResult;
657657
const remote = result && result.remote;
658658
const remainingIssues = Array.isArray(result && result.issues)
659-
? result.issues.filter((issue) => !deletedSet.has(issue && issue.provider))
659+
? result.issues.filter((issue) => {
660+
const name = normalizeProviderName(issue && (issue.provider || issue.providerName || issue.name));
661+
return !name || !deletedSet.has(name);
662+
})
660663
: [];
661664
if (result && typeof result === 'object') {
662665
if (remote && remote.type === 'providers-health' && Array.isArray(remote.providers)) {
@@ -680,6 +683,24 @@ export function createCodexConfigMethods(options = {}) {
680683
this.healthCheckBatchTotal = summary.total;
681684
this.healthCheckBatchDone = summary.total;
682685
this.healthCheckBatchFailed = summary.yellow + summary.red;
686+
} else if (remote && remote.type === 'speed-test' && remote.speedTests && typeof remote.speedTests === 'object') {
687+
const speedTests = Object.fromEntries(
688+
Object.entries(remote.speedTests).filter(([name]) => !deletedSet.has(normalizeProviderName(name)))
689+
);
690+
const total = Object.keys(speedTests).length;
691+
const failed = Object.values(speedTests).filter((entry) => !entry || entry.ok !== true).length;
692+
this.healthCheckResult = {
693+
...result,
694+
ok: remainingIssues.length === 0 && failed === 0,
695+
remote: {
696+
...remote,
697+
speedTests
698+
},
699+
issues: remainingIssues
700+
};
701+
this.healthCheckBatchTotal = total;
702+
this.healthCheckBatchDone = total;
703+
this.healthCheckBatchFailed = failed;
683704
} else {
684705
const removedRemote = remote && remote.type === 'remote-health-check' && deletedSet.has(remote.provider);
685706
this.healthCheckResult = {

0 commit comments

Comments
 (0)