Skip to content

fix(confirm-write): render list items on the approval card like top-level values - #91

Open
RaphaelFakhri wants to merge 1 commit into
CopilotKit:mainfrom
RaphaelFakhri:fix/approval-card-list-of-objects
Open

RaphaelFakhri wants to merge 1 commit into
CopilotKit:mainfrom
RaphaelFakhri:fix/approval-card-list-of-objects

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

summarize_args builds the rows of the confirm_write approval card. A top-level object renders as compact JSON, and a top-level boolean renders as Yes or No. Items inside a list skip those rules and go through str(), so the card shows Python's repr instead:

  • A list of objects, such as the pages argument of a Notion page creation or the links of a Linear issue, renders as {'title': 'Q3 plan'}, {'title': 'Q4 plan'}.
  • A list of booleans renders as True, False.

The approver reads these rows to decide whether to allow the write, so the card should present a list item the same way it presents the same value on its own.

Change

  • _stringify formats each list or tuple item with _stringify instead of str(). Strings, numbers, and flat lists render exactly as before.
  • New test test_summarize_args_renders_list_items_like_top_level_values covers a list of objects and a list of booleans.

Testing

From agent/:

  • uv run pytest -q tests/test_write_confirmation.py: 53 passed. With only the source change reverted, the new test fails (1 failed, 52 passed) with "{'title': 'Q3 plan'}, {'title': 'Q4 plan'}".
  • uv run pytest -q: 853 passed, 1 skipped.

Fixes #90

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Approval card shows Python repr for list arguments that contain objects

1 participant