Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

fix(memory-backup): derive memory-dir from REPO_DIR instead of hardcoded lianghaochen path - #103

Open
jgluck96 wants to merge 2 commits into
mainfrom
fix/memory-backup-hardcoded-path
Open

jgluck96 wants to merge 2 commits into
mainfrom
fix/memory-backup-hardcoded-path

Conversation

@jgluck96

@jgluck96 jgluck96 commented Jun 4, 2026

Copy link
Copy Markdown

Summary

  • memory_dir() fallback was hardcoded to "-Users-lianghaochen-stando" — broken for every user except the original author
  • Replace with claude_home_path("projects", slug, "memory") where slug = str(REPO_DIR).replace("/", "-") — the same derivation Claude Code uses for its per-project directories
  • Also extend env-var lookup to honour the legacy SUTANDO_PRIVATE_DIR alias (mirrors util_paths._memory_dir_env())

Test plan

  • memory_dir() smoke-tested locally: returns ~/.claude/projects/-Users-<host>-Development-core-prod-stando/memory when SUTANDO_MEMORY_DIR is unset
  • With SUTANDO_MEMORY_DIR set, still uses the explicit env var (path unchanged)
  • CI tsc + tests

🤖 Generated with Claude Code

jgluck96 and others added 2 commits June 4, 2026 16:47
…ded lianghaochen path

The default fallback in memory_dir() was hardcoded to
`-Users-lianghaochen-stando`, which broke the function for every user
other than the original author. Replace it with a derived slug from
REPO_DIR (same slug format Claude Code uses for its project directories).
Also honor the legacy SUTANDO_PRIVATE_DIR alias, matching util_paths.py's
_memory_dir_env() behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without a timeout, tar can hang indefinitely on a full disk, slow NFS
mount, or corrupted archive — blocking the upload/hydrate command
permanently. 120s is generous for typical memory + notes directories
(usually a few MB of markdown). TimeoutExpired returns False from
_make_tarball (upload skips) and exit code 3 from cmd_hydrate (same
as CalledProcessError).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@bassilkhilo-ag2 bassilkhilo-ag2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two solid fixes: (1) the hardcoded lianghaochen path replaced with a repo-derived slug via claude_home_path — this was a portability bug affecting every non-lianghaochen installation. (2) Also honors SUTANDO_PRIVATE_DIR (legacy alias, per CLAUDE.md). Timeout=120 on tar subprocesses is good defensive coding — large memory dirs could hang indefinitely. Approved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants