Skip to content

fix: persist global room sessions in $HOME/.cf_session#3

Open
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:fix/global-session-persistence
Open

fix: persist global room sessions in $HOME/.cf_session#3
hai-pilgrim wants to merge 1 commit intomarksverdhei:mainfrom
hai-pilgrim:fix/global-session-persistence

Conversation

@hai-pilgrim
Copy link
Copy Markdown

Summary

  • Global rooms (in ~/.chatfiles/) now write their session to $HOME/.cf_session instead of .cf_session in the CWD
  • Local room sessions continue to use .cf_session in the CWD (directory-scoped, no behaviour change)
  • Added test_global_session_persists_across_directories test to cover the exact failure scenario from the issue

Root cause

register always wrote to .cf_session in the current directory. In agent workflows, each cf invocation may run from a different working directory, so subsequent commands couldn't find the session file.

The existing find_session already fell back to $HOME/.cf_session — the fix just makes register write there when the target chatfile is a global room.

Test plan

  • All 33 tests pass (bash test_cf.sh)
  • New test test_global_session_persists_across_directories reproduces the original bug and passes
  • Verify manually: cf register <global-room>, cd /tmp, cf status should now work

Closes #2

🤖 Generated with Claude Code

Global rooms (in ~/.chatfiles/) now write their session to
\$HOME/.cf_session instead of .cf_session in the CWD. This means
cf commands work from any directory after registering a global room,
fixing the issue where join succeeded but subsequent read/status
calls failed because .cf_session wasn't found in the new CWD.

Local room sessions continue to use .cf_session in the CWD for
directory-scoped isolation.

Closes marksverdhei#2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Session state not persisted across cf subcommands

2 participants