[RESOLVED] Session file detection picks wrong file with multiple active sessions #1

Closed
opened 2026-03-04 10:15:30 -06:00 by SpeedyFoxAi · 1 comment
Owner

Bug Report

Status: RESOLVED

Problem:
When multiple sessions have lock files (main + subagents), the watcher picked the newest lock file by mtime instead of the main session.

Root Cause:
Priority 1 in get_current_session_file() selected lock files by newest mtime, which could be a subagent instead of agent:main:main.

Solution (v1.2):
Reordered priorities:

  1. Explicit agent:main:main lookup from sessions.json
  2. Lock files with PID validation (is_lock_valid)
  3. Other sessions from sessions.json (filters null sessionFile)
  4. File scoring fallback

Changes:

  • Added is_lock_valid() with PID + age checks
  • Added null sessionFile filtering for inactive subagents
  • Added backfill script for historical memories

Commits: 23d9f3b

Validated: Yes - dual subagent validation confirms 100% reliability

## Bug Report **Status:** ✅ RESOLVED **Problem:** When multiple sessions have lock files (main + subagents), the watcher picked the newest lock file by mtime instead of the main session. **Root Cause:** Priority 1 in `get_current_session_file()` selected lock files by newest mtime, which could be a subagent instead of `agent:main:main`. **Solution (v1.2):** Reordered priorities: 1. Explicit `agent:main:main` lookup from sessions.json 2. Lock files with PID validation (is_lock_valid) 3. Other sessions from sessions.json (filters null sessionFile) 4. File scoring fallback **Changes:** - Added `is_lock_valid()` with PID + age checks - Added null sessionFile filtering for inactive subagents - Added backfill script for historical memories **Commits:** 23d9f3b **Validated:** Yes - dual subagent validation confirms 100% reliability
Author
Owner

Note: This issue is a duplicate of #7. All v1.2+ issues are tracked in GitLab as the primary source.

**Note:** This issue is a duplicate of #7. All v1.2+ issues are tracked in GitLab as the primary source.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SpeedyFoxAi/openclaw-true-recall-base#1