feat: persist container ~/.config at the project level (#92)#94
Open
hggz wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #92.
Tools like jj write their config under
~/.configinside the container, but that directory wasn't persisted — so the config was lost between runs. This persists the container's/home/harness/.configto the host.Where it persists
$XDG_DATA_HOME/harness/<normalized-cwd>/xdg_config→ container/home/harness/.configI put it at the project (cwd) level — one level above the per-agent persist root — matching the
normalized-cwd/xdg_configpath 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/opencodeper-agent. That mount nests inside the new cwd-level.configmount — Docker mounts parents before children, so opencode keeps its own per-agent bucket while the rest of~/.configpersists 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/.configshadows whatever the image ships there on first run (the host dir starts empty). The existing opencode.config/opencodemount 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:
<cwd>/xdg_configand mounts/home/harness/.config-p) stays ephemeral — no dir, no mount.configand per-agent.config/opencodemountsFull suite 97 passing / 0 failing locally (
pnpm test:e2e); biome + build clean.cc @capotej