Skip to content

Refactor and harden front#59

Merged
esgn merged 19 commits intomainfrom
refactor
Apr 20, 2026
Merged

Refactor and harden front#59
esgn merged 19 commits intomainfrom
refactor

Conversation

@mborne
Copy link
Copy Markdown
Collaborator

@mborne mborne commented Apr 20, 2026

@esgn
Copy link
Copy Markdown
Member

esgn commented Apr 20, 2026

09c8528 => translate tool create_map description in french to be aligned with geocontext tools

@esgn
Copy link
Copy Markdown
Member

esgn commented Apr 20, 2026

0a45171 => /health/db was calling get_database() as if it returned a database instance, but get_database is an async context manager (@asynccontextmanager).
As a result, the endpoint received an _AsyncGeneratorContextManager object and then failed on await db.is_healthy() with AttributeError.

This was fixed by running the health check inside an async context (async with get_database() as db) via a dedicated helper (is_database_healthy()), so the endpoint now handles DB initialization correctly and returns proper HTTP statuses instead of crashing.

d675ca9 => Added explicit Redis client cleanup in get_database() by wrapping the Redis branch in try/finally and calling await redis_client.aclose(). This prevents connection leaks for short-lived contexts (e.g., /health/db) while preserving normal runtime behavior for the long-lived agent context.

@esgn
Copy link
Copy Markdown
Member

esgn commented Apr 20, 2026

8ece2f6 => This commit adds a minimal filter in to_gradio_message() to prevent raw map markup from being shown in chatbot text responses.
For ai messages, the content is now sanitized into cleaned_text by removing <ol-simple-map ...></ol-simple-map> snippets. If nothing remains after cleanup, the message is skipped; otherwise, only the cleaned text is displayed.

Scope is intentionally simple and stupid for now:

  • No change to create_map tool behavior
  • No shared state or message tracking
  • No architecture changes

Regression coverage was added for:

  • AI message containing only map markup -> hidden
  • AI message containing text + map markup -> text is kept only

@esgn
Copy link
Copy Markdown
Member

esgn commented Apr 20, 2026

c09c0ab => This commit hardens the bot() async generator guard paths for invalid/empty submissions.
It now short-circuits when history is empty, the last item is not a user message, or user content is blank, and emits yield history before returning so the UI keeps the current conversation state (no accidental replay and no history reset on empty input).

@esgn esgn merged commit e1c4616 into main Apr 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants