-
Notifications
You must be signed in to change notification settings - Fork 44
[codex] Polish Lab TUI agent output #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
|
|
||
| from __future__ import annotations | ||
|
|
||
| import re | ||
| from collections.abc import Callable | ||
| from pathlib import Path | ||
|
|
||
|
|
@@ -185,7 +186,7 @@ def _setup_pressed(self, _event: Button.Pressed) -> None: | |
|
|
||
|
|
||
| class AgentSyncScreen(Screen[None]): | ||
| """Refresh Lab templates, skills, docs, and local agent guidance.""" | ||
| """Refresh Lab assets and local agent guidance.""" | ||
|
|
||
| BINDINGS = [ | ||
| Binding("escape", "back", "Back", key_display="Esc"), | ||
|
|
@@ -263,7 +264,10 @@ def _run_sync_worker(self, workspace: Path, agent: str) -> None: | |
| self.app.call_from_thread(self._finish_sync, result) | ||
|
|
||
| def _append_sync_output(self, text: str) -> None: | ||
| self._output = (self._output + text)[-50000:] | ||
| visible_text = _user_visible_sync_output(text) | ||
| if not visible_text: | ||
| return | ||
| self._output = (self._output + visible_text)[-50000:] | ||
| self.query_one("#sync-output", Static).update(Text(self._output)) | ||
|
|
||
| def _finish_sync(self, result: LabSyncResult) -> None: | ||
|
|
@@ -435,7 +439,7 @@ def _agent_sync_body(item: LabItem) -> Group: | |
| table.add_row("Agent", str(item.raw.get("agent") or "codex")) | ||
| table.add_row("Command", str(item.raw.get("command") or "prime lab sync")) | ||
| note = Text( | ||
| "Refresh Prime-owned templates, skills, docs, and agent guidance for this workspace.", | ||
| "Refresh Prime-owned Lab assets and local guidance for this workspace.", | ||
| style="dim", | ||
| ) | ||
| return Group(Text("Lab asset sync", style="bold"), table, Text(""), note) | ||
|
|
@@ -469,8 +473,59 @@ def _doctor_result_table(result: LabDoctorResult) -> Table: | |
| }.get(check.status, "dim") | ||
| table.add_row( | ||
| Text(check.status, style=status_style), | ||
| check.name, | ||
| check.message, | ||
| check.remediation, | ||
| _user_visible_lab_asset_text(check.name), | ||
| _user_visible_lab_asset_text(check.message), | ||
| _user_visible_lab_asset_text(check.remediation), | ||
| ) | ||
| return table | ||
|
|
||
|
|
||
| def _user_visible_sync_output(text: str) -> str: | ||
| lines: list[str] = [] | ||
| previous_visible_line = "" | ||
| for raw_line in text.splitlines(keepends=True): | ||
| line = raw_line.rstrip("\r\n") | ||
| ending = raw_line[len(line) :] | ||
| visible_line = _user_visible_sync_line(line) | ||
| if visible_line and visible_line != previous_visible_line: | ||
| lines.append(f"{visible_line}{ending}") | ||
| previous_visible_line = visible_line | ||
| return "".join(lines) | ||
|
|
||
|
|
||
| def _user_visible_sync_line(line: str) -> str: | ||
| normalized = line.strip().lower() | ||
| if "skill" not in normalized: | ||
| return line | ||
| if normalized.startswith("prepared "): | ||
| return "Prepared local Lab assets" | ||
| if normalized.startswith("skipped coding-agent"): | ||
| return "Skipped coding-agent local assets (--no-agent)" | ||
| if normalized.startswith("skipped ") and "user-owned" in normalized: | ||
| return "Skipped user-owned local Lab asset" | ||
| if normalized.startswith("warning: removed stale managed"): | ||
| return "Warning: removed stale managed Lab asset" | ||
| if normalized.startswith("sync failed:"): | ||
| return "Sync failed: Lab asset refresh failed" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a sync error message contains Useful? React with 👍 / 👎. |
||
| return "" | ||
|
|
||
|
|
||
| def _user_visible_lab_asset_text(text: str) -> str: | ||
| rendered = str(text) | ||
| rendered = re.sub( | ||
| r"Missing .*/\.prime/skills/\.prime-managed\.json", | ||
| "Missing local Lab asset cache", | ||
| rendered, | ||
| ) | ||
| replacements = { | ||
| "Global Lab skill cache": "Global Lab asset cache", | ||
| "Workspace Lab skills": "Workspace Lab assets", | ||
| "managed skill(s)": "managed asset(s)", | ||
| "managed skill link(s)": "managed asset link(s)", | ||
| "No managed Lab skills are installed.": "No managed Lab assets are installed.", | ||
| " skills": " assets", | ||
| " skill": " asset", | ||
| } | ||
| for old, new in replacements.items(): | ||
| rendered = rendered.replace(old, new) | ||
| return rendered | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early return skips streaming assistant finalization
Low Severity
When
_dynamic_tool_chat_contentreturnsNone(i.e.,status == "tool"),_record_dynamic_tool_callnow returns before reaching_finish_latest_streaming_assistant_locked(fallback=""). Previously, this finalization was always called, ensuring any active streaming assistant message was properly completed (or removed if empty) before appending a system message. Now, if there happens to be an active streaming assistant message when a"tool"status event arrives, it will remain in the"streaming"state until some other event finalizes it, potentially causing a lingering streaming indicator in the UI.Reviewed by Cursor Bugbot for commit 1924dd4. Configure here.