Skip to content

Conversation

@toyamagu-2021
Copy link
Contributor

@toyamagu-2021 toyamagu-2021 commented Jul 6, 2025

Signed-off-by: [email protected] [email protected]

Closes #3263
Same as #2819

@toyamagu-2021 toyamagu-2021 changed the title fix: use safe_truncate for truncate charactor./ fix: use safe_truncate for truncate charactor (#3263) Jul 6, 2025
@toyamagu-2021 toyamagu-2021 changed the title fix: use safe_truncate for truncate charactor (#3263) fix: use safe_truncate fto truncate charactor (#3263) Jul 6, 2025
@toyamagu-2021 toyamagu-2021 changed the title fix: use safe_truncate fto truncate charactor (#3263) fix: use safe_truncate to truncate charactor (#3263) Jul 6, 2025
@toyamagu-2021 toyamagu-2021 marked this pull request as ready for review July 6, 2025 10:43
@toyamagu-2021
Copy link
Contributor Author

@jamadeo Sorry to bother you, but could you review this PR, which is almost the same as #2819?

Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

this is great and thanks for jumping on this. if we want to completely fix this, we should also replace the text.len() instances with text.chars().count() or where possible replace

if text.len() > count {
safe_truncate(text)
} else {
text
}

with just safe_truncate(text)

@toyamagu-2021
Copy link
Contributor Author

@DOsinga
Thank you for your feedback! I've fixed some codes.

@DOsinga
Copy link
Collaborator

DOsinga commented Jul 9, 2025

this is great, thank you. do you have any ideas on what we could do to avoid us breaking this again :) ?

@toyamagu-2021
Copy link
Contributor Author

toyamagu-2021 commented Jul 9, 2025

@DOsinga
I think enabling string_slice with Clippy is one approach. You can find more details here:
https://rust-lang.github.io/rust-clippy/master/index.html#string_slice

And you can enable it using this command:
./bin/cargo clippy -- -W clippy::string_slice

However, this currently generates a large number of errors, including false positives, making it difficult to fix immediately. If you'd like, I can create an issue for it and address it in a separate pull request.

@toyamagu-2021
Copy link
Contributor Author

CI is falling 🤔

   Compiling goose-cli v1.0.35 (/home/runner/work/goose/goose/crates/goose-cli)
Error: The operation was canceled.

@DOsinga DOsinga merged commit d3beeac into block:main Jul 15, 2025
7 checks passed
zanesq added a commit that referenced this pull request Jul 15, 2025
* 'main' of github.com:block/goose:
  fix: Set include_usage=true for OpenAI streaming (#3441)
  feat: `recipe list` (#2814) (#2815)
  docs: update github mcp config (#3433)
  feat: Implement streaming for OpenAI (#3413)
  fix: improve extension startup error messages with command details (#2694)
  [feat]: improve file search tools to add globsearch / grep tools (#3368)
  docs: typo in guide description (#3429)
  fix: use safe_truncate to truncate charactor (#3263) (#3264)
  fix: convert invalid recipe variable name to raw content (#3420)
  center goose mobile screenshot (#3418)
  docs: model context limit overrides (#3377)
  docs: Subagents (#3402)
  fix: avoid pass encoded empty string to goose run --recipe (#3361)
  ux: alphabetize extensions (#3416)
  fix: message concatenation in server session management (#3412)
  refactor: streamline memory directory management (#3345)
  feat: Add AZURE_OPENAI_API_KEY as a visible config parameter (#3265)
  feat: stream LLM responses (#2677)

# Conflicts:
#	crates/goose/src/session/storage.rs
#	ui/desktop/src/components/ChatView.tsx
#	ui/desktop/src/components/settings/extensions/subcomponents/ExtensionList.tsx
lifeizhou-ap added a commit that referenced this pull request Jul 16, 2025
* main: (54 commits)
  UI update with sidebar and settings tabs (#3288)
  docs: add CLIStreamExtensionInstructions component (#3443)
  chore(release): release version 1.0.36 (#3436)
  [goose-llm] fix image content bug, add optional request_id field (#3439)
  fix: Set include_usage=true for OpenAI streaming (#3441)
  feat: `recipe list` (#2814) (#2815)
  docs: update github mcp config (#3433)
  feat: Implement streaming for OpenAI (#3413)
  fix: improve extension startup error messages with command details (#2694)
  [feat]: improve file search tools to add globsearch / grep tools (#3368)
  docs: typo in guide description (#3429)
  fix: use safe_truncate to truncate charactor (#3263) (#3264)
  fix: convert invalid recipe variable name to raw content (#3420)
  center goose mobile screenshot (#3418)
  docs: model context limit overrides (#3377)
  docs: Subagents (#3402)
  fix: avoid pass encoded empty string to goose run --recipe (#3361)
  ux: alphabetize extensions (#3416)
  fix: message concatenation in server session management (#3412)
  refactor: streamline memory directory management (#3345)
  ...
lifeizhou-ap added a commit that referenced this pull request Jul 16, 2025
* main:
  UI update with sidebar and settings tabs (#3288)
  docs: add CLIStreamExtensionInstructions component (#3443)
  chore(release): release version 1.0.36 (#3436)
  [goose-llm] fix image content bug, add optional request_id field (#3439)
  fix: Set include_usage=true for OpenAI streaming (#3441)
  feat: `recipe list` (#2814) (#2815)
  docs: update github mcp config (#3433)
  feat: Implement streaming for OpenAI (#3413)
  fix: improve extension startup error messages with command details (#2694)
  [feat]: improve file search tools to add globsearch / grep tools (#3368)
  docs: typo in guide description (#3429)
  fix: use safe_truncate to truncate charactor (#3263) (#3264)
s-soroosh pushed a commit to s-soroosh/goose that referenced this pull request Jul 18, 2025
kwsantiago pushed a commit to kwsantiago/goose that referenced this pull request Jul 19, 2025
cbruyndoncx pushed a commit to cbruyndoncx/goose that referenced this pull request Jul 20, 2025
atarantino pushed a commit to atarantino/goose that referenced this pull request Aug 5, 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.

bug: String truncation fails with "byte index is not a char boundary" for non-ASCII text

3 participants