fix(render): omit actions from final message (#21)

This commit is contained in:
banteg
2026-01-02 04:44:35 +04:00
committed by GitHub
parent b8455c8691
commit fd0999bd65
2 changed files with 3 additions and 10 deletions
+1 -10
View File
@@ -184,10 +184,6 @@ def format_action_line(
)
def is_command_log_line(line: str) -> bool:
return any(line.startswith(f"{symbol} `") for symbol in STATUS.values())
def render_event_cli(event: TakopiEvent) -> list[str]:
match event:
case StartedEvent(engine=engine):
@@ -306,13 +302,8 @@ class ExecProgressRenderer:
label=self.label_with_title(status),
engine=self.engine,
)
lines = [line.text for line in self.lines]
if status == "done":
lines = [line for line in lines if not is_command_log_line(line)]
body = self.assemble_body(lines)
answer = (answer or "").strip()
if answer:
body = answer if not body else body + "\n\n" + answer
body = answer if answer else None
return MarkdownParts(header=header, body=body, footer=self.render_footer())
def label_with_title(self, label: str) -> str:
+2
View File
@@ -133,6 +133,8 @@ def test_progress_renderer_renders_progress_and_final() -> None:
final_parts = r.render_final_parts(3.0, "answer", status="done")
final = assemble_markdown_parts(final_parts)
assert final.startswith("done · codex · 3s · step 2")
assert "✓ `bash -lc ls`" not in final
assert "Checking repository root for README" not in final
assert "answer" in final
assert final.rstrip().endswith(
"`codex resume 0199a213-81c0-7800-8aa1-bbab2a035a53`"