-
Notifications
You must be signed in to change notification settings - Fork 1
Resolve UUID connectors from only the newest session file #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -919,34 +919,36 @@ def _resolve_claude_code_session_connector(server_uuid: str) -> Optional[tuple]: | |
| if not _is_uuid(server_uuid): | ||
| return None | ||
| try: | ||
| files = [] | ||
| latest = None | ||
| latest_ts = -1.0 | ||
| for base in _claude_session_dirs(): | ||
| if not base or not base.exists(): | ||
| continue | ||
| try: | ||
| files.extend(base.glob('**/local_*.json')) | ||
| candidates = base.glob('*/*/local_*.json') | ||
| except Exception: | ||
| continue | ||
| if not files: | ||
| for f in candidates: | ||
| ts = _session_file_created_at(f) | ||
| if ts > latest_ts: | ||
| latest_ts, latest = ts, f | ||
| if latest is None: | ||
| return None | ||
|
|
||
| files.sort(key=_session_file_created_at, reverse=True) | ||
| for f in files: | ||
| try: | ||
| data = json.loads(f.read_text(encoding='utf-8')) | ||
| except Exception: | ||
| continue | ||
| for entry in (data.get('remoteMcpServersConfig') or []): | ||
| if isinstance(entry, dict) and (entry.get('uuid') or '').lower() == server_uuid.lower(): | ||
| name = entry.get('name') | ||
| if not name: | ||
| continue | ||
| cfg = {"additional_data": {"scope": "claude-connector"}} | ||
| url = entry.get('url') | ||
| if url: | ||
| cfg["url"] = url | ||
| cfg["type"] = "http" | ||
| return (name, cfg) | ||
| try: | ||
| data = json.loads(latest.read_text(encoding='utf-8')) | ||
| except Exception: | ||
| return None | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Newest session read failureMedium Severity After picking the newest Reviewed by Cursor Bugbot for commit 76188fe. Configure here.
zeus-12 marked this conversation as resolved.
|
||
| for entry in (data.get('remoteMcpServersConfig') or []): | ||
| if isinstance(entry, dict) and (entry.get('uuid') or '').lower() == server_uuid.lower(): | ||
| name = entry.get('name') | ||
| if not name: | ||
| continue | ||
| cfg = {"additional_data": {"scope": "claude-connector"}} | ||
| url = entry.get('url') | ||
| if url: | ||
| cfg["url"] = url | ||
| cfg["type"] = "http" | ||
| return (name, cfg) | ||
| return None | ||
| except Exception as exc: | ||
| log_error(f"mcp cc-session resolve error: {server_uuid}: {exc}", 'mcp_connector') | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
latest is None(either because the session directories are empty or because no*/*/local_*.jsonfiles matched), the function returnsNonesilently. With the fixed-depth glob replacing the old**/recursive glob, a depth mismatch — e.g., a future Claude version that nests files one level deeper — would produce exactly this silentNoneon every call, giving no indication in logs that the glob pattern is the problem.