Skip to content

Commit 3db1508

Browse files
committed
fix(ci): stabilize deadcode and catalog checks
1 parent ca70015 commit 3db1508

3 files changed

Lines changed: 49 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Docs: https://docs.openclaw.ai
99
### Fixes
1010

1111
- Scripts: build CLI startup artifacts before the gateway CPU startup bench so fresh Linux runners do not report false `n/a` readiness and process metrics.
12-
- Scripts: remove stale Knip unused-file allowlist entries so the dead-code gate fails only on current findings.
12+
- Scripts: keep intentional Knip unused-file findings optional so full CI and sparse proof workspaces stay aligned.
1313
- Tests: normalize bundled plugin lifecycle probe paths and state-root lookup so native Windows release sweeps accept valid packaged plugin installs.
1414
- Config: keep benign legacy metadata write anomalies out of default doctor and config command output while preserving explicit anomaly logging for diagnostics.
1515
- Codex: log when implicit app-server `never` approvals are promoted for OpenClaw tool policy, including whether the trigger was a `before_tool_call` hook or trusted tool policy.

scripts/deadcode-unused-files.allowlist.mjs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,41 @@
44
export const KNIP_UNUSED_FILE_ALLOWLIST = [];
55

66
// Knip can disagree across supported local/CI platforms for files that are
7-
// only reachable through test-only import graphs. Ignore these when reported,
8-
// but do not require them to be reported.
7+
// only reachable through test-only import graphs, sparse-checkout proof
8+
// workspaces, dynamic entrypoints, manifest-discovered plugin surfaces, or
9+
// package bridge files. Ignore these when reported, but do not require them
10+
// to be reported.
911
export const KNIP_OPTIONAL_UNUSED_FILE_ALLOWLIST = [
12+
"extensions/acpx/src/runtime-internals/error-format.mjs",
13+
"extensions/acpx/src/runtime-internals/mcp-command-line.mjs",
14+
"extensions/acpx/src/runtime-internals/mcp-proxy.mjs",
15+
"extensions/canvas/src/host/a2ui-app/bootstrap.js",
16+
"extensions/canvas/src/host/a2ui-app/rolldown.config.mjs",
17+
"extensions/diffs/src/viewer-client.ts",
18+
"extensions/diffs/src/viewer-payload.ts",
19+
"extensions/matrix/src/plugin-entry.runtime.js",
20+
"extensions/memory-core/src/memory-tool-manager-mock.ts",
21+
"src/agents/subagent-registry.runtime.ts",
22+
"src/auto-reply/inbound.group-require-mention-test-plugins.ts",
23+
"src/auto-reply/reply/get-reply.test-loader.ts",
24+
"src/cli/daemon-cli-compat.ts",
25+
"src/commands/doctor/shared/deprecation-compat.ts",
26+
"src/config/doc-baseline.runtime.ts",
27+
"src/config/doc-baseline.ts",
28+
"src/gateway/gateway-cli-backend.live-helpers.ts",
29+
"src/gateway/gateway-cli-backend.live-probe-helpers.ts",
30+
"src/gateway/gateway-codex-harness.live-helpers.ts",
31+
"src/infra/changelog-unreleased.ts",
32+
"src/mcp/openclaw-tools-serve.ts",
33+
"src/mcp/plugin-tools-handlers.ts",
34+
"src/mcp/plugin-tools-serve.ts",
35+
"src/mcp/tools-stdio-server.ts",
36+
"src/plugins/build-smoke-entry.ts",
37+
"src/plugins/contracts/host-hook-fixture.ts",
38+
"src/plugins/contracts/rootdir-boundary-canary.ts",
39+
"src/plugins/contracts/tts-contract-suites.ts",
40+
"src/plugins/runtime-sidecar-paths-baseline.ts",
41+
"src/tasks/task-registry-control.runtime.ts",
1042
"extensions/qa-lab/src/auth-profile.fixture.ts",
1143
"extensions/qa-lab/src/codex-plugin.fixture.ts",
1244
"src/gateway/test/server-sessions-helpers.ts",

src/agents/model-catalog-visibility.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ import { createModelVisibilityPolicy } from "./model-visibility-policy.js";
77
type ModelCatalogVisibilityView = "default" | "configured" | "all";
88
type ProviderAuthChecker = (provider: string) => boolean | Promise<boolean>;
99

10+
function isPromiseLike(value: boolean | Promise<boolean>): value is Promise<boolean> {
11+
return typeof value === "object" && value !== null && typeof value.then === "function";
12+
}
13+
14+
async function providerHasAuth(
15+
providerAuthChecker: ProviderAuthChecker,
16+
provider: string,
17+
): Promise<boolean> {
18+
const result = providerAuthChecker(provider);
19+
return isPromiseLike(result) ? await result : result;
20+
}
21+
1022
function sortModelCatalogEntries(entries: ModelCatalogEntry[]): ModelCatalogEntry[] {
1123
return entries.toSorted(
1224
(a, b) => a.provider.localeCompare(b.provider) || a.id.localeCompare(b.id),
@@ -56,10 +68,10 @@ export async function resolveVisibleModelCatalog(params: {
5668
env: params.env,
5769
allowPluginSyntheticAuth: params.runtimeAuthDiscovery,
5870
discoverExternalCliAuth: params.runtimeAuthDiscovery,
59-
});
71+
});
6072
const authBackedCatalog: ModelCatalogEntry[] = [];
6173
for (const entry of params.catalog) {
62-
if (await hasAuth(entry.provider)) {
74+
if (await providerHasAuth(hasAuth, entry.provider)) {
6375
authBackedCatalog.push(entry);
6476
}
6577
}

0 commit comments

Comments
 (0)