Skip to content

Conversation

ShahNewazKhan
Copy link
Contributor

@ShahNewazKhan ShahNewazKhan commented Oct 6, 2025

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 session JSONL files for the 'cwd' field. Some session files have null cwd on the first line, causing the fallback to the buggy decode_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

@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 20:25
Copy link

@Copilot 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 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,
Copy link

Copilot AI Oct 6, 2025

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]>
@ShahNewazKhan ShahNewazKhan force-pushed the fix/project-path-hyphen-bug branch from 5bf65b0 to 3631d94 Compare October 6, 2025 20:48
@123vivekr
Copy link
Member

@claude review this

Copy link

claude bot commented Oct 10, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@ShahNewazKhan
Copy link
Contributor Author

Claude encountered an error —— View job

Failed with exit code 128

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

@123vivekr 123vivekr merged commit 92825e5 into winfunc:main Oct 11, 2025
@123vivekr
Copy link
Member

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.

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