Skip to content

feat(hmi): sync vérité d'abord depuis moteur #157 - #4

Merged
Axellum merged 2 commits into
mainfrom
sync/hmi-verite-dabord-157
Jul 28, 2026
Merged

Axellum merged 2 commits into
mainfrom
sync/hmi-verite-dabord-157

Conversation

@Axellum

@Axellum Axellum commented Jul 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Sync miroir public avec moteur_agents#157
  • Routes setup/vocal/ha/benchmarks + ihm-v2
  • IPs LAN → placeholders

Test plan

  • CI secrets scan + pytest
  • Pas d'IP 192.168.0.* hors outil d'anonymisation

Note

High Risk
DreamCoder exécute des pipelines LLM sur un dépôt Git configurable avec commits et drainage multi-tâches ; les changements BudgetGuard et billing touchent la sélection de providers et les coûts en prod.

Overview
Synchronisation moteur ↔ IHM v2 autour du principe « pas de donnée inventée » : nouvelles routes de lecture (/api/setup/diagnostics, /api/vocal/*, santé et liste d’entités HA, benchmarks GET/POST avec tables SQLite), agrégation Comptes API via GET /api/billing (quotas, soldes live, saisie manuelle), et doc ihm-v2 (auth REST + ticket SSE, pas de mocks).

DreamCoder passe d’une tâche par cycle à une boucle de drainage bornée (dreamcoder_max_cycle_minutes), avec exécuteur vs gouverneur (DeepSeek / GLM selon budget et retries), rollback, rapports de cycle, et dépôt Git optionnel dreamcoder_repo_path (clone Deck + pull --ff-only).

BudgetGuard réordonne la cascade (rotation round-robin des API cloud gratuites/abonnements avant Ollama), ajoute CLI Gemini/Claude, DashScope, plafond total_daily_budget_usd, solde DeepSeek caché, cooldown après échec, et sync_source / get_scoped_spend_usd pour l’auditeur.

Home Assistant : TLS centralisé avec HA_TLS_SERVER_HOSTNAME (cert IP/DNS), sessions requests/aiohttp partagées (MCP, vocal, Tab5). Vocal : priorité entités « vivantes », consignes TTS sans JSON.

LLM : provider DashScope Coding Plan, clés Cerebras free vs payant séparées. .env.example réécrit (sécurité, ToolMaker, workspace root, placeholders ${HA_HOST} etc.). /version préfère .deploy_meta.json au git local sur le Deck.

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

Axellum and others added 2 commits July 28, 2026 08:41
Backend metrics/HA/vocal/setup + IHM sans mocks ; IPs LAN anonymisees.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 4 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 4 issues found in the latest run.

  • ✅ Fixed: Shell placeholders in Python URLs
    • Replaced literal ${HA_HOST:-…} fallbacks with os.environ.get('HA_HOST', …) in HA health, MCP tools, vocal credentials, and Tab5 pusher defaults.
  • ✅ Fixed: Ollama LAN URL not resolved
    • ollama_pc base_url now resolves OLLAMA_HOST via os.environ at registry load and again at provider creation in create_provider/_make_compat.
  • ✅ Fixed: Provider cooldown on git errors
    • mark_provider_failed is gated behind provider_execution_failed so successful pipeline runs that later fail on git/IO no longer cool down the LLM provider.
  • ✅ Fixed: Governor cap uses wrong scope
    • Governor budget check now uses BudgetGuard.get_total_spend_usd (all billing sources) against total_daily_budget_usd, matching get_available_provider.

Create PR

Or push these changes by commenting:

@cursor push b2d07f8258

You can send follow-ups to the cloud agent here.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

Comment thread api/routes/ha.py
le `.env` définit historiquement les deux.
"""
ha_token = os.environ.get("HASS_TOKEN") or os.environ.get("HA_TOKEN")
ha_url = os.environ.get("HASS_URL") or os.environ.get("HA_URL") or "http://${HA_HOST:-192.168.1.x}:8123"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell placeholders in Python URLs

High Severity

When HASS_URL / HA_URL are unset, fallbacks use literal strings like http://${HA_HOST:-192.168.1.x}:8123. Python does not expand that shell syntax, so HA health, MCP tools, vocal reads, and Tab5 pushes target an invalid host instead of a LAN IP.

Additional Locations (3)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

# Ollama démarré avec OLLAMA_HOST=0.0.0.0 (ou au moins .84) + pare-feu Windows ouvert
# sur 11434 pour le LAN, sinon connect timeout (repli cloud silencieux, pas d'erreur bruyante).
"base_url": "http://192.168.1.x:11434/v1/chat/completions",
"base_url": "http://${OLLAMA_HOST:-192.168.1.x}:11434/v1/chat/completions",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ollama LAN URL not resolved

Medium Severity

The ollama_pc provider base_url is set to http://${OLLAMA_HOST:-192.168.1.x}:11434/... as a literal string. HTTP clients use that hostname verbatim, so Deck-to-PC Ollama calls fail unless another layer rewrites the URL.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

Comment thread agents/dreamer_agent.py
# évite qu'un provider cassé (ex: CLI Gemini/Claude non trustée) soit
# re-sélectionné sur la tâche suivante du même cycle de drainage.
from core.budget_guard import mark_provider_failed
mark_provider_failed(provider)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provider cooldown on git errors

Medium Severity

DreamCoder’s shared except always calls mark_provider_failed(provider) after any pipeline-stage error. Git commit/diff failures or timeouts can mark a healthy LLM provider unavailable for 30 minutes even when the model call succeeded.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

Comment thread agents/dreamer_agent.py

dreamcoder_spent_today = await bg.get_scoped_spend_usd("dreamcoder", 86400.0)
total_cap = bg.config.get("total_daily_budget_usd", 1.0)
governor_within_budget = dreamcoder_spent_today < total_cap

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Governor cap uses wrong scope

Medium Severity

Governor degradation compares get_scoped_spend_usd("dreamcoder", …) to total_daily_budget_usd, described as a combined daily cap. That ignores non-DreamCoder spend recorded in billing_history, so paid planner/reviewer models may keep running after the real combined budget is exhausted.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54ecc61. Configure here.

@Axellum
Axellum merged commit b04fbcb into main Jul 28, 2026
6 checks 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

Development

Successfully merging this pull request may close these issues.

1 participant