From cfd75b4aa253eddbe90bfda585c416738280b391 Mon Sep 17 00:00:00 2001 From: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com> Date: Tue, 20 Oct 2026 09:08:35 +0000 Subject: [PATCH] fix(confirm-write): render list items on the approval card like top-level values --- agent/tests/test_write_confirmation.py | 17 +++++++++++++++++ agent/write_confirmation.py | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/agent/tests/test_write_confirmation.py b/agent/tests/test_write_confirmation.py index 8dbc0e0b..f333282a 100644 --- a/agent/tests/test_write_confirmation.py +++ b/agent/tests/test_write_confirmation.py @@ -104,6 +104,23 @@ def test_summarize_args_joins_lists_and_compacts_nested_values(): } +def test_summarize_args_renders_list_items_like_top_level_values(): + fields = summarize_args( + { + "pages": [{"title": "Q3 plan"}, {"title": "Q4 plan"}], + "flags": [True, False], + } + ) + + assert fields == [ + { + "label": "Pages", + "value": '{"title": "Q3 plan"}, {"title": "Q4 plan"}', + }, + {"label": "Flags", "value": "Yes, No"}, + ] + + def test_summarize_args_truncates_an_overlong_value(): fields = summarize_args({"description": "x" * 400}) diff --git a/agent/write_confirmation.py b/agent/write_confirmation.py index a2305b9d..91bd8f60 100644 --- a/agent/write_confirmation.py +++ b/agent/write_confirmation.py @@ -93,7 +93,9 @@ def _stringify(value) -> str: if isinstance(value, bool): return "Yes" if value else "No" if isinstance(value, (list, tuple)): - return ", ".join(str(v) for v in value) + # Each item the way it would read on its own: a list of objects is + # still JSON, not Python's repr of it. + return ", ".join(_stringify(v) for v in value) if isinstance(value, dict): return json.dumps(value, ensure_ascii=False, default=str) return str(value)