Container: retire vestigial session-env/ rw bind #138

Closed
opened 2026-04-20 13:00:51 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a maintainer, I want the session-env/ rw bind removed from the container config so that per-agent bind mounts are limited to the ones that actually serve a purpose — right now session-env/ is dead code that just pollutes the mount list and the agent-env layout on disk.

Context

PR #125 landed the rw bind for $CLAUDE_CONFIG_DIR/projects/, which is where Claude Code 2.1.x actually persists session history. The earlier session-env/ bind was added in v2.1.112 back when we thought the CLI wrote session state there; empirically 2.1.114 only ever creates empty UUID sub-dirs inside it and never writes content. The bind has been a no-op since before the projects-bind fix landed.

Verification today (2026-04-20): across boss/dev/reviewer/designer/design-reviewer containers, every UUID directory inside ~/.config/claude-hooks/agent-env/<agent>/session-env/ is empty. The bind exists, a mkdir per-dispatch fires, nothing ever lands.

Acceptance criteria

  • Remove the ${credsDir}/session-env:${CONTAINER_CLAUDE_CONFIG_DIR}/session-env:rw mount from src/container-reconcile.ts::dockerRun.
  • Remove the corresponding --volume line from justfile::containers-rebuild.
  • Remove the mkdir -p "$dir/session-env" in justfile::agent-env-sync (keep the projects/ pre-create).
  • Remove the mkdir(join(credsDir, "session-env"), …) in dockerRun.
  • Update src/container-reconcile.test.ts: drop any session-env mount entries from the "matching" dockerInspectJson fixtures — they stop being load-bearing.
  • matchesDesired no longer checks session-env mount (it already doesn't, but confirm by re-reading).
  • Update CLAUDE.md "Container credentials" section if it mentions session-env.

Cleanup on disk (out of scope, but note)

After merge + just containers-rebuild, operators can rm -rf ~/.config/claude-hooks/agent-env/*/session-env/ to reclaim the empty directory tree. Don't bundle that into the PR — ops cleanup.

Tests

  • All existing container-reconcile.test.ts tests still pass.
  • New test: dockerRun no longer passes session-env to docker run args — search the recorded run call for session-env, assert absent.

Out of scope

  • Reintroducing session-env for some future Claude Code version — if a new CLI release starts writing there, we add it back under a new rationale.
  • Migrating existing session-env dirs on the host (ops cleanup).

References

  • Added in earlier work targeting Claude Code 2.1.112.
  • Obsoleted by: #125 (projects/ bind).
  • Code sites: src/container-reconcile.ts:178-180, justfile (two spots).

Dependencies

  • Blocked by: nothing (#125 already merged).
  • Blocks: nothing.
  • Branch off: main.
## User story As a **maintainer**, I want the `session-env/` rw bind removed from the container config so that per-agent bind mounts are limited to the ones that actually serve a purpose — right now `session-env/` is dead code that just pollutes the mount list and the agent-env layout on disk. ## Context PR #125 landed the rw bind for `$CLAUDE_CONFIG_DIR/projects/`, which is where Claude Code 2.1.x actually persists session history. The earlier `session-env/` bind was added in v2.1.112 back when we thought the CLI wrote session state there; empirically 2.1.114 only ever creates empty UUID sub-dirs inside it and never writes content. The bind has been a no-op since before the projects-bind fix landed. Verification today (2026-04-20): across boss/dev/reviewer/designer/design-reviewer containers, every UUID directory inside `~/.config/claude-hooks/agent-env/<agent>/session-env/` is empty. The bind exists, a mkdir per-dispatch fires, nothing ever lands. ## Acceptance criteria - [ ] Remove the `${credsDir}/session-env:${CONTAINER_CLAUDE_CONFIG_DIR}/session-env:rw` mount from `src/container-reconcile.ts::dockerRun`. - [ ] Remove the corresponding `--volume` line from `justfile::containers-rebuild`. - [ ] Remove the `mkdir -p "$dir/session-env"` in `justfile::agent-env-sync` (keep the `projects/` pre-create). - [ ] Remove the `mkdir(join(credsDir, "session-env"), …)` in `dockerRun`. - [ ] Update `src/container-reconcile.test.ts`: drop any session-env mount entries from the "matching" dockerInspectJson fixtures — they stop being load-bearing. - [ ] `matchesDesired` no longer checks `session-env` mount (it already doesn't, but confirm by re-reading). - [ ] Update CLAUDE.md "Container credentials" section if it mentions session-env. ### Cleanup on disk (out of scope, but note) After merge + `just containers-rebuild`, operators can `rm -rf ~/.config/claude-hooks/agent-env/*/session-env/` to reclaim the empty directory tree. Don't bundle that into the PR — ops cleanup. ### Tests - [ ] All existing `container-reconcile.test.ts` tests still pass. - [ ] New test: `dockerRun` no longer passes `session-env` to `docker run` args — search the recorded run call for `session-env`, assert absent. ## Out of scope - Reintroducing `session-env` for some future Claude Code version — if a new CLI release starts writing there, we add it back under a new rationale. - Migrating existing session-env dirs on the host (ops cleanup). ## References - Added in earlier work targeting Claude Code 2.1.112. - Obsoleted by: #125 (projects/ bind). - Code sites: `src/container-reconcile.ts:178-180`, `justfile` (two spots). ## Dependencies - **Blocked by:** nothing (#125 already merged). - **Blocks:** nothing. - **Branch off:** `main`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#138
No description provided.