Repository navigation
Description
Title
2026.5.26: upgrade can create phantom workdir directories; UI displays paths inconsistently across tools
Summary
After upgrading assistantplatform from 2026.4.23 to 2026.5.26 on macOS Sequoia 15.6 (arm64),
two phantom directories appeared under ~/.assistantplatform/ (the legacy on-disk dotted directory):
~/.assistantplatform/workdir/— a directory literally namedworkdir(rebranded display
form), inode separate from the realworkdir/. Created at the moment of the upgrade.~/.assistant/(rebranded display form of.assistantplatform) — a dotted dir parallel
to the real.assistantplatform, containing only aworkdir/with amemory/subdir holding
exactly two files:self-audit-latest.mdand2026-05-27.md(the latter modified during the
first post-upgrade memory-flush operation).
Different tools resolved paths to different directories:
read/edit(gateway tool layer) consistently hit the real~/.assistantplatform/workdir/—
but with intermittent ENOENT during/after the upgrade window (likely cache lag).writeduring memory-flush turns landed in~/.assistantplatform/workdir/memory/(the phantom).execvia$PWDalways saw the real workdir.
This caused silent data loss for two writes from the same session:
memory/self-audit-latest.md(a fresh self-audit run) was written to the phantom; real
workdir's copy stayed stale.memory/2026-05-27.md(today's daily note) was duplicated across both directories with
different content in each.
Reproduction
Hard to reproduce deterministically without an upgrade in-flight. The signal is:
- Run
assistantplatform doctor --repairwhile a memory-flush write is in progress (or close to
it). [Speculative — exact trigger unconfirmed, butdoctor --repairwas running just before
the phantom dirs appeared at the same timestamp as theirctime.] - After upgrade completes, check
ls -lai ~/.assistantplatform/for duplicateworkspaceentries
with different inodes.
Evidence (collected from this deployment)
$ ls -lai ~/.assistantplatform/ # (real path; bytes 2e6f70656e636c6177)
11349020 drwx------ 6 <user> staff 192 May 27 21:11 .
11388251 drwx------ 3 <user> staff 96 Apr 15 16:02 agents
14900091 drwx------ 3 <user> staff 96 Apr 29 17:45 credentials
17379862 drwx------ 3 <user> staff 96 May 27 21:11 workspace <-- PHANTOM (rebranded display name)
11349021 drwx------ 9 <user> staff 288 May 12 13:29 workspace <-- real
$ os.listdir(b"~/.assistantplatform/") # raw bytes
[b'agents', b'credentials', b'workspace', b'workdir']
# Display rebrand: 'workdir' = legacy/AssistantPlatform branding (7 bytes ASCII)
# 'workdir' = AssistantPlatform rebrand display (also rendered identically in
# terminal output but distinct on disk)
Phantom contents:
17379862 workspace/
└── memory/ (created 21:11 BRT)
├── self-audit-latest.md (7883 bytes, 21:11 — duplicate of real)
└── 2026-05-27.md (570 bytes, 21:13 — DIFFERENT content from real)
Side effect: file-rendering substitution makes debugging confusing
Workdir-root files are stored under legacy names (HEARTBEAT.md, CONFIG.md, NOTES.md, SETUP.md,
PERSONA.md, PROFILE.md, ABOUT.md, MODULE.md) but the UI/chat layer displays them as
their AssistantPlatform-rebranded forms (PING.md, CONFIG.md, NOTES.md, SETUP.md, PERSONA.md,
PROFILE.md, ABOUT.md, MODULE.md). This is intentional and works fine — the path-resolver
translates both ways. The issue is that during the phantom-confusion window, error messages
referenced the rebranded names but the actual ENOENT was against a real legacy path, making
the problem opaque.
Impact
- Data loss: Two memory writes to the wrong directory; not noticed until 4 hours later.
- Investigation cost: 90+ minutes of model time trying to reconcile path resolution.
- Audit corruption: Self-audit snapshot in the phantom dir was newer than the real one,
so the next audit comparison would have referenced stale data if not detected.
Suggested fix
- On upgrade: detect existing
~/.<legacy>/<...>dir and skip creating any phantom rebrand
directory at the same level. Either symlink the new name to the old one, or refuse to create
a parallel directory if one with the legacy bytes already exists. - Memory-flush write path: validate the target file path resolves under the active
workdir (read from the same source as$PWD/runtime workdir env), not from a freshly-cached
value at process start. - Self-audit hint: add a phantom-detection check (Cortana deployment already added this as
self-audit check Feature Request: Per-Chat Working Directory (cwdOverrides) #14 — see attached). Detect when~/.<dotdir>/contains both rebranded and
legacy versions of any subdir name.
Workaround for affected deployments
import os
# Always derive paths from the runtime env, never from typed literals
os.chdir(os.environ["PWD"])
# For directory listings, use raw bytes to expose duplicates
for entry in os.listdir(b"."):
real_name_hex = entry.hex() # see the actual on-disk bytesFor directories where you suspect phantoms exist:
ls -lai ~/.assistantplatform/ | awk '{print $1}' | sort | uniq -c | sort -rn | head
# If any inode appears more than once with the same display name, you have a phantomEnvironment
- macOS Sequoia 15.6 (arm64), Mac Mini
- node v22.22.0
- AssistantPlatform 2026.5.26 (upgraded from 2026.4.23 on 2026-05-27 19:54 BRT)
- APFS (no Unicode normalization tricks; confirmed via raw byte inspection in os.listdir)
- ~6,000+ memory chunks, custom org-internal deployment with on-call coordination agents
Attached evidence
- Backups of both real and phantom 2026-05-27.md:
/tmp/workspace-rescue-20260527/ - Self-audit check Feature Request: Per-Chat Working Directory (cwdOverrides) #14 added to
~/.assistantplatform/skills/self-audit/MODULE.md - Lessons logged in
~/.assistantplatform/workdir/memory/2026-05-27.md
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 28, 2026
Thanks for the context here. I did a careful shell check against current
main, and this is already implemented.Current main now keeps memory-flush writes rooted in the active workspace and carries that workspace through the CLI runner, covering the central divergent-write failure reported here. The historical duplicate directories cannot be reconstructed from the report, but current recovery deliberately avoids guessing how to merge pre-existing divergent trees.
So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review details
Best possible solution:
Keep the single prepared-workspace flow and the conservative non-merging migration behavior; handle any still-existing divergent historical trees through an explicit operator recovery rather than an automatic merge.
Do we have a high-confidence way to reproduce the issue?
No current-release reproduction is available: the report describes a historical upgrade race, while current source and focused regression coverage demonstrate the corrected workspace-rooted write path.
Is this the best way to solve the issue?
Yes for the reported runtime failure: carrying the prepared workspace through the owner path is more maintainable than a downstream path check or automatic merge of conflicting user trees.
Security review:
Security review: This is issue triage without a proposed patch or security-boundary report.
AGENTS.md: found and applied where relevant.
What I checked:
src/agents/agent-tools.create-openclaw-coding-tools.test.ts:2178, 7ecdef6e2ed4)src/agents/cli-runner.ts:1529, 7ecdef6e2ed4)src/agents/cli-runner.ts:1529, 25dfe9294fbb)src/infra/state-migrations.state-dir.ts:219, 7ecdef6e2ed4)qa/maturity-scores.yaml, 7ecdef6e2ed4)Likely related people:
src/agents/cli-runner.ts,src/agents/cli-runner.binding-flush.test.ts)src/auto-reply/reply/agent-runner-memory.ts)Codex review notes: model internal, reasoning high; reviewed against 7ecdef6e2ed4; fix evidence: commit 25dfe9294fbb, main fix timestamp 2026-05-30T10:09:19+05:30.
vincentkoc commentedon Aug 12, 2026
Closing as already fixed, with corrected provenance from the earlier review.
The primary fix is #87218, landed as 7299c56. It carries task
cwdseparately from the configured agent workspace across native and Codex sub-agent paths; its regression coverage verifies that memory-flush writes land in the workspace and no alternate-cwdfile is created. This matches Codex app-server's explicit per-thread and per-turncwdcontract: https://github.com/openai/codex/blob/414782450952a196bbb64b1605a458c2531c47b6/codex-rs/app-server-protocol/src/protocol/v2/thread.rs#L55-L73 and https://github.com/openai/codex/blob/414782450952a196bbb64b1605a458c2531c47b6/codex-rs/app-server-protocol/src/protocol/v2/turn.rs#L95-L102.Adjacent Claude CLI proof is #84234, specifically 25dfe92, which passes the prepared workspace/
cwdinto the transcript-flush probe. Existing divergent roots are deliberately not auto-merged: migration stops with manual reconciliation guidance when both roots exist, preserving distinct user data.Both commits are contained in shipped release https://github.com/openclaw/openclaw/releases/tag/v2026.7.1-2. No further code change is needed.