Skip to content

fix(config): respect agent directory filesystem case - #105402

Merged
steipete merged 7 commits into
openclaw:mainfrom
a-yeyang:agent/filesystem-aware-agent-dir-collisions
Jul 29, 2026
Merged

steipete merged 7 commits into
openclaw:mainfrom
a-yeyang:agent/filesystem-aware-agent-dir-collisions

Conversation

@a-yeyang

@a-yeyang a-yeyang commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #105194

What Problem This Solves

Fixes an issue where OpenClaw rejected two valid agent directories that differ only by case on a case-sensitive macOS or Windows volume. The collision check used the host OS as a proxy for filesystem identity.

Why This Change Was Made

Agent-directory identity now resolves existing and dangling symlink segments, then applies the target volume's case semantics. Missing configured directories probe their nearest existing parent with an exclusive temporary entry that is removed before validation continues.

The maintainer rewrite deliberately does not reuse this probe for executable safe-bin trust. Safe-bin normalization remains unchanged; filesystem probing is confined to startup agent-state validation.

User Impact

Case-distinct agent state directories work on case-sensitive volumes, while true duplicates, case aliases on insensitive volumes, and symlink aliases remain rejected. No config migration is required.

Evidence

  • Exact prepared head: 52f9a49d78e8d0de6ca4c0667da141e48df3bade
  • Real macOS proof on a disposable Case-sensitive APFS image: case probe false, both AgentState/agentstate coexist, zero duplicate groups. Default macOS volume: probe true, one duplicate group. Empty probe directory remained empty.
  • Focused proof: 14 agent-dir and unchanged safe-bin tests passed.
  • Blacksmith Testbox run 30411566823 passed core/test types, guards, dead-code/cycles, formatting, and targeted lint.
  • Exact-head CI run 30412224464 passed with aggregate gate 90454733012.
  • Fresh P1 Codex autoreview is clean at confidence 0.96.

Contributor credit is preserved with Co-authored-by: chenshiyang.10 <[email protected]>.

@clawsweeper

clawsweeper Bot commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 28, 2026, 2:30 AM ET / 06:30 UTC.

ClawSweeper review

What this changes

This PR makes duplicate agent-directory detection follow the configured volume’s case semantics, resolves existing symlink aliases, and reuses the same path-case detection for trusted executable-directory comparisons.

Merge readiness

⛔ Blocked until real behavior proof is added - 4 items remain

Keep this active PR open. Current main still unconditionally lowercases agent-directory paths on macOS and Windows, so the linked case-sensitive-volume bug remains unresolved; this branch is the concrete candidate fix. The contributor refreshed the branch on July 28, 2026, so the stale label is not a basis to close it. No discrete code defect is established from the reviewed diff, but merge needs inspectable final-head filesystem proof and review of the shared safe-bin trust behavior.

Priority: P2
Reviewed head: a0737894b21f04bc4af6b14536f850c8ff24a8e8

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation and regression coverage are promising, but absent inspectable real-platform evidence remains a required merge gate.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The body describes APFS verification, but the current PR record has no inspectable final-head terminal output, redacted logs, screenshot, recording, or linked artifact. Add redacted real-platform evidence; after updating the body, request a maintainer @clawsweeper re-review only if automatic review does not rerun. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The body describes APFS verification, but the current PR record has no inspectable final-head terminal output, redacted logs, screenshot, recording, or linked artifact. Add redacted real-platform evidence; after updating the body, request a maintainer @clawsweeper re-review only if automatic review does not rerun. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 5 items Current-main behavior remains affected: Current main still resolves each agent directory through canonicalizeAgentDir, which lowercases every macOS and Windows path rather than checking the target volume; the linked report’s central failure is therefore not already implemented on main.
Branch targets the reported root cause: The PR branch replaces host-platform folding with realpath normalization plus a filesystem-local case probe, and the PR explicitly links the same case-sensitive-volume report.
Shared trust boundary changed: The new path-case helper is also used by executable safe-bin trust normalization, so the behavior needs focused confirmation beyond agent-directory collision cases before merge.
Findings None None.
Security None None.

How this fits together

At startup, OpenClaw resolves every referenced agent’s state directory and rejects collisions to prevent shared auth and session state. This PR changes the path identity step before that collision decision, and also supplies the path-case result to executable safe-bin trust comparison.

