fix: mojibake cleanup + area dedup loop fix#261
Open
pgroene wants to merge 2 commits into
Open
Conversation
Automated fix using scripts/fix_mojibake.py — reverses the cp1252/latin-1 double-encoding that corrupted arrows (→), em-dashes (—), ellipses (…), smart quotes and the⚠️ warning emoji across 3 Python files. Files fixed: - http_api.py (12 lines:⚠️ note, → arrows, — dashes in prompts/comments) - analyzer.py (9 lines) - knowledge_integration.py (16 lines) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When HA has both 'Zitkamer' and 'zitkamer' as separate areas, the AI called get_area_entities for every variant, causing 35 tool calls and an empty response. Two-layer fix: 1. intent_and_context.py: deduplicate areas by normalised name before building the context block — the AI never sees duplicate entries 2. tool_execution.py: resolve_tool_call normalises area arg to lowercase so 'Zitkamer' and 'zitkamer' produce identical signatures and the second call is caught by executed_calls_cache Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Fixes
Mojibake in Python source files
Automated fix using \scripts/fix_mojibake.py\ that reverses cp1252 double-encoding:
Area duplicate 35x tool call loop
When HA has both 'Zitkamer' and 'zitkamer' as separate areas, the AI called \get_area_entities\ 35 times and returned an empty response.
Two-layer fix:
esolve_tool_call\ normalises area to lowercase so signatures match in the dedup cache