-
Notifications
You must be signed in to change notification settings - Fork 0
Fix import command to search home directory for session files #9
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
Conversation
When using a session file pattern (rlm-session-*.json), the import command now checks the home directory first, where session files are actually stored. This fixes the issue where workers' session files were unfindable when the parent runs from a different working directory. - Add session pattern detection in ImportCommand - Check home directory when pattern matches session files and CWD has no matches - Add GetHomeDirectory helper method - Add ImportCommandTests with 4 test cases for the fix and backwards compatibility Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Pull request overview
This PR fixes an issue where the import command couldn't find session files created by workers when the parent process runs from a different working directory. Session files are always stored in the user's home directory (managed by SessionStore), but the import command was only searching in the current working directory. The fix adds logic to detect session file patterns and automatically search the home directory when appropriate.
Changes:
- Add session pattern detection in ImportCommand to identify
rlm-session-*.jsonpatterns - Implement automatic home directory fallback when session patterns are used from CWD with no matches
- Add GetHomeDirectory helper method to ImportCommand
- Add comprehensive test suite with 4 test cases covering the fix and backwards compatibility
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Solutions/Rlm.Cli/Commands/ImportCommand.cs | Adds session file pattern detection (lines 51-70) and GetHomeDirectory helper method (lines 125-136) to enable automatic home directory lookup for session files |
| Solutions/Rlm.Cli.Tests/Commands/ImportCommandTests.cs | Adds new test file with 4 comprehensive test cases validating the fix works, backwards compatibility is maintained, and edge cases are handled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Extract GetSessionDirectory() to ISessionStore interface to eliminate duplicate GetHomeDirectory() logic in ImportCommand - Handle default session file pattern (.rlm-session.json) in addition to named session patterns (rlm-session-*.json) - Remove unused result variable in test Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Coverage Summary Report - Linux (No TFM)Summary
Coveragerlm - 65.9%
|
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.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Solutions/Rlm.Cli/Commands/ImportCommand.cs:83
- The code performs a redundant file search when session files are found in the home directory. At line 64, it searches the home directory with GetFiles(), and then if files are found, it sets directory to homeDir and searches again at line 83 with the same pattern. Consider reusing the homeFiles array to avoid the duplicate search operation.
IFile[] homeFiles = homeDirectory.GetFiles(pattern, SearchScope.Current).ToArray();
if (homeFiles.Length > 0)
{
directory = homeDir;
console.MarkupLine($"[dim]Found session files in home directory[/]");
}
}
}
if (string.IsNullOrEmpty(pattern))
{
console.MarkupLine($"[red]Error:[/] Invalid pattern: {settings.Pattern}");
return 1;
}
IFile[] files;
try
{
IDirectory dir = fileSystem.GetDirectory(directory);
files = dir.GetFiles(pattern, SearchScope.Current).ToArray();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When using a session file pattern (rlm-session-*.json), the import command now checks the home directory first, where session files are actually stored. This fixes the issue where workers' session files were unfindable when the parent runs from a different working directory.
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com