@@ -76,7 +76,7 @@ def test_build_failed_card_adds_status_hint(self, mock_feishu_channel):
7676 for element in card ["body" ]["elements" ]
7777 )
7878
79- def test_build_completed_card_wraps_long_body_in_collapsible_panel (self , mock_feishu_channel ):
79+ def test_build_completed_card_keeps_long_body_visible (self , mock_feishu_channel ):
8080 task = {
8181 "id" : 99 ,
8282 "title" : "Long output task" ,
@@ -93,10 +93,13 @@ def test_build_completed_card_wraps_long_body_in_collapsible_panel(self, mock_fe
9393 body_text = long_text ,
9494 )
9595
96- assert card ["body" ]["elements" ][0 ]["tag" ] == "collapsible_panel"
97- assert card ["body" ]["elements" ][0 ]["elements" ][0 ]["content" ] == long_text
96+ assert card ["body" ]["elements" ][0 ]["tag" ] == "markdown"
97+ assert card ["body" ]["elements" ] == [{"tag" : "markdown" , "content" : long_text }]
98+ assert not any (
99+ element .get ("tag" ) == "collapsible_panel" for element in card ["body" ]["elements" ]
100+ )
98101
99- def test_build_completed_card_expanded_panel_keeps_full_remainder (self , mock_feishu_channel ):
102+ def test_build_completed_card_long_body_keeps_full_remainder (self , mock_feishu_channel ):
100103 task = {
101104 "id" : 100 ,
102105 "title" : "Long output task" ,
@@ -112,19 +115,15 @@ def test_build_completed_card_expanded_panel_keeps_full_remainder(self, mock_fei
112115 is_completed = True ,
113116 body_text = long_text ,
114117 )
115-
116- panel = next (
117- element
118- for element in card ["body" ]["elements" ]
119- if element .get ("tag" ) == "collapsible_panel"
118+ assert card ["body" ]["elements" ][0 ]["content" ].startswith ("A" * 20 )
119+ assert "" .join (element ["content" ] for element in card ["body" ]["elements" ]) == long_text
120+ assert "truncated" not in "" .join (
121+ element ["content" ] for element in card ["body" ]["elements" ]
120122 )
121- expanded_text = panel ["elements" ][0 ]["content" ]
122-
123- assert expanded_text .startswith ("A" * 20 )
124- assert expanded_text .endswith ("B" * 20 )
125- assert "truncated" not in expanded_text
126123
127- def test_build_completed_card_long_body_uses_summary_plus_full_panel (self , mock_feishu_channel ):
124+ def test_build_completed_card_long_body_uses_summary_plus_full_content (
125+ self , mock_feishu_channel
126+ ):
128127 task = {
129128 "id" : 101 ,
130129 "title" : "Long output task" ,
@@ -142,24 +141,29 @@ def test_build_completed_card_long_body_uses_summary_plus_full_panel(self, mock_
142141 )
143142
144143 assert card ["config" ]["summary" ]["content" ] == "Summary line"
145- assert card ["body" ]["elements" ] == [
146- {
147- "tag" : "collapsible_panel" ,
148- "expanded" : False ,
149- "header" : {
150- "title" : {
151- "tag" : "plain_text" ,
152- "content" : "展开查看完整结果" ,
153- }
154- },
155- "elements" : [
156- {
157- "tag" : "markdown" ,
158- "content" : long_text ,
159- }
160- ],
161- }
162- ]
144+ assert card ["body" ]["elements" ] == [{"tag" : "markdown" , "content" : long_text }]
145+
146+ def test_build_completed_card_long_body_has_no_collapsible_panel (self , mock_feishu_channel ):
147+ task = {
148+ "id" : 102 ,
149+ "title" : "Long output task" ,
150+ "prompt" : "输出一份很长的结果" ,
151+ "agent" : "codex" ,
152+ "working_dir" : "~/workspace/agentforge" ,
153+ }
154+ long_text = "Intro line\n " + ("B" * 1400 )
155+
156+ card = mock_feishu_channel ._build_notification_card (
157+ task_id = 102 ,
158+ task = task ,
159+ is_completed = True ,
160+ body_text = long_text ,
161+ )
162+
163+ assert not any (
164+ element .get ("tag" ) == "collapsible_panel" for element in card ["body" ]["elements" ]
165+ )
166+ assert "" .join (element ["content" ] for element in card ["body" ]["elements" ]) == long_text
163167
164168 def test_send_uses_structured_card_and_fallback_content (self , mock_feishu_channel ):
165169 task = {
0 commit comments