fix: prevent utf8 truncation panics, add system_time tool, and retry ClawHub downloads#250
Open
982945902 wants to merge 2 commits intoRightNow-AI:mainfrom
Open
fix: prevent utf8 truncation panics, add system_time tool, and retry ClawHub downloads#250982945902 wants to merge 2 commits intoRightNow-AI:mainfrom
982945902 wants to merge 2 commits intoRightNow-AI:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR combines three production-facing fixes/enhancements:
Kernel UTF-8 safety
New built-in tool:
system_timetimezone:local(default) orutcformat:rfc3339(default) orisoClawHub install resilience
429 Too Many Requestsand5xxRetry-Afterwhen presentMotivation
These changes were driven by real runtime issues:
not a char boundary) when processing non-ASCII text.Detailed Changes
1) Kernel UTF-8 truncation fixes
File:
crates/openfang-kernel/src/kernel.rssafe_truncate_str(...)instead of&s[..N]in:This prevents panics when truncating multibyte strings.
2)
system_timetool in runtimeFile:
crates/openfang-runtime/src/tool_runner.rsbuiltin_tool_definitions()execute_tool(...)tool_system_time(...)implementationOutput fields:
local_timeutc_timetimezoneoffsetunix_secondsTests added:
test_system_time_defaulttest_system_time_utc_isotest_system_time_invalid_timezone3) ClawHub download retry/backoff
File:
crates/openfang-skills/src/clawhub.rsMAX_ATTEMPTS=4)4295xxRetry-Afterheader (seconds, capped)retry_delay(...)exponential_backoff(...)Test Plan
Executed locally:
cargo build --workspace --lib✅cargo test --workspace✅cargo test -p openfang-runtime system_time✅Note:
cargo clippy --workspace --all-targets -- -D warningscurrently fails due to pre-existing unrelated warnings incrates/openfang-cli/src/main.rs(collapsible_else_if), not introduced by this PR.Risk / Compatibility