From d2881b82b0ec10dab2ca6704d264914ff2dfdf03 Mon Sep 17 00:00:00 2001 From: ex_tianzy Date: Thu, 12 Nov 2026 17:05:04 +0800 Subject: [PATCH] fix(work): remove attachment delivery notices from task cards --- deployable/relay/task_cards.py | 15 +-------------- deployable/tests/test_task_cards.py | 4 ++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/deployable/relay/task_cards.py b/deployable/relay/task_cards.py index 9108bf1..98173d4 100644 --- a/deployable/relay/task_cards.py +++ b/deployable/relay/task_cards.py @@ -19,15 +19,6 @@ def card_content(task_id,execution,delivery,files=None,connection_lost=False): elements=[{'tag':'div','text':{'tag':'plain_text','content':'任务状态:'+label}}, {'tag':'div','text':{'tag':'plain_text','content':'文字回复:'+DELIVERY.get(delivery,'状态待核对')}}, {'tag':'note','elements':[{'tag':'plain_text','content':'任务编号:'+task_id}]}] - if files is not None: - counts={} - for status in files:counts[status]=counts.get(status,0)+1 - sent=counts.get('sent',0) - pending=sum(counts.get(s,0)for s in ('ready','uploading','uploaded','sending')) - unresolved=len(files)-sent-pending - description=('未收到登记的文件,不代表附件已交付' if not files else - f'已发送{sent}件,待投递{pending}件,异常或待核对{unresolved}件') - elements.insert(2,{'tag':'div','text':{'tag':'plain_text','content':'附件交付:'+description}}) if execution=='waiting_for_approval': elements.insert(1,{'tag':'div','text':{'tag':'plain_text','content':'请在客户端查看并确认具体操作。本卡片暂不提供远程批准。'}}) if execution=='completed' and delivery!='replied': @@ -65,12 +56,8 @@ class TaskCards: execution=row['execution_state'] if row else 'unknown' if task['status']=='unknown' and execution not in {'completed','failed','cancelled','interrupted'}:execution='unknown' if task['deadline']<=self.clock() and execution not in {'completed','failed','cancelled','interrupted'}:execution='unknown' - files=None - if self.files_enabled: - files=[r['status']for r in self.db.execute("SELECT status FROM work_files_v1 WHERE task_id=? AND environment=? AND app_id=? AND direction='output'", - (task['turn_id'],self.state.environment,self.state.app_id)).fetchall()] lost=self.db.execute('SELECT reason FROM work_task_connection_v3 WHERE task_id=?',(task['turn_id'],)).fetchone() - return card_content(task['turn_id'],execution,delivery['status'] if delivery else None,files,connection_lost=bool(lost)) + return card_content(task['turn_id'],execution,delivery['status'] if delivery else None,connection_lost=bool(lost)) async def flush(self): # Bound one maintenance pass; business result delivery remains independent. diff --git a/deployable/tests/test_task_cards.py b/deployable/tests/test_task_cards.py index 85afeba..942622e 100644 --- a/deployable/tests/test_task_cards.py +++ b/deployable/tests/test_task_cards.py @@ -119,9 +119,9 @@ def test_card_projection_never_exposes_task_body_or_markdown_controls(): def test_text_delivery_never_claims_attachments_delivered(): text=json.dumps(card_content('synthetic','completed','replied',[]),ensure_ascii=False) - assert '文字回复:' in text and '未收到登记的文件' in text + assert '文字回复:' in text and '附件交付' not in text and '未收到登记' not in text mixed=json.dumps(card_content('synthetic','completed','replied',['sent','ready','unknown']),ensure_ascii=False) - assert '已发送1件,待投递1件,异常或待核对1件' in mixed + assert '附件交付' not in mixed and '待投递1件' not in mixed @pytest.mark.parametrize('state,color',[