fix(agents): avoid injecting memory file twice on case-insensitive mounts#26054
Merged
obviyus merged 3 commits intoopenclaw:mainfrom Mar 13, 2026
Merged
fix(agents): avoid injecting memory file twice on case-insensitive mounts#26054obviyus merged 3 commits intoopenclaw:mainfrom
obviyus merged 3 commits intoopenclaw:mainfrom
Conversation
|
This pull request has been automatically marked as stale due to inactivity. |
4adff19 to
0fc9a38
Compare
Contributor
Author
|
Rebased |
Contributor
Author
…unts On case-insensitive file systems mounted into Docker from macOS, both MEMORY.md and memory.md pass fs.access() even when they are the same underlying file. The previous dedup via fs.realpath() failed in this scenario because realpath does not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens. Fix by replacing the collect-then-dedup approach with an early-exit: try MEMORY.md first; fall back to memory.md only when MEMORY.md is absent. This makes the function return at most one entry regardless of filesystem case-sensitivity.
133988e to
5ed80a8
Compare
Contributor
mrosmarin
added a commit
to mrosmarin/openclaw
that referenced
this pull request
Mar 13, 2026
* main: (168 commits) fix: stabilize macos daemon onboarding fix(ui): keep shared auth on insecure control-ui connects (openclaw#45088) docs(plugins): clarify workspace shadowing fix(node-host): harden perl approval binding fix(node-host): harden pnpm approval binding fix(discovery): add missing domain to wideArea Zod config schema (openclaw#35615) chore(gitignore): add docker-compose override (openclaw#42879) feat(ios): add onboarding welcome pager (openclaw#45054) fix(signal): add groups config to Signal channel schema (openclaw#27199) fix: restore web fetch firecrawl config in runtime zod schema (openclaw#42583) fix: polish Android QR scanner onboarding (openclaw#45021) fix(android): use Google Code Scanner for onboarding QR fix(config): add missing params field to agents.list[] validation schema (openclaw#41171) docs(contributing): update Android app ownership fix(agents): rephrase session reset prompt to avoid Azure content filter (openclaw#43403) test(config): cover requiresOpenAiAnthropicToolPayload in compat schema fixture fix(agents): respect explicit user compat overrides for non-native openai-completions (openclaw#44432) Android: fix HttpURLConnection leak in TalkModeVoiceResolver (openclaw#43780) Docker: add OPENCLAW_TZ timezone support (openclaw#34119) fix(agents): avoid injecting memory file twice on case-insensitive mounts (openclaw#26054) ...
Contributor
|
This should have been marked as breaking change, not buried in fixes. |
Contributor
|
@HenryLoenwind agreed, that's on me. Will update the changelog. |
hougangdev
pushed a commit
to hougangdev/clawdbot
that referenced
this pull request
Mar 14, 2026
…unts (openclaw#26054) * fix(agents): avoid injecting memory file twice on case-insensitive mounts On case-insensitive file systems mounted into Docker from macOS, both MEMORY.md and memory.md pass fs.access() even when they are the same underlying file. The previous dedup via fs.realpath() failed in this scenario because realpath does not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens. Fix by replacing the collect-then-dedup approach with an early-exit: try MEMORY.md first; fall back to memory.md only when MEMORY.md is absent. This makes the function return at most one entry regardless of filesystem case-sensitivity. * docs: clarify singular memory bootstrap fallback * fix: note memory bootstrap fallback docs and changelog (openclaw#26054) (thanks @Lanfei) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
Contributor
|
Updated in 64e6df7. |
ecochran76
pushed a commit
to ecochran76/openclaw
that referenced
this pull request
Mar 14, 2026
…unts (openclaw#26054) * fix(agents): avoid injecting memory file twice on case-insensitive mounts On case-insensitive file systems mounted into Docker from macOS, both MEMORY.md and memory.md pass fs.access() even when they are the same underlying file. The previous dedup via fs.realpath() failed in this scenario because realpath does not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens. Fix by replacing the collect-then-dedup approach with an early-exit: try MEMORY.md first; fall back to memory.md only when MEMORY.md is absent. This makes the function return at most one entry regardless of filesystem case-sensitivity. * docs: clarify singular memory bootstrap fallback * fix: note memory bootstrap fallback docs and changelog (openclaw#26054) (thanks @Lanfei) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
5 tasks
Interstellar-code
pushed a commit
to Interstellar-code/operator1
that referenced
this pull request
Mar 16, 2026
…unts (openclaw#26054) * fix(agents): avoid injecting memory file twice on case-insensitive mounts On case-insensitive file systems mounted into Docker from macOS, both MEMORY.md and memory.md pass fs.access() even when they are the same underlying file. The previous dedup via fs.realpath() failed in this scenario because realpath does not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens. Fix by replacing the collect-then-dedup approach with an early-exit: try MEMORY.md first; fall back to memory.md only when MEMORY.md is absent. This makes the function return at most one entry regardless of filesystem case-sensitivity. * docs: clarify singular memory bootstrap fallback * fix: note memory bootstrap fallback docs and changelog (openclaw#26054) (thanks @Lanfei) --------- Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit a3eed2b)
sbezludny
pushed a commit
to sbezludny/openclaw
that referenced
this pull request
Mar 27, 2026
…unts (openclaw#26054) * fix(agents): avoid injecting memory file twice on case-insensitive mounts On case-insensitive file systems mounted into Docker from macOS, both MEMORY.md and memory.md pass fs.access() even when they are the same underlying file. The previous dedup via fs.realpath() failed in this scenario because realpath does not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens. Fix by replacing the collect-then-dedup approach with an early-exit: try MEMORY.md first; fall back to memory.md only when MEMORY.md is absent. This makes the function return at most one entry regardless of filesystem case-sensitivity. * docs: clarify singular memory bootstrap fallback * fix: note memory bootstrap fallback docs and changelog (openclaw#26054) (thanks @Lanfei) --------- Co-authored-by: Ayaan Zaidi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MEMORY.mdandmemory.mdpassfs.access()even when they are the same underlying file.fs.realpath()failed in this scenario becauserealpathdoes not normalise case through the Docker mount layer, so both paths were treated as distinct entries and the same content was injected into the bootstrap context twice, wasting tokens on every session start.MEMORY.mdfirst, fall back tomemory.mdonly when absent. The function now returns at most one entry regardless of filesystem case-sensitivity. RenamedresolveMemoryBootstrapEntries→resolveMemoryBootstrapEntryto reflect the singular return type.memory.mdfallback still works. No other bootstrap files affected.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
On Docker Desktop (macOS host), agents no longer receive duplicate memory context at session start, reducing unnecessary token usage.
Security Impact (required)
Repro + Verification
Environment
Steps
memory.md(lowercase)Expected
Actual (before fix)
MEMORY.mdandmemory.mdboth passfs.access(),realpathreturns different strings through the mount layer, dedup fails)Evidence
pnpm test src/agents/workspace.test.tspasses (12 tests)Human Verification (required)
fs.realpathbehaviour through Docker mount layers)Compatibility / Migration
Failure Recovery (if this breaks)
src/agents/workspace.tsto restore collect-then-dedupsrc/agents/workspace.ts,src/agents/workspace.test.tsmemory.mdfallback (would only happen iffs.accessonMEMORY.mderroneously succeeds without the file existing)Risks and Mitigations
MEMORY.mdandmemory.mdas genuinely different files, onlyMEMORY.mdis now loaded (previously both were loaded).Greptile Summary
Fixes duplicate memory file injection on case-insensitive Docker mounts by replacing collect-then-deduplicate logic with early-exit strategy. The function now tries
MEMORY.mdfirst and only falls back tomemory.mdif absent, preventing the same content from being injected twice whenfs.realpath()fails to normalize case through Docker mount layers. This eliminates token waste on macOS Docker setups while maintaining backward compatibility for the lowercase fallback.Confidence Score: 5/5
Last reviewed commit: 4adff19
(5/5) You can turn off certain types of comments like style here!