mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-09 03:22:40 +00:00
fix(doctor): ignore unknown profile preview grants
This commit is contained in:
@@ -1006,6 +1006,43 @@ describe("doctor preview warnings", () => {
|
||||
expect(warnings).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("does not warn for configured tool sections when the profile id is unknown", () => {
|
||||
const malformedConfig = {
|
||||
tools: {
|
||||
profile: "custom-profile",
|
||||
exec: {
|
||||
security: "allowlist",
|
||||
},
|
||||
byProvider: {
|
||||
openai: {
|
||||
profile: "custom-provider-profile",
|
||||
},
|
||||
},
|
||||
},
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "sage",
|
||||
tools: {
|
||||
exec: {
|
||||
security: "allowlist",
|
||||
},
|
||||
byProvider: {
|
||||
openai: {
|
||||
profile: "custom-agent-provider-profile",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
} as unknown as Parameters<typeof collectProfileConfiguredToolSectionWarnings>[0];
|
||||
|
||||
const warnings = collectProfileConfiguredToolSectionWarnings(malformedConfig);
|
||||
|
||||
expect(warnings).toStrictEqual([]);
|
||||
});
|
||||
|
||||
it("does not warn when default group visible replies are automatic", () => {
|
||||
const warnings = collectVisibleReplyToolPolicyWarnings({
|
||||
channels: {
|
||||
|
||||
@@ -403,6 +403,9 @@ function collectProfileConfiguredToolSectionScopeWarnings(params: {
|
||||
? tools.alsoAllow.filter((entry): entry is string => typeof entry === "string")
|
||||
: params.inheritedAlsoAllow;
|
||||
const profilePolicy = mergeAlsoAllowPolicy(resolveToolProfilePolicy(profile), alsoAllow);
|
||||
if (!profilePolicy) {
|
||||
return [];
|
||||
}
|
||||
const uncoveredEntries = collectUncoveredConfiguredToolSectionGrantEntries(
|
||||
configuredEntries,
|
||||
profilePolicy,
|
||||
@@ -454,6 +457,9 @@ function collectByProviderConfiguredToolSectionWarnings(params: {
|
||||
const alsoAllow =
|
||||
readPreviewStringList(policy.alsoAllow) ?? readPreviewStringList(inheritedPolicy?.alsoAllow);
|
||||
const profilePolicy = mergeAlsoAllowPolicy(resolveToolProfilePolicy(profile), alsoAllow);
|
||||
if (!profilePolicy) {
|
||||
return [];
|
||||
}
|
||||
const uncoveredEntries = collectUncoveredConfiguredToolSectionGrantEntries(
|
||||
params.configuredEntries,
|
||||
profilePolicy,
|
||||
@@ -560,6 +566,9 @@ function collectInheritedByProviderConfiguredToolSectionWarnings(params: {
|
||||
readPreviewStringList(overridingPolicy?.alsoAllow) ??
|
||||
readPreviewStringList(inheritedPolicy.alsoAllow);
|
||||
const profilePolicy = mergeAlsoAllowPolicy(resolveToolProfilePolicy(profile), alsoAllow);
|
||||
if (!profilePolicy) {
|
||||
return [];
|
||||
}
|
||||
const uncoveredEntries = collectUncoveredConfiguredToolSectionGrantEntries(
|
||||
params.configuredEntries,
|
||||
profilePolicy,
|
||||
|
||||
Reference in New Issue
Block a user