flowchart LR
  A[Agent and binding configuration] --> B[Resolve effective agent directories]
  B --> C[Resolve existing symlink path segments]
  C --> D[Probe target volume case semantics]
  D --> E[Group equivalent directories]
  E --> F[Reject unsafe shared agent state]
  D --> G[Normalize trusted executable directories]
  G --> H[Safe-bin trust decision]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The body describes APFS verification, but the current PR record has no inspectable final-head terminal output, redacted logs, screenshot, recording, or linked artifact. Add redacted real-platform evidence; after updating the body, request a maintainer @clawsweeper re-review only if automatic review does not rerun. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The new helper now influences both agent-state collision protection and executable safe-bin trust normalization; a false case-semantic result could either reject a valid setup or compare trusted paths incorrectly.
  • Resolve merge risk (P1) - The contributor’s APFS claims are not yet inspectable at the rebased final head, so reviewers cannot verify the cleanup and volume-specific behavior from the PR record alone.
  • Complete next step (P2) - No mechanical repair is currently justified; the contributor must provide inspectable real behavior proof and reviewers must validate the shared trust-path effect.
Agent review details

Security

None.

PR surface

Source +126, Tests +126. Total +252 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 169 43 +126
Tests 1 126 0 +126
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 295 43 +252

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Prove both consumers before merge (recommended)
    Attach redacted real-volume output for the final head and confirm the shared helper preserves safe-bin trust comparison behavior on case-sensitive and case-insensitive filesystems.
  2. Narrow the helper’s adoption
    Keep the agent-directory repair but defer the safe-bin trust refactor if maintainers do not want that security-adjacent comparison behavior changed in this PR.
  3. Pause for a narrower follow-up
    Pause this PR if the contributor cannot provide platform evidence or a maintainer prefers separate review of the safe-bin trust path.

Technical review

Best possible solution:

Keep the filesystem-local probe as one shared implementation, add or confirm focused safe-bin coverage for both case-sensitive and case-insensitive paths, and attach redacted final-head terminal or log evidence from the real volume checks before merge.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current main lowercases macOS and Windows agent-directory paths without inspecting the target filesystem, and the linked issue supplies concrete case-sensitive-volume steps. I did not execute the volume-dependent scenario in this read-only review.

Is this the best way to solve the issue?

Yes, with one merge gate: filesystem-local identity plus realpath alias handling is the maintainable fix boundary, but its shared safe-bin use needs focused proof rather than being accepted only from the agent-directory tests.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 28ecf953f382.

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: Directory identity changes can alter whether existing multi-agent configurations are accepted or rejected at startup.
  • add merge-risk: 🚨 security-boundary: The shared path-case helper now participates in normalization for trusted executable-directory comparisons.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P2: The patch addresses a reproducible startup-validation defect affecting case-sensitive-volume configurations with limited blast radius.
  • merge-risk: 🚨 compatibility: Directory identity changes can alter whether existing multi-agent configurations are accepted or rejected at startup.
  • merge-risk: 🚨 security-boundary: The shared path-case helper now participates in normalization for trusted executable-directory comparisons.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The body describes APFS verification, but the current PR record has no inspectable final-head terminal output, redacted logs, screenshot, recording, or linked artifact. Add redacted real-platform evidence; after updating the body, request a maintainer @clawsweeper re-review only if automatic review does not rerun. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main behavior remains affected: Current main still resolves each agent directory through canonicalizeAgentDir, which lowercases every macOS and Windows path rather than checking the target volume; the linked report’s central failure is therefore not already implemented on main. (src/config/agent-dirs.ts:520, 28ecf953f382)
  • Branch targets the reported root cause: The PR branch replaces host-platform folding with realpath normalization plus a filesystem-local case probe, and the PR explicitly links the same case-sensitive-volume report. (src/config/agent-dirs.ts:28, a0737894b21f)
  • Shared trust boundary changed: The new path-case helper is also used by executable safe-bin trust normalization, so the behavior needs focused confirmation beyond agent-directory collision cases before merge. (src/infra/exec-safe-bin-trust.ts:30, a0737894b21f)
  • Previous proof gate remains unmet: The prior completed ClawSweeper cycle requested inspectable real-platform evidence. The PR body describes APFS checks but provides no attached terminal output, logs, screenshot, recording, or linked artifact for the current head. (13356fcd4200)
  • Branch remains active: The branch received commit a073789 and an author update on July 28, 2026, after the stale notice; it does not meet an inactivity-based close path. (src/config/agent-dirs.ts:1, a0737894b21f)

