Skip to content

proxies(workdir): PR #2782 points all three CLI proxies at one shared workroot — commandcode and claude-code session workdirs collide on identical keys, and muse sessions run at the shared root #2785

Closed

Description

@dezren39

Summary

PR #2782 (merged today, commit edab2d29) points all three CLI proxy home-manager units at one shared workroot, %h/.local/state/cli-proxies (home/common/default.nix:757,786,823). The three proxies' on-disk layouts were designed for private workroots, and two of them collide exactly: commandcode-proxy and claude-code-proxy derive per-conversation workdirs with the same function over the same key space — WORKROOT/sessions/<sha256(key)[:16]> — so the same conversation key now maps to the same directory in both proxies. muse-proxy compounds it: it runs its sessions with the workroot itself as cwd/workspace root, which is now the parent directory of the other two proxies' session trees.

Evidence (verified this run on main 35c4c9c6)

  • One env value for three units: home/common/default.nix sets COMMANDCODE_PROXY_WORKDIR (:757), CLAUDE_CODE_PROXY_WORKDIR (:786), and MUSE_PROXY_WORKDIR (:823) all to %h/.local/state/cli-proxies. Before feat(proxies): CLI proxy workroots -> ~/.local/state/cli-proxies #2782 each proxy defaulted to its own bin/work under its own proxy dir.
  • Identical workdir derivation:
    • bin/commandcode-proxy.mjs:516-520: sessionWorkdirFor(key) = path.join(WORKROOT, 'sessions', sha256(key).slice(0,16)).
    • bin/claude-code-proxy.mjs:230-234: the same body, verbatim.
  • Identical key space, by design: bin/claude-code-proxy.mjs:194-198 says its getSessionKey "mirrors commandcode-proxy's getSessionKey" — same sources in the same order: explicit x-session-id/session_id/… headers and body fields, then user:<user>, then turn0:<sha256(first user message)[:16]> (commandcode's at :472, claude-code's at :198-224). Keys are client/conversation attributes, not proxy attributes: an OpenCode session that switches provider, or two requests whose first user message is identical, produce the same key in both proxies.
  • Laptop probe (~/git/fleet/probe-2026-10-30-laneB-sharedworkroot/, functions extracted verbatim from the real files — commandcode-proxy.mjs md5 b3bce253…, claude-code-proxy.mjs md5 7280c4bb…, both byte-identical to this main — with WORKROOT set to one shared dir): for an explicit session id, for user:drew, and for a turn0: key, both functions returned the identical path (<shared>/sessions/<same hash>) in all three cases, and both created the same directories.
  • The muse side: bin/muse-proxy.mjs:50-51 takes WORKDIR as its root, runs sessions with cwd: WORKDIR (:455, :1673) and workspaceRoots: [WORKDIR] (:572), persists warm-sessions.json at its root (:319-320) and writes prompt-<uuid>.txt files there (:1651). With the shared root, a muse session's workspace is the directory containing commandcode's and claude-code's sessions/ trees and commandcode's resident-ACP project dir (bin/commandcode-proxy.mjs:553: WORKROOT/acp-project).

Why it matters

The per-conversation workdir exists so an agency agent's file work is confined to its own conversation (both proxies steer the CLI: do ALL file work inside this dir). Sharing the derivation and the root breaks that confinement across providers:

  • A conversation continued on the other provider (same session id — the normal provider-switch path) lands in the previous provider's workdir: it inherits the other agent's half-finished files as its own starting state, and its writes mutate the first conversation's dir.
  • Two unrelated conversations with the same first user message (the turn0: fallback — e.g. the same task prompt sent to two providers to compare) silently share one workdir even within the intended one-conversation-per-dir model.
  • A muse session runs at the shared root, so its file tools can read, modify, or delete the other proxies' live per-conversation directories and acp-project state — state the other proxies treat as private.

Each proxy's own state files are safe (commandcode/claude-code keep sessions.json in their proxy dirs, not the workroot); this is specifically the workdir tree that #2782 merged.

Acceptance criteria

  • The three units no longer share one flat workroot: each proxy gets its own subtree (e.g. %h/.local/state/cli-proxies/{commandcode,claude-code,muse} in home/common/default.nix, or a per-proxy subdirectory derived inside each proxy), so sessionWorkdirFor outputs can never coincide across proxies.
  • muse-proxy's session cwd/workspace root is its own subtree, not the parent of the other proxies' sessions//acp-project trees.
  • A regression test (following the bin/*.test.mjs pattern) pins that the three proxies' workdir derivations, given the same key and the deployed env values, produce disjoint directories — or, if the fix is env-only, a check/test on the rendered unit env values asserting three distinct workroots.
  • Existing per-proxy behaviour is unchanged apart from the root path: same key derivation, same sessions/<hash> layout inside each proxy's own root, warm-session files still found after the move (migration of existing state at the shared root is considered, per feat(proxies): CLI proxy workroots -> ~/.local/state/cli-proxies #2782's "runtime state preserved/moved at deploy time" note).

Dedup

Searched open + closed issues for cli-proxies / shared workdir / WORKDIR collision terms this run: no filing. PR #2782 is the change that introduced the sharing (its stated goal — moving runtime state out of the primary checkout — is not in dispute; the collision is in the choice of one identical value for all three). Adjacent: #2780/#2770 are muse-proxy translator bugs in the same file family, different mechanism; #2753 is the muse-direct feature.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/normalOrdinary priority (the default)
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/muse-proxybin/muse-proxy.mjs OpenAI-compatible Muse bridge
    effort/xsTrivial: expected under 30 minutes of work
    on Oct 30, 2026
  2. dezren39 commented on Oct 30, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator-code-b (issue creator, Lane B)
    • Session / ID: new-issue-creator-code-b run 2026-10-30 10:50 CDT
    • Found via: filed this run
    • Task: Triage the shared-workroot collision from PR feat(proxies): CLI proxy workroots -> ~/.local/state/cli-proxies #2782: commandcode-proxy and claude-code-proxy derive identical per-conversation workdirs under the one shared cli-proxies root, and muse-proxy sessions run at that root — pin the per-proxy subtree split, then route the fix.
    • Expectation: effort/xs — done when each proxy has its own workroot subtree and a test/check pins the three derivations disjoint for the same key.
    • Links: Evidence + laptop probe in the issue body; queue packet to follow.
  3. 7 remaining items

  4. added
    status/triagedTriaged and routed (see agent note)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    and removed
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  7. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/claude-code-proxybin/claude-code-proxy.mjsapp/commandcode-proxybin/commandcode-proxy.mjs fleet proxyapp/muse-proxybin/muse-proxy.mjs OpenAI-compatible Muse bridgeeffort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus/triagedTriaged and routed (see agent note)task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions