Open kgilpin opened 1 month ago
Problem: Navie's history management encounters failures in creating symbolic links (symlinks) on Windows due to permission issues, causing the application to crash with an 'EPERM' error.
Analysis: The primary issue stems from the fact that symlinks require administrative permissions on Windows. Without these permissions, attempts to create a symlink will fail, resulting in application errors. The current implementation doesn't handle these errors gracefully, leading to application crashes.
The proposed changes aim to remove dependency on symlinks for history management in Navie. Instead, the history mechanism is refactored to use regular file operations, thus bypassing symlink creation and the associated permission issues.
File Handling Changes:
createSymlinkIfNotExists
function and symlink creations.LocalHistory
class to manage Navie's history using regular file operations.Permissions and Behavior:
Error Handling and Logging:
Failure Modes:
Proposed Changes:
Removal of History Initialization and Symlink Creation Logic:
initializeHistory
and createSymlinkIfNotExists
functions are removed.loadThreadHandler
is eliminated along with associated symlink and history creation setup.Refactored History Management:
LocalHistory
class to save and restore conversation history without symlinks.LocalHistory
handle regular file reads and writes for storing messages.Refactoring Navie Local and Remote Behavior:
navie-local.ts
is modified to use the LocalHistory
class for handling conversation history.navie-remote.ts
, ensuring consistent interfaces for local and remote operations.Error Handling:
Changes Summary:
File: packages/cli/src/rpc/explain/navie/history.ts
:
File: packages/cli/src/rpc/explain/navie/historyHelper.ts
:
File: packages/cli/src/rpc/explain/navie/navie-local.ts
:
LocalHistory
class definition.LocalHistory
for saving and restoring conversations.File: packages/cli/src/rpc/explain/navie/navie-remote.ts
:
LocalHistory
class.File: packages/cli/src/cmds/index/rpc.ts
:
File: packages/client/src/aiClient.ts
:
Additional Logging across affected files to ensure errors are captured effectively offering insights into any failures that happened.
By refactoring to remove symlink dependencies, Navie's history management should work seamlessly across different operating systems without demanding elevated permissions. This change should also maintain overall functionality while improving reliability and error handling.
Error example
Patch 1
Patch 2
Directives