Skip to content

feat: persist container ~/.config at the project level (#92)#94

Open
hggz wants to merge 1 commit into
mainfrom
feat/config-mount
Open

feat: persist container ~/.config at the project level (#92)#94
hggz wants to merge 1 commit into
mainfrom
feat/config-mount

Conversation

@hggz

@hggz hggz commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #92.

Tools like jj write their config under ~/.config inside the container, but that directory wasn't persisted — so the config was lost between runs. This persists the container's /home/harness/.config to the host.

Where it persists

$XDG_DATA_HOME/harness/<normalized-cwd>/xdg_config → container /home/harness/.config

I put it at the project (cwd) level — one level above the per-agent persist root — matching the normalized-cwd/xdg_config path from the issue. That means the config is shared across every agent working in the same project (pi / opencode / hermes), which seems right for tool config like jj's. Only applies to interactive (non-ephemeral) sessions, like the other persist mounts.

opencode nesting

opencode already persists /home/harness/.config/opencode per-agent. That mount nests inside the new cwd-level .config mount — Docker mounts parents before children, so opencode keeps its own per-agent bucket while the rest of ~/.config persists at the cwd level. There's an e2e test locking that both mounts coexist.

Design note / open question

One thing worth a sanity check: bind-mounting the whole /home/harness/.config shadows whatever the image ships there on first run (the host dir starts empty). The existing opencode .config/opencode mount already does this for its subpath, so the pattern is established — but if you'd rather scope this to specific subdirs (e.g. only .config/jj) instead of the whole XDG config home, easy to change. Went with the literal "mount ~/.config" reading from the issue.

Tests

3 new e2e tests:

  • interactive PTY creates <cwd>/xdg_config and mounts /home/harness/.config
  • one-shot (-p) stays ephemeral — no dir, no mount
  • opencode keeps both the cwd-level .config and per-agent .config/opencode mounts

Full suite 97 passing / 0 failing locally (pnpm test:e2e); biome + build clean.

cc @capotej

Closes #92.

Tools like jj write their config under ~/.config inside the container,
but that directory wasn't persisted, so the config was lost between runs.

Persist the container's /home/harness/.config to
$XDG_DATA_HOME/harness/<normalized-cwd>/xdg_config — one level above the
per-agent persist root, so the config is shared across every agent
working in the same project (matching the normalized-cwd/xdg_config path
from the issue). Only applies to interactive (non-ephemeral) sessions,
like the other persist mounts.

For opencode, the existing per-agent .config/opencode mount nests inside
this one; Docker mounts parents before children, so opencode keeps its
own per-agent bucket while the rest of ~/.config persists at cwd level.

Adds 3 e2e tests: interactive PTY creates xdg_config + mounts
/home/harness/.config, one-shot (-p) stays ephemeral (no dir/mount), and
opencode keeps both the cwd-level and per-agent .config mounts.
@hggz hggz requested a review from capotej as a code owner June 8, 2026 17:18
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.

(feat) mount ~/.config in containers to normalized-cwd/xdg_config

1 participant