Skip to content

Conversation

@HowardvanRooijen
Copy link
Member

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

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>
Copilot AI review requested due to automatic review settings January 31, 2026 11:34
@github-actions
Copy link

github-actions bot commented Jan 31, 2026

Test Results

398 tests  +4   398 ✅ +4   6s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 666b843. ± Comparison against base commit ba4114f.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a 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-*.json patterns
  • 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>
@github-actions
Copy link

Code Coverage Summary Report - Linux (No TFM)

Summary
Generated on: 01/31/2026 - 11:47:30
Parser: Cobertura
Assemblies: 1
Classes: 68
Files: 69
Line coverage: 65.9% (3992 of 6056)
Covered lines: 3992
Uncovered lines: 2064
Coverable lines: 6056
Total lines: 8701
Branch coverage: 56.2% (1430 of 2542)
Covered branches: 1430
Total branches: 2542
Method coverage: Feature is only available for sponsors

Coverage

rlm - 65.9%
Name Line Branch
rlm 65.9% 56.2%
Program 0% 0%
Rlm.Cli.Commands.AggregateCommand 92.5% 87.5%
Rlm.Cli.Commands.AggregateCommand.Settings 100%
Rlm.Cli.Commands.ChunkCommand 95.4% 77.1%
Rlm.Cli.Commands.ChunkCommand.Settings 100%
Rlm.Cli.Commands.ClearCommand 88% 78.5%
Rlm.Cli.Commands.ClearCommand.Settings 100%
Rlm.Cli.Commands.FilterCommand 100% 100%
Rlm.Cli.Commands.FilterCommand.Settings 100%
Rlm.Cli.Commands.ImportCommand 83% 87.5%
Rlm.Cli.Commands.ImportCommand.Settings 100%
Rlm.Cli.Commands.InfoCommand 42.3% 30.3%
Rlm.Cli.Commands.InfoCommand.Settings 100%
Rlm.Cli.Commands.JumpCommand 93.3% 76.9%
Rlm.Cli.Commands.JumpCommand.Settings 100%
Rlm.Cli.Commands.LoadCommand 44.2% 31.2%
Rlm.Cli.Commands.LoadCommand.Settings 66.6%
Rlm.Cli.Commands.NextCommand 64.7% 57.1%
Rlm.Cli.Commands.NextCommand.Settings 100%
Rlm.Cli.Commands.ResultsCommand 100% 100%
Rlm.Cli.Commands.SkipCommand 94.3% 84.3%
Rlm.Cli.Commands.SkipCommand.Settings 100%
Rlm.Cli.Commands.SliceCommand 89.7% 82.1%
Rlm.Cli.Commands.SliceCommand.Settings 100%
Rlm.Cli.Commands.StoreCommand 84.2% 83.3%
Rlm.Cli.Commands.StoreCommand.Settings 100%
Rlm.Cli.Core.Chunking.ChunkProcessorChain 100% 100%
Rlm.Cli.Core.Chunking.ChunkStatisticsProcessor 100% 100%
Rlm.Cli.Core.Chunking.ContentChunk 100%
Rlm.Cli.Core.Chunking.FilteringChunker 96.6% 93.7%
Rlm.Cli.Core.Chunking.FilteringChunker.Segment 100%
Rlm.Cli.Core.Chunking.RecursiveChunker 94.7% 87.5%
Rlm.Cli.Core.Chunking.RecursiveChunker.ChunkSegment 100%
Rlm.Cli.Core.Chunking.SemanticChunker 52.3% 37.5%
Rlm.Cli.Core.Chunking.SemanticChunker.Section 100%
Rlm.Cli.Core.Chunking.TokenBasedChunker 98.5% 87.5%
Rlm.Cli.Core.Chunking.UniformChunker 100% 83.3%
Rlm.Cli.Core.Documents.CompositeDocumentReader 53.8% 33.3%
Rlm.Cli.Core.Documents.ContentCleaningProcessor 100% 100%
Rlm.Cli.Core.Documents.DocumentMetadata 100%
Rlm.Cli.Core.Documents.DocumentProcessorChain 100% 100%
Rlm.Cli.Core.Documents.DocumentReaderExtensions 12.5% 5.8%
Rlm.Cli.Core.Documents.FileDocumentReader 48.5% 15.5%
Rlm.Cli.Core.Documents.HtmlDocumentReader 19.3% 18.1%
Rlm.Cli.Core.Documents.JsonDocumentReader 9.4% 12.5%
Rlm.Cli.Core.Documents.MarkdownDocumentReader 5.8% 8.3%
Rlm.Cli.Core.Documents.MetadataExtractionProcessor 100% 92%
Rlm.Cli.Core.Documents.PdfDocumentReader 9.4% 11.1%
Rlm.Cli.Core.Documents.RlmDocument 100%
Rlm.Cli.Core.Documents.StdinDocumentReader 4.3% 0%
Rlm.Cli.Core.Documents.WordDocumentReader 98.3% 82.5%
Rlm.Cli.Core.Output.AggregateOutput 100%
Rlm.Cli.Core.Output.ChunkOutput 100%
Rlm.Cli.Core.Output.SessionInfoOutput 0%
Rlm.Cli.Core.Session.ResultBuffer 100% 100%
Rlm.Cli.Core.Session.RlmSession 100% 100%
Rlm.Cli.Core.Validation.CompositeValidator 100% 100%
Rlm.Cli.Core.Validation.RangeValidator 100% 100%
Rlm.Cli.Core.Validation.SyntacticValidator 94.1% 94.4%
Rlm.Cli.Core.Validation.ValidationResult 100%
Rlm.Cli.Infrastructure.RlmCommandSettings 100%
Rlm.Cli.Infrastructure.RlmJsonContext 63% 65.8%
Rlm.Cli.Infrastructure.SessionStore 93.5% 86.3%
Rlm.Cli.Infrastructure.TypeRegistrar 100%
Rlm.Cli.Infrastructure.TypeResolver 100% 100%
System.Text.RegularExpressions.Generated 65.1% 47.8%
System.Text.RegularExpressions.Generated.RunnerFactory
System.Text.RegularExpressions.Generated.RunnerFactory.Runner

Copy link

Copilot AI left a 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.

@HowardvanRooijen HowardvanRooijen merged commit 291052b into main Jan 31, 2026
8 checks passed
@HowardvanRooijen HowardvanRooijen deleted the feature/path-consistency branch January 31, 2026 11:53
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.

2 participants