Skip to content

Conversation

@tiensi
Copy link
Contributor

@tiensi tiensi commented Nov 11, 2025

Summary

Replaced user facing to_string_lossy with display calls as recommended per issue here

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

N/A

Related Issues

Relates to #5435

for component in components.iter().skip(len - 2) {
path_str.push('/');
path_str.push_str(component.as_os_str().to_string_lossy().as_ref());
path_str.push_str(component.as_os_str().display().as_ref());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayed in commandline later in line 76

name,
source: RecipeSource::Local,
path: path.to_string_lossy().to_string(),
path: path.display().to_string(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

displayed later in commands/recipe.rs

goose::recipe::template_recipe::parse_recipe_content(
&rf.content,
Some(rf.parent_dir.to_string_lossy().to_string()),
Some(rf.parent_dir.display().to_string()),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used for tracing (printing?) in line 1120

let search_dirs_str = search_dirs
.iter()
.map(|p| p.to_string_lossy())
.map(|p| p.display().to_string())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

part of error on line 67. Not 100% certain whether errors are consumed by user.

@tiensi tiensi marked this pull request as ready for review November 11, 2025 02:29
Copilot AI review requested due to automatic review settings November 11, 2025 02:29
Copy link
Contributor

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 attempts to replace to_string_lossy() with display() for user-facing path text across multiple files to improve handling of non-UTF-8 paths. However, the implementation introduces compilation errors by calling .display() on OsStr/OsString types which don't have this method.

  • Replaces to_string_lossy() with display() in 6 files
  • Affects error messages, directory listings, and path formatting
  • Changes span across CLI, MCP, and core recipe loading code

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/goose/src/recipe/local_recipes.rs Updates error message path formatting in recipe file loading
crates/goose-mcp/src/developer/text_editor.rs Changes directory entry name handling
crates/goose-cli/src/recipes/search_recipe.rs Updates path display in recipe listing
crates/goose-cli/src/commands/session.rs Modifies path filtering in session list command
crates/goose-cli/src/commands/project.rs Changes path component formatting in two locations
crates/goose-cli/src/cli.rs Updates recipe parent directory path handling

@tiensi tiensi force-pushed the tiensi/issue-5435-cleanup-display-and-lossy branch from 0080343 to 07c2156 Compare November 11, 2025 02:32
Signed-off-by: Vincent Huang <[email protected]>
Copilot AI review requested due to automatic review settings November 11, 2025 02:33
Copy link
Contributor

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 6 out of 6 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings November 11, 2025 02:55
Copy link
Contributor

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines 64 to 68
let search_dirs_str = search_dirs
.iter()
.map(|p| p.to_string_lossy())
.map(|p| p.display().to_string())
.collect::<Vec<_>>()
.join(":");
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded ":" separator on line 68 is incorrect for Windows. The code uses platform-specific separators (';' for Windows, ':' for Unix) when parsing GOOSE_RECIPE_PATH on line 26. Use the same logic here: let path_separator = if cfg!(windows) { ';' } else { ':' }; and then .join(path_separator).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to change the scope of this pr (I'm assuming this change will require adding unit tests and normalizing the if cfg!(windows)... logic for reuse), will ignore for now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot is wrong; this is used interally

@DOsinga DOsinga merged commit 23f26fb into block:main Nov 11, 2025
20 checks passed
tlongwell-block added a commit that referenced this pull request Nov 12, 2025
* origin/main: (29 commits)
  chore: Update governance to include Discord (#5690)
  Ollama improvements (#5609)
  feat: add Supabase MCP server to registry (#5629)
  Unlist VS Code extension tutorials from MCP and experimental sections (#5677)
  fix: make image processing work in github copilot provider (#5687)
  fix: do not take into account gitignore in developer mcp (#5688)
  docs: session storage migration (#5682)
  New maintainers (#5685)
  chore: Update governance (#5660)
  chore(release): release version 1.14.0 (minor) (#5676)
  fix : action icons overlap session title in chat history (#5684)
  Document recent goose PRs (#5683)
  docs: add GOOSE_PATH_ROOT environment variable documentation (#5678)
  feat: SessionManager integration for acp sessions (#5657)
  teach copilot our CI (#5672)
  bump openapi version directly (#5674)
  governance: update MAINTAINERS.md to reflect new maintainers (#5675)
  chore: upgrade rmcp to 0.8.5 (#5673)
  Update release instructions (#5662)
  Swapped out to_string_lossy with display for user facing text (#5666)
  ...
Surendhar-N-D pushed a commit to Surendhar-N-D/goose that referenced this pull request Nov 17, 2025
arul-cc pushed a commit to arul-cc/goose that referenced this pull request Nov 17, 2025
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
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