Skip to content

fix(proxies): move shared sessions.json to ~/.local/state/cli-proxies (#3067) - #3072

Merged
dezren39 merged 1 commit into
mainfrom
fix/proxy-sessions-state-dir
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/proxy-sessions-state-dir

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Completes the missed remainder of the #2782/#2784 proxy state-dir move. That move relocated the CLI proxies' WORKDIR state (bin/work/) to ~/.local/state/cli-proxies, but the commandcode + claude-code key->session map was anchored to the scripts' own directory -- bin/sessions.json -- so the primary checkout kept dirtying with every session write and pm-git-sync stayed blocked.

Changes

  • bin/commandcode-proxy.mjs — SESSION_FILE gains a COMMANDCODE_PROXY_SESSION_FILE env override (mirroring claude-code's existing pattern); the default now resolves to the shared state root (~/.local/state/cli-proxies/sessions.json, XDG_STATE_HOME-aware, same expression shape as codex-proxy's sessionStateDir). The state dir is mkdir-ed at startup, like WORKROOT already is.
  • bin/claude-code-proxy.mjs — SESSION_FILE default moves from PROXY_DIR to the same shared state-root path; env override kept. Stale header comment ("sessions.json in the proxy dir") corrected.
  • home/common/default.nix — commandcode-proxy and claude-code-proxy units pin COMMANDCODE_PROXY_SESSION_FILE / CLAUDE_CODE_PROXY_SESSION_FILE to %h/.local/state/cli-proxies/sessions.json alongside the existing *_PROXY_WORKDIR pins. Both units name the SAME file: the two proxies share one map (mirrored key space).

Codex audit

bin/codex-proxy.mjs already resolves sessions.json via sessionStateDir() = $XDG_STATE_HOME/codex-proxy, falling back to ~/.local/state/codex-proxy -- always outside the checkout. No change needed. muse-proxy uses warm-sessions.json under WORKDIR (moved by #2782) -- untouched.

Deliberately NOT done

  • No .gitignore entry for bin/sessions.json (Drew's ruling): after this fix nothing may write there; dirt in the primary checkout is the regression tripwire.
  • No merge/deploy in this PR step -- deploy (unit restart + one-time migration of the live bin/sessions.json) happens separately.

Verified on the laptop

  • node --check clean on both touched proxies.
  • node --test: commandcode-proxy.test.mjs 1/1 pass, claude-code-proxy.test.mjs 5/5 pass (no test asserted the old default path; claude-code tests already use the env override).
  • nix-instantiate --parse home/common/default.nix: rc=0.
  • Default-path expression resolves to /home/user/.local/state/cli-proxies/sessions.json.

Closes the code side of #3067.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…#3067)

The commandcode + claude-code session map was anchored to PROXY_DIR (bin/sessions.json), so the #2782 workdir move to ~/.local/state/cli-proxies missed it and the tracked checkout kept dirtying with every session write, blocking pm-git-sync.

- commandcode-proxy: add COMMANDCODE_PROXY_SESSION_FILE override (mirrors claude-code pattern); default resolves to the shared state root sessions.json.
- claude-code-proxy: SESSION_FILE default moves from PROXY_DIR to the same shared state-root path; env override kept. Both proxies share one map (mirrored key space) so both must resolve to the same file.
- home/common: pin COMMANDCODE_PROXY_SESSION_FILE and CLAUDE_CODE_PROXY_SESSION_FILE to %h/.local/state/cli-proxies/sessions.json on both units, alongside the existing *_PROXY_WORKDIR pins.

Codex audit: bin/codex-proxy.mjs already resolves sessions.json via sessionStateDir() = $XDG_STATE_HOME/codex-proxy or ~/.local/state/codex-proxy -- outside the checkout, no change needed. muse-proxy uses warm-sessions.json under WORKDIR (moved by #2782), untouched.

No .gitignore entry for bin/sessions.json, by design: after this fix nothing may write there, and dirt in the primary checkout is the regression tripwire.

Verified: node --check on both proxies; node --test bin/commandcode-proxy.test.mjs (1 pass) and bin/claude-code-proxy.test.mjs (5 pass); nix-instantiate --parse home/common/default.nix rc=0; default path expression resolves to /home/user/.local/state/cli-proxies/sessions.json.
@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 13:36
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 6 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7fd7e320-95f4-4954-9869-1ec24581510d
Commits

Reviewing files that changed from the base of the PR and between 5ff5d3c and 65df622.

Files selected for processing: 3
  • bin/claude-code-proxy.mjs
  • bin/commandcode-proxy.mjs
  • home/common/default.nix
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T13:37:13.433712Z 65df622 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit 2854c40 into main Oct 31, 2026
1 check passed
@dezren39
dezren39 deleted the fix/proxy-sessions-state-dir branch October 31, 2026 13:36
dezren39 added a commit that referenced this pull request Oct 31, 2026
…in state dirs now (#3067)

The file was the CLI proxies shared key->session map back when it was anchored to the scripts own directory. Since #3072 the commandcode and claude-code units pin their *_PROXY_SESSION_FILE to ~/.local/state/cli-proxies/sessions.json, codex-proxy keeps its map under ~/.local/state/codex-proxy, and the opencode-route and design-code proxies keep no session map at all. Verified live 2026-10-31 by process environment and source inspection: no running proxy reads or writes this path. Keeping it tracked only dirtied the primary checkout and blocked pm-git-sync. Deliberately not gitignored (Drews rule): a future regression writing here should show up as dirt, not be hidden.
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.

1 participant