Skip to content

fix: use host-safe default AGENT_DATA_DIR for local runs#58

Merged
yaojin3616 merged 1 commit intodataelement:mainfrom
Congregalis:codex/fix-agent-data-default-path
Mar 14, 2026
Merged

fix: use host-safe default AGENT_DATA_DIR for local runs#58
yaojin3616 merged 1 commit intodataelement:mainfrom
Congregalis:codex/fix-agent-data-default-path

Conversation

@Congregalis
Copy link
Contributor

@Congregalis Congregalis commented Mar 13, 2026

Summary

Why

The previous hardcoded default (/data/agents) is container-oriented and can fail in local host environments (especially macOS), where /data may be unavailable or read-only. This led to runtime failures when endpoints attempted to create directories under AGENT_DATA_DIR.

This change keeps Docker behavior intact while making local defaults writable and cross-platform safe.

Changes

  • backend/app/config.py
    • Added _running_in_container() for best-effort container detection
    • Added _default_agent_data_dir()
    • Changed AGENT_DATA_DIR default from hardcoded /data/agents to _default_agent_data_dir()
  • .env.example
    • Clarified default data directory behavior for local vs container runs

Validation

  • Ran python -m compileall backend/app/config.py
  • Verified local default resolves to ~/.clawith/data/agents when AGENT_DATA_DIR is unset
  • Verified explicit override still works (AGENT_DATA_DIR=/tmp/clawith-agents)
  • Confirmed Docker-target default path remains /data/agents under container detection

@Congregalis Congregalis force-pushed the codex/fix-agent-data-default-path branch from 685aced to 5edaca5 Compare March 13, 2026 14:11
@yaojin3616 yaojin3616 merged commit 7f1d446 into dataelement:main Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make AGENT_DATA_DIR default cross-platform safe (avoid /data/agents on non-container local runs)

2 participants