Skip to content

fix: mojibake cleanup + area dedup loop fix#261

Open
pgroene wants to merge 2 commits into
mainfrom
fix/mojibake-cleanup
Open

fix: mojibake cleanup + area dedup loop fix#261
pgroene wants to merge 2 commits into
mainfrom
fix/mojibake-cleanup

Conversation

@pgroene

@pgroene pgroene commented May 23, 2026

Copy link
Copy Markdown
Owner

Fixes

Mojibake in Python source files

Automated fix using \scripts/fix_mojibake.py\ that reverses cp1252 double-encoding:

  • \http_api.py\ — 12 lines (⚠️ note, → arrows, — dashes)
  • \�nalyzer.py\ — 9 lines
  • \knowledge_integration.py\ — 16 lines

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:

  1. \intent_and_context.py: deduplicate areas by normalised name before building context
  2. \ ool_execution.py:
    esolve_tool_call\ normalises area to lowercase so signatures match in the dedup cache

pgroene and others added 2 commits May 23, 2026 23:28
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>
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.

1 participant