-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix: project paths with hyphens incorrectly parsed #382
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
Fix: project paths with hyphens incorrectly parsed #382
Conversation
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 a bug where project paths containing hyphens were incorrectly displayed with slashes due to inadequate cwd parsing in session files. The fix improves session file parsing by checking multiple lines instead of just the first line to find valid cwd values. Additionally, it includes a compilation fix for missing installation_type field in NVM installations and applies general code formatting improvements.
- Enhanced get_project_path_from_sessions() to check up to 10 lines for valid cwd instead of just the first line
- Fixed compilation error by adding missing installation_type field for NVM Claude installations
- Applied code formatting and style improvements across multiple files
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src-tauri/src/process/registry.rs | Code formatting improvements including multiline struct initialization and consistent closure syntax |
src-tauri/src/main.rs | Import organization and multiline formatting for better readability |
src-tauri/src/commands/storage.rs | Import reordering and multiline formatting for query building and function calls |
src-tauri/src/commands/slash_commands.rs | Function signature formatting and directory creation simplification |
src-tauri/src/commands/proxy.rs | Import reordering and multiline tuple formatting |
src-tauri/src/commands/mod.rs | Module import alphabetization |
src-tauri/src/commands/claude.rs | Core bug fix for session parsing plus extensive formatting improvements |
src-tauri/src/commands/agents.rs | Formatting improvements for logging and multiline function calls |
src-tauri/src/claude_binary.rs | Bug fix for missing installation_type field and code formatting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
path: claude_path.to_string_lossy().to_string(), | ||
version, | ||
source: "nvm-active".to_string(), | ||
installation_type: InstallationType::System, |
Copilot
AI
Oct 6, 2025
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.
NVM installations should use InstallationType::Nvm instead of InstallationType::System to accurately represent the installation method and source.
Copilot uses AI. Check for mistakes.
This fixes a bug where project paths containing hyphens (e.g., `~/projects/flipside/data-discovery`) were incorrectly displayed with hyphens replaced by slashes (`~/projects/flipside/data/discovery`). The root cause was that `get_project_path_from_sessions()` only checked the first line of JSONL session files for the `cwd` field. Some session files have `null` or empty `cwd` values on the first line. Changes: - Modified `get_project_path_from_sessions()` to check up to 10 lines for a valid, non-empty `cwd` value instead of just the first line - Added comprehensive unit tests covering the bug scenario and edge cases - Fixed missing `installation_type` field in `claude_binary.rs` that was causing compilation errors Tests: All 8 new unit tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
5bf65b0
to
3631d94
Compare
@claude review this |
Claude encountered an error —— View job
I'll analyze this and get back to you. |
@claude You encountered this error when trying to review this because this PR is from a downstream fork of this repo |
Hi @ShahNewazKhan I'm trying to understand how people use opcode and update our roadmap to make it better. If you have a few minutes, I'd love your input here: form link; this takes only 3 minutes. |
Projects with hyphens in their paths (e.g.,
data-discovery
) were being incorrectly displayed with the hyphen replaced by a slash (data/discovery
).Root cause: The
get_project_path_from_sessions()
function only checked the first line of sessionJSONL
files for the 'cwd' field. Some session files have null cwd on the first line, causing the fallback to the buggydecode_project_path()
which blindly replaces all hyphens with slashes.Fix: Check up to the first 10 lines of session files to find a valid, non-empty cwd value before falling back to path decoding.
Also fixes compilation error in claude_binary.rs where ClaudeInstallation was missing the installation_type field for NVM installations.
🤖 Generated with Claude Code