mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 03:22:44 +00:00
fix: harden include confinement edge cases (#18652) (thanks @aether-ai-agent)
This commit is contained in:
@@ -147,6 +147,30 @@ function noteOpencodeProviderOverrides(cfg: OpenClawConfig) {
|
||||
note(lines.join("\n"), "OpenCode Zen");
|
||||
}
|
||||
|
||||
function noteIncludeConfinementWarning(snapshot: {
|
||||
path?: string | null;
|
||||
issues?: Array<{ message: string }>;
|
||||
}): void {
|
||||
const issues = snapshot.issues ?? [];
|
||||
const includeIssue = issues.find(
|
||||
(issue) =>
|
||||
issue.message.includes("Include path escapes config directory") ||
|
||||
issue.message.includes("Include path resolves outside config directory"),
|
||||
);
|
||||
if (!includeIssue) {
|
||||
return;
|
||||
}
|
||||
const configRoot = path.dirname(snapshot.path ?? CONFIG_PATH);
|
||||
note(
|
||||
[
|
||||
`- $include paths must stay under: ${configRoot}`,
|
||||
'- Move shared include files under that directory and update to relative paths like "./shared/common.json".',
|
||||
`- Error: ${includeIssue.message}`,
|
||||
].join("\n"),
|
||||
"Doctor warnings",
|
||||
);
|
||||
}
|
||||
|
||||
type TelegramAllowFromUsernameHit = { path: string; entry: string };
|
||||
|
||||
type TelegramAllowFromListRef = {
|
||||
@@ -758,6 +782,7 @@ export async function loadAndMaybeMigrateDoctorConfig(params: {
|
||||
const fixHints: string[] = [];
|
||||
if (snapshot.exists && !snapshot.valid && snapshot.legacyIssues.length === 0) {
|
||||
note("Config invalid; doctor will run with best-effort config.", "Config");
|
||||
noteIncludeConfinementWarning(snapshot);
|
||||
}
|
||||
const warnings = snapshot.warnings ?? [];
|
||||
if (warnings.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user