Likely related people:

  • a-yeyang: Authored the focused filesystem-aware implementation and refreshed it against main on July 28, 2026; included for the current repair context rather than as a current-main ownership claim. (role: current repair author; confidence: medium; commits: b47c4541fc78, ad024dc4564f, a0737894b21f; files: src/config/agent-dirs.ts, src/infra/path-case.ts, src/infra/exec-safe-bin-trust.ts)
  • aniruddhaadak80: Reported the exact unconditional-lowercasing failure and supplied the case-sensitive-volume reproduction that this branch addresses. (role: bug reporter and reproduction source; confidence: medium; files: src/config/agent-dirs.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted terminal output or logs from the final head on one case-sensitive and one case-insensitive volume.
  • Show the resulting duplicate-agent decision and that the path-case probe leaves no temporary entry.
  • Confirm or add focused proof for the changed safe-bin trust comparison path.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-12T14:17:03.381Z sha 13356fc :: needs real behavior proof before merge. :: none

@a-yeyang
a-yeyang marked this pull request as ready for review July 12, 2026 14:05
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 12, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 28, 2026
…are-agent-dir-collisions

# Conflicts:
#	src/config/agent-dirs.ts
@a-yeyang

Copy link
Copy Markdown
Contributor Author

Rebased/merged latest main into this branch to resolve the merge conflict (single conflict in src/config/agent-dirs.ts import block, resolved by keeping the new isPathCaseInsensitive import and dropping the now-unused DEFAULT_AGENT_ID import per main's refactor of collectReferencedAgentIds). Still active, not stale.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 28, 2026
@steipete steipete self-assigned this Jul 28, 2026
Resolve existing path aliases and use the target volume case semantics when detecting shared agent state. Keep safe-bin trust normalization unchanged and clean temporary probes before validation continues.

Closes openclaw#105194.

Co-authored-by: chenshiyang.10 <[email protected]>
@steipete steipete removed the stale Marked as stale due to inactivity label Jul 29, 2026
@steipete steipete changed the title fix(config): allow case-distinct agent dirs on sensitive volumes fix(config): respect agent directory filesystem case Jul 29, 2026
@steipete
steipete merged commit 927070b into openclaw:main Jul 29, 2026
132 of 135 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 29, 2026
* origin/main: (57 commits)
  docs: document gateway and memory chat wizards (#115487)
  fix(agents): restore subagent completion delivery on CLI runtimes (#115422)
  fix(sandbox): stop provisioning failures from exhausting fallbacks (#115481)
  refactor: remove duplicate runtime and plugin paths (#115483)
  fix(ui): canonicalize agent model identity (#115480)
  fix(ui): preview model picker interactions live (#115477)
  fix(ui): match disabled microphone picker background (#115472)
  refactor(code-mode): split focused runtime stress suites (#115462)
  fix(gateway): preserve restart intent across coalesced config writes (#110397)
  fix: scope subagent handoff to direct tools (#115466)
  docs: explain native subagent handoff
  fix: clarify native subagent completion handoff
  fix(config): respect agent directory filesystem case (#105402)
  refactor(code-mode): unify safe OpenAI tool filtering (#115460)
  refactor(code-mode): prepare MCP namespaces once per run (#115459)
  fix(ollama): preserve selected model capabilities during onboarding (#115467)
  refactor(chat): remove duplicate session projection paths (#115461)
  refactor(code-mode): make tool catalogs run-owned (#115458)
  fix(cli): preserve mid-turn text in durable replies (#115455)
  fix(memory): fall back to keyword search when embeddings cannot start (#115397)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 29, 2026
* fix(config): respect filesystem case sensitivity for agent directories

* fix(config): probe target directory case semantics

* fix(config): handle empty filesystem case probes

* fix(config): resolve remaining agent dir aliases

* fix(config): satisfy path probe cleanup lint

---------

Co-authored-by: chenshiyang.10 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: canonicalizeAgentDir creates false collisions on case-sensitive volumes

2 participants