Fix #284: concurrent-session registry + bridge-ID publish#314
Open
ericleepi314 wants to merge 1 commit into
Open
Fix #284: concurrent-session registry + bridge-ID publish#314ericleepi314 wants to merge 1 commit into
ericleepi314 wants to merge 1 commit into
Conversation
…284) Two Python bridges in the same workspace did not dedup — the TS updateSessionBridgeId() publish was a TODO-noop and the registry module didn't exist. - src/utils/concurrent_sessions.py ports utils/concurrentSessions.ts: PID files under ~/.clawcodex/sessions/, cleanup-before-write ordering, session-switch refresh, strict <pid>.json filename guard (TS #34210), pid<=1 probe guard, WSL-aware stale sweep chained after registration (TS main.tsx); BG_SESSIONS/UDS_INBOX subsetting and the EPERM-alive probe divergence are documented - set_repl_bridge_handle publishes get_self_bridge_compat_id() on every set/clear so peer enumeration dedups a session reachable over both UDS and bridge (clearing prevents a stale ID from suppressing a legitimately-remote session after reconnect) - remote_io wires session_id from bootstrap get_session_id() (the TS getSessionId() parity TODO) - register_session() wired into the TUI/headless/REPL entrypoints, fail-soft Closes #284 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #284
Summary
Two concurrent Python bridges in the same workspace didn't dedup — both appeared in claude.ai/code session lists. The TS
updateSessionBridgeId()publish was a TODO-noop andutils/concurrentSessionshad no Python port.src/utils/concurrent_sessions.py— faithful port oftypescript/src/utils/concurrentSessions.ts(reviewed against the TS source): per-session PID files under~/.clawcodex/sessions/, cleanup-registered-before-write ordering (a crash after the write still reaps the file), session-switch keepssessionIdfresh, the strict^\d+\.json$filename guard (TS issue #34210 — a lenient prefix-parse swept user files as "stale"),pid <= 1probe guard, WSL-aware stale sweep chained after registration (TSmain.tsxparity). Deliberate subsetting (BG_SESSIONS/UDS_INBOX fields) and the EPERM→alive probe divergence are documented in-module.set_repl_bridge_handlenow publishesupdate_session_bridge_id(get_self_bridge_compat_id())on every set/clear — setting records thesession_*compat ID for peer dedup; clearing publishesNoneso a stale ID can't suppress a legitimately-remote session after reconnect.remote_io:session_idwired from bootstrapget_session_id()(closes the in-codeTODO(parity)the issue references; transport consumers verified to use it for logging/task-naming only).register_session()wired into the three session entrypoints (TUI / headless / REPL), fail-soft.Test plan
set_repl_bridge_handle(incl. thecse_*→session_*retag); name updates; counting with stale sweep, live-peer, pid≤1 sweep, missing dir, and the #34210 bystander-file guard (asserts contents survive)None) to pinning the bootstrap ID🤖 Generated with Claude Code