From 70f88edb17e14d5f5147d4ca8e9f96a830a93c27 Mon Sep 17 00:00:00 2001 From: Mohammad Ausaf Date: Sun, 28 Jun 2026 20:05:15 +0530 Subject: [PATCH] Polish impact review flow --- plugins/cfg_impact/cfg_impact/overview.py | 9 ++++-- src/cfg/ui/server.py | 37 +++++++++++++++++++++-- tests/test_impact_boundary.py | 10 ++++++ 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/plugins/cfg_impact/cfg_impact/overview.py b/plugins/cfg_impact/cfg_impact/overview.py index 9b92ebd..1747726 100644 --- a/plugins/cfg_impact/cfg_impact/overview.py +++ b/plugins/cfg_impact/cfg_impact/overview.py @@ -422,9 +422,12 @@ def _parse_jsonish(text: str) -> dict[str, Any] | None: if not raw: return None if raw.startswith("```"): - raw = raw.strip("`") - if raw.startswith("json"): - raw = raw[4:] + raw = raw[3:].strip() + if raw.lower().startswith("json"): + raw = raw[4:].strip() + fence_end = raw.rfind("```") + if fence_end != -1: + raw = raw[:fence_end].strip() try: data = json.loads(raw) except json.JSONDecodeError: diff --git a/src/cfg/ui/server.py b/src/cfg/ui/server.py index 3af097a..0d79da0 100644 --- a/src/cfg/ui/server.py +++ b/src/cfg/ui/server.py @@ -5,6 +5,7 @@ from http import HTTPStatus from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer import json +import os import socket from typing import Any from urllib.parse import parse_qs, urlparse @@ -107,6 +108,11 @@ def _schema(self, params: dict[str, list[str]]) -> dict[str, Any]: for item in project.collections ], "connections": actions.to_json(project.connections), + "impact": { + "provider": os.getenv("CFGIT_UI_IMPACT_PROVIDER") + or project.connections.ai_provider, + "model": os.getenv("CFGIT_UI_IMPACT_MODEL") or None, + }, }, } except Exception as exc: @@ -641,7 +647,7 @@ def find_free_port(host: str = DEFAULT_HOST) -> int: