fix(codex): remap dot-prefixed bootstrap context · openclaw/openclaw@9518d12
vincentkoc
·
2026-05-14
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ Docs: https://docs.openclaw.ai
|
16 | 16 | - iOS: restore first-use Contacts, Calendar, and Reminders permission prompts and add Privacy & Access status/actions in Settings. Thanks @BunsDev. |
17 | 17 | - Canvas: return not found for malformed percent-encoded Canvas/A2UI/document asset paths and keep decoded parent traversal blocked before path normalization. |
18 | 18 | - Telegram: allow trusted local Bot API media files whose filenames start with dots instead of falling back to remote download. |
19 | | -- Agents: remap injected context files under dot-dot-prefixed workspace directories when a run switches to an effective sandbox workspace. |
| 19 | +- Agents/Codex app-server: remap injected context files under dot-dot-prefixed workspace directories when a run switches to an effective sandbox workspace. |
20 | 20 | - Agents: allow dot-dot-prefixed filenames such as `..note.txt` through sandbox FS bridge, remote sandbox reads, and apply_patch summaries without mistaking the name for parent traversal. |
21 | 21 | - CLI/migrate: hide per-item source/plugin hints on non-conflicting Codex skill and plugin selection prompts, keeping the hint text reserved for rows that actually need attention. Thanks @sjf. |
22 | 22 | - Codex harness: treat high-confidence app-server OAuth refresh invalidation as a terminal auth-profile failure, stopping repeated raw token-refresh errors without turning entitlement or usage-limit payloads into re-auth prompts. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2371,6 +2371,35 @@ describe("runCodexAppServerAttempt", () => {
|
2371 | 2371 | expect(config?.instructions).toBeUndefined(); |
2372 | 2372 | }); |
2373 | 2373 | |
| 2374 | +it("remaps Codex bootstrap files under dot-prefixed workspace directories", () => { |
| 2375 | +expect( |
| 2376 | +__testing.remapCodexContextFilePath({ |
| 2377 | +file: { |
| 2378 | +path: "/real/workspace/..context/SOUL.md", |
| 2379 | +content: "Soul voice goes here.", |
| 2380 | +}, |
| 2381 | +sourceWorkspaceDir: "/real/workspace", |
| 2382 | +targetWorkspaceDir: "/sandbox/workspace", |
| 2383 | +}), |
| 2384 | +).toEqual({ |
| 2385 | +path: "/sandbox/workspace/..context/SOUL.md", |
| 2386 | +content: "Soul voice goes here.", |
| 2387 | +}); |
| 2388 | +expect( |
| 2389 | +__testing.remapCodexContextFilePath({ |
| 2390 | +file: { |
| 2391 | +path: "/outside/SOUL.md", |
| 2392 | +content: "outside", |
| 2393 | +}, |
| 2394 | +sourceWorkspaceDir: "/real/workspace", |
| 2395 | +targetWorkspaceDir: "/sandbox/workspace", |
| 2396 | +}), |
| 2397 | +).toEqual({ |
| 2398 | +path: "/outside/SOUL.md", |
| 2399 | +content: "outside", |
| 2400 | +}); |
| 2401 | +}); |
| 2402 | + |
2374 | 2403 | it("keeps lightweight cron Codex turns out of OpenClaw bootstrap context", async () => { |
2375 | 2404 | const sessionFile = path.join(tempDir, "session.jsonl"); |
2376 | 2405 | const workspaceDir = path.join(tempDir, "workspace"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3050,7 +3050,8 @@ function remapCodexContextFilePath(params: {
|
3050 | 3050 | const relativePath = path.relative(params.sourceWorkspaceDir, params.file.path); |
3051 | 3051 | if ( |
3052 | 3052 | !relativePath || |
3053 | | -relativePath.startsWith("..") || |
| 3053 | +relativePath === ".." || |
| 3054 | +relativePath.startsWith(`..${path.sep}`) || |
3054 | 3055 | path.isAbsolute(relativePath) || |
3055 | 3056 | params.sourceWorkspaceDir === params.targetWorkspaceDir |
3056 | 3057 | ) { |
@@ -3214,6 +3215,7 @@ export const __testing = {
|
3214 | 3215 | filterCodexDynamicToolsForAllowlist, |
3215 | 3216 | filterToolsForVisionInputs, |
3216 | 3217 | handleDynamicToolCallWithTimeout, |
| 3218 | + remapCodexContextFilePath, |
3217 | 3219 | resolveDynamicToolCallTimeoutMs, |
3218 | 3220 | restrictCodexAppServerSandboxForOpenClawSandbox, |
3219 | 3221 | resolveOpenClawCodingToolsSessionKeys, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。