Repository navigation
fix(agent): skip unreadable rule files instead of failing all memory - #849
Merged
Merged
Conversation
A file in .claude/rules that isn't UTF-8 text (e.g. a Finder alias named `.md`) made MemoryLoader.load throw, so none of the project's instructions were loaded. Skip such files, and a rules folder that can't be listed; do the same for nested CLAUDE.md files. Symlinked rules (files and folders) were already followed; the test now covers them. Co-Authored-By: BaoCode <noreply@baocode.dev>
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.
Problem
In the built-in kernel,
MemoryLoader.addRulesread every.mdunder.claude/ruleswith an unguardedreadAsStringSync(). One file that isn't UTF-8 text — e.g. a macOS Finder alias namedsomething.md— threwFileSystemException: Failed to decode data using encoding 'utf-8', which propagated out ofMemoryLoader.load/reloadExtensions, so no instructions were loaded at all.nested()had the same unguarded read forCLAUDE.md.Fix
CLAUDE.md/CLAUDE.local.md.Notes
rules/skillsfolder) already worked in the built-in kernel; the new test covers linked rules (skipped on Windows).Test
flutter test test/units/utils_test.dart --plain-name MemoryLoaderinpackages/bao_agent— the new test fails without the fix with the decode error above.🤖 Generated with BaoCode