Skip to content

provider proxies keep session state in the repo tree (bin/sessions.json) — move to ~/.local/state #3067

Closed

Description

@dezren39

The local provider proxies (bin/commandcode-proxy.mjs, bin/codex-proxy.mjs, bin/claude-code-proxy.mjs) read/write their session-affinity map at bin/sessions.json — inside the tracked repo tree, next to the scripts.

Verified 2026-10-31: the file holds OpenCode session ids (ses_…) mapped to upstream session state, and it is LIVE — modified 08:16 CDT today by this morning's OpenChamber scheduled-lane runs going through the proxies.

Problems:

  1. The laptop primary clone (~/git/code) is permanently dirty, so pm-git-sync refuses to ff-pull it (on-main + clean rule) — the primary silently falls behind origin/main. This bit the 2026-10-31 OpenClaw route-only deploy (PR openclaw: route models only through the opencode-route door #3065), which had to deploy from a clean worktree instead.
  2. Runtime state does not belong in a tracked tree — precedent: pm-aggregator's runtime state was moved to ~/.local/state/pm-aggregator/ on 2026-10-27 for exactly this reason.

Fix: point the proxies' session-state path at ~/.local/state//sessions.json (env-overridable, default out-of-tree), migrate the live file once, and drop bin/sessions.json from the tree (gitignore the path defensively so a regression cannot re-dirty the primary).

Activity

  1. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    Scope correction (2026-10-31, after Drew's question): yesterday's move DID happen — PRs #2782/#2784 moved the proxies' WORKDIR state (bin/work/: warm-sessions.json, sessions/, acp-project) to ~/.local/state/cli-proxies. bin/sessions.json is a different path and was MISSED by that fix:

    • bin/commandcode-proxy.mjs:428 — SESSION_FILE = path.join(PROXY_DIR, 'sessions.json'), anchored to the script's own directory, no env override.
    • bin/claude-code-proxy.mjs:52 — SESSION_FILE = env CLAUDE_CODE_PROXY_SESSION_FILE || path.join(PROXY_DIR, 'sessions.json'); the override exists but no unit sets it, so it defaults into bin/ too. (The two proxies share this file / mirrored key space, so the fix must land both on the SAME new path.)
    • bin/muse-proxy.mjs — warm-sessions.json resolves under WORKDIR; that one moved correctly.
    • bin/codex-proxy.mjs — sessions.json resolves via sessionStateDir(); audit in the fix.

    Fix in flight: env-overridable session-file path for commandcode-proxy mirroring claude-code's, both units pointed at ~/.local/state/cli-proxies/sessions.json in home/common/default.nix, live file migrated on deploy.

  2. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    Correction per Drew (2026-10-31): do NOT gitignore the old bin/sessions.json path. After the fix nothing may write there at all — a gitignore would mask a regression. The dirty primary is the tripwire: if bin/sessions.json ever reappears as dirt, that is the signal the fix leaked. (Same reasoning as Drew's 2026-10-29 call on the bin/work residue: moved intact, deliberately not gitignored.) The fix is: env-overridable session-file paths + both proxy units pointed at ~/.local/state/cli-proxies/sessions.json + one-time migration of the live file. Nothing else.

  3. added 2 commits that reference this issue on Oct 31, 2026
  4. dezren39 commented on Oct 31, 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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions