conductor(checkpoint): Final optimizations for Phase 3: Throttled updates and incremental rendering

This commit is contained in:
2026-02-23 15:07:48 -05:00
parent 85fad6bb04
commit 9fdece9404
3 changed files with 125 additions and 114 deletions

46
gui.py
View File

@@ -519,6 +519,7 @@ class App:
mcp_client.perf_monitor_callback = self.perf_monitor.get_metrics mcp_client.perf_monitor_callback = self.perf_monitor.get_metrics
self.perf_monitor.alert_callback = self._on_performance_alert self.perf_monitor.alert_callback = self._on_performance_alert
self._last_bleed_update_time = 0 self._last_bleed_update_time = 0
self._last_diag_update_time = 0
self._recalculate_session_usage() self._recalculate_session_usage()
# ---------------------------------------------------------------- project loading # ---------------------------------------------------------------- project loading
@@ -833,7 +834,10 @@ class App:
limit = stats.get("limit", 0) limit = stats.get("limit", 0)
dpg.set_value("token_budget_label", f"{current:,} / {limit:,}") dpg.set_value("token_budget_label", f"{current:,} / {limit:,}")
# Update Gemini-specific cache stats # Update Gemini-specific cache stats (throttled with diagnostics)
if now - self._last_diag_update_time > 0.1:
self._last_diag_update_time = now
if dpg.does_item_exist("gemini_cache_label"): if dpg.does_item_exist("gemini_cache_label"):
if self.current_provider == "gemini": if self.current_provider == "gemini":
try: try:
@@ -1565,20 +1569,7 @@ class App:
# ---- disc entry list ---- # ---- disc entry list ----
def _rebuild_disc_list(self): def _render_disc_entry(self, i: int, entry: dict):
if not dpg.does_item_exist("disc_scroll"):
return
def _toggle_read(s, a, idx):
# Save edit box content before switching to read mode
tag = f"disc_content_{idx}"
if dpg.does_item_exist(tag) and not self.disc_entries[idx].get("read_mode", False):
self.disc_entries[idx]["content"] = dpg.get_value(tag)
self.disc_entries[idx]["read_mode"] = not self.disc_entries[idx].get("read_mode", False)
self._rebuild_disc_list()
dpg.delete_item("disc_scroll", children_only=True)
for i, entry in enumerate(self.disc_entries):
collapsed = entry.get("collapsed", False) collapsed = entry.get("collapsed", False)
read_mode = entry.get("read_mode", False) read_mode = entry.get("read_mode", False)
ts_str = entry.get("ts", "") ts_str = entry.get("ts", "")
@@ -1587,7 +1578,7 @@ class App:
if len(entry["content"]) > 60: if len(entry["content"]) > 60:
preview += "..." preview += "..."
with dpg.group(parent="disc_scroll"): with dpg.group(parent="disc_scroll", tag=f"disc_entry_group_{i}"):
with dpg.group(horizontal=True): with dpg.group(horizontal=True):
dpg.add_button( dpg.add_button(
tag=f"disc_toggle_{i}", tag=f"disc_toggle_{i}",
@@ -1606,7 +1597,7 @@ class App:
dpg.add_button( dpg.add_button(
label="[Edit]" if read_mode else "[Read]", label="[Edit]" if read_mode else "[Read]",
user_data=i, user_data=i,
callback=_toggle_read callback=self._cb_toggle_read
) )
if ts_str: if ts_str:
dpg.add_text(ts_str, color=(120, 120, 100)) dpg.add_text(ts_str, color=(120, 120, 100))
@@ -1644,6 +1635,24 @@ class App:
) )
dpg.add_separator() dpg.add_separator()
def _cb_toggle_read(self, sender, app_data, user_data):
idx = user_data
# Save edit box content before switching to read mode
tag = f"disc_content_{idx}"
if dpg.does_item_exist(tag) and not self.disc_entries[idx].get("read_mode", False):
self.disc_entries[idx]["content"] = dpg.get_value(tag)
self.disc_entries[idx]["read_mode"] = not self.disc_entries[idx].get("read_mode", False)
self._rebuild_disc_list()
def _rebuild_disc_list(self):
"""Full rebuild of the discussion UI. Expensive! Use incrementally where possible."""
if not dpg.does_item_exist("disc_scroll"):
return
dpg.delete_item("disc_scroll", children_only=True)
for i, entry in enumerate(self.disc_entries):
self._render_disc_entry(i, entry)
def _make_disc_role_cb(self, idx: int): def _make_disc_role_cb(self, idx: int):
def cb(sender, app_data): def cb(sender, app_data):
if idx < len(self.disc_entries): if idx < len(self.disc_entries):
@@ -2245,7 +2254,8 @@ class App:
self.disc_roles.append(item["role"]) self.disc_roles.append(item["role"])
self._rebuild_disc_roles_list() self._rebuild_disc_roles_list()
self.disc_entries.append(item) self.disc_entries.append(item)
self._rebuild_disc_list() self._render_disc_entry(len(self.disc_entries) - 1, item)
if dpg.does_item_exist("disc_scroll"): if dpg.does_item_exist("disc_scroll"):
# Force scroll to bottom using a very large number # Force scroll to bottom using a very large number
dpg.set_y_scroll("disc_scroll", 99999) dpg.set_y_scroll("disc_scroll", 99999)

View File

@@ -165,7 +165,7 @@ history = [
[discussion.discussions."test for gemini conductor"] [discussion.discussions."test for gemini conductor"]
git_commit = "ccdba69214aea169a4e707da7b425ae0c6139fca" git_commit = "ccdba69214aea169a4e707da7b425ae0c6139fca"
last_updated = "2026-02-23T15:00:53" last_updated = "2026-02-23T15:06:42"
history = [ history = [
"@2026-02-23T11:08:38\nUser:\nadded a file to yoru exposed files read it.", "@2026-02-23T11:08:38\nUser:\nadded a file to yoru exposed files read it.",
"@2026-02-23T11:08:43\nAI:\nI have read the `MainContext.md` file. It contains extensive documentation about the \"Manual Slop\" project.\n\nWas `MainContext.md` the file you were referring to? If not, please specify the file's name or path.", "@2026-02-23T11:08:43\nAI:\nI have read the `MainContext.md` file. It contains extensive documentation about the \"Manual Slop\" project.\n\nWas `MainContext.md` the file you were referring to? If not, please specify the file's name or path.",
@@ -175,6 +175,7 @@ history = [
"@2026-02-23T14:59:26\nSystem:\n[PERFORMANCE ALERT] Frame time high: 194.0ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.", "@2026-02-23T14:59:26\nSystem:\n[PERFORMANCE ALERT] Frame time high: 194.0ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.",
"@2026-02-23T14:59:56\nSystem:\n[PERFORMANCE ALERT] Frame time high: 117.4ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.", "@2026-02-23T14:59:56\nSystem:\n[PERFORMANCE ALERT] Frame time high: 117.4ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.",
"@2026-02-23T15:00:27\nSystem:\n[PERFORMANCE ALERT] Frame time high: 206.5ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.", "@2026-02-23T15:00:27\nSystem:\n[PERFORMANCE ALERT] Frame time high: 206.5ms; Input lag high: 156.2ms. Please consider optimizing recent changes or reducing load.",
"@2026-02-23T15:06:32\nSystem:\n[PERFORMANCE ALERT] Frame time high: 817.2ms. Please consider optimizing recent changes or reducing load.",
] ]
[agent.tools] [agent.tools]

View File

@@ -35,5 +35,5 @@ active = "main"
[discussion.discussions.main] [discussion.discussions.main]
git_commit = "" git_commit = ""
last_updated = "2026-02-23T15:01:18" last_updated = "2026-02-23T15:07:42"
history = [] history = []