Load workspace direnv env for persistent agentd agents

t-812·WorkTask·
·
·
Created16 hours ago·Updated15 hours ago·pipeline runs →

Dependencies

Description

Edit

Persistent agentd agents currently run with a fixed systemd PATH and do not load workspace direnv/nix environment. In /home/ben/omni/live this causes commands like typecheck.sh to be missing from PATH. Update persistent runtime wrapper to hydrate env from AGENTD_CWD via direnv when .envrc exists, fail with clear error when direnv load fails, and add tests/docs. Verify agentd builds and regenerated wrappers include the behavior.

Git Commits

86cb0d0ffeat(agentd): load workspace direnv env for persistent agents
Coder Agent15 hours ago2 files

Timeline (6)

🔄[human]Open → InProgress16 hours ago
💬[human]16 hours ago

Root cause: persistent agentd sessions run under systemd with a fixed PATH and never hydrate workspace-specific shell env. The runtime wrapper only cd'd into AGENTD_CWD, so commands added by direnv/nix (e.g. Omni/Ide/typecheck.sh) were unavailable.

Implemented fix:

  • Omni/Agentd/Daemon.hs (renderAgentExecScript)
  • Added AGENT_PREFIX bootstrap:
  • if direnv exists: run agent as direnv exec "$PWD" <agent>
  • if .envrc exists but direnv missing: exit with clear startup error
  • Keeps existing bundled agent path model and checkpoint/compaction behavior.
  • Updated test coverage for generated script content.
  • Updated Omni/Agentd/SPEC.md runtime control docs to describe direnv hydration behavior.

Verification:

  • lint Omni/Agentd/Daemon.hs
  • typecheck.sh Omni/Agentd/Daemon.hs
  • bild --test Omni/Agentd/Daemon.hs
  • bild Omni/Agentd.hs
💬[human]15 hours ago

Committed in 86cb0d0f. Persistent runtime wrapper now runs agent via direnv exec in AGENTD_CWD, and fails with a clear error if .envrc exists but direnv is missing. Updated generated-script tests and Omni/Agentd/SPEC.md docs.

🔄[human]InProgress → Review15 hours ago