Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Merge main and preserve mobile failed-sampling presentation

shenjiachengca90b8735aae
diff --cc apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx
index 28dd525dca,28dd525dca..0ea49a1a28
--- a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx
+++ b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx
@@@ -106,6 -106,6 +106,27 @@@ describe('attachment-only user plugin b
});
describe('partner work feedback', () => {
++ it('retains failed reply warnings inside expanded work and the upstream error notice', () => {
++ const items = buildMobileMessageRenderItems([
++ msg('failed', 'assistant', 'Incomplete opening', { agentMeta: { failedSamplingAttempt: {
++ threadId: 'thread', turnId: 'turn', attempt: 1, itemId: 'item',
++ } } }),
++ msg('error', 'error', 'Connection interrupted'),
++ msg('answer', 'assistant', 'Accepted answer', { agentMeta: { turnCompleted: true } }),
++ ], { isSessionStreaming: false });
++ viewportHarness.expanded = true;
++ try {
++ const host = document.createElement('div');
++ host.innerHTML = renderClient(<MessageRenderer items={items} />);
++ expect(host.textContent).toContain('This reply did not complete. Its content is for reference only.');
++ expect(host.textContent).toContain('Could not complete the reply');
++ expect(host.textContent).toContain('Error Details');
++ expect(host.querySelectorAll('[data-testid="message.agentBubble"]')).toHaveLength(2);
++ } finally {
++ viewportHarness.expanded = false;
++ }
++ });
++
it('uses the short hint in the existing live work row and preserves the completed record', () => {
const messages = [msg('u', 'user', 'Remember this'), msg('c', 'tool_use', {
toolName: 'bot_memory', toolUseId: 'c', input: { action: 'write' },
diff --cc apps/mobile/src/session/MessageRenderer.tsx
index 2da2fde65d,8457d2a602..6b31942bcd
--- a/apps/mobile/src/session/MessageRenderer.tsx
+++ b/apps/mobile/src/session/MessageRenderer.tsx
@@@ -3924,12 -3925,11 +3925,16 @@@ function MessageBubble(
/>
) : null}
{attachmentStripNode}
+ {item.message.failedSamplingAttempt ? (
+ <Text style={styles.failedSamplingAttemptText}>
+ {t('message.renderer.failedSamplingAttempt')}
+ </Text>
+ ) : null}
- {hasBubbleContent || (!attachmentStripNode && messageQuotes.length === 0) ? bubble : null}
+ {item.message.role === 'error' ? (
+ <ErrorNotice message={displayBubbleBody}>
+ {item.message.rawError ? <AgentErrorDetails key={item.message.key} message={item.message.rawError} /> : null}
+ </ErrorNotice>
+ ) : hasBubbleContent || (!attachmentStripNode && messageQuotes.length === 0) ? bubble : null}
{actions.companion && item.message.kind === 'assistant' && item.message.body.trim() ? (
<CompanionLearningFooter receipts={item.message.source.agentMeta?.botLearning}
onOpenSettings={actions.onOpenCompanionSettings} />