fix(wechat): scrub image_url from sessions and harden vision handoff.
Memind CI / Test, build, and release guards (pull_request) Failing after 19s
Memind CI / Test, build, and release guards (pull_request) Failing after 19s
Strip image_url from persisted session payloads, keep image turns scoped to the active request, and align proxy/vision/page-data paths so WeChat image history does not leak into fresh sessions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1534,6 +1534,58 @@ test('submitSessionReplyForUser fails closed when historical image scrub is unsu
|
||||
});
|
||||
});
|
||||
|
||||
test('submitSessionReplyForUser rotates when assistant history still has image_url', async () => {
|
||||
await withFakeGoosedSession(async ({ apiTarget, workingDir, replyBodies }) => {
|
||||
const proxy = createTkmindProxy({
|
||||
apiTarget,
|
||||
apiSecret: 'test-secret',
|
||||
userAuth: {
|
||||
...createMemoryTestUserAuth(workingDir),
|
||||
async ownsSession() {
|
||||
return true;
|
||||
},
|
||||
async canUseChat() {
|
||||
return { ok: true };
|
||||
},
|
||||
async getUserById() {
|
||||
return { id: 'user-1' };
|
||||
},
|
||||
async resolveUserPolicies() {
|
||||
return { unrestricted: true, policies: {} };
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
await assert.rejects(
|
||||
proxy.submitSessionReplyForUser(
|
||||
'user-1',
|
||||
'session-1',
|
||||
'request-after-assistant-image',
|
||||
{
|
||||
id: 'message-current',
|
||||
role: 'user',
|
||||
content: [{ type: 'text', text: '这张图是什么' }],
|
||||
metadata: { imageUrls: ['https://example.com/new.png'] },
|
||||
},
|
||||
{ requireHistoricalImageIsolation: true },
|
||||
),
|
||||
/historical_image_session_update_unsupported:image_url_content_present/,
|
||||
);
|
||||
assert.equal(replyBodies.length, 0);
|
||||
}, {
|
||||
conversation: [
|
||||
{
|
||||
id: 'assistant-old-image',
|
||||
role: 'assistant',
|
||||
content: [
|
||||
{ type: 'text', text: '我看到了图片' },
|
||||
{ type: 'image_url', image_url: { url: 'https://example.com/old.png' } },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
test('visual fallback session removes read_image while preserving the text task path', async () => {
|
||||
await withFakeGoosedSession(async ({
|
||||
apiTarget,
|
||||
|
||||
Reference in New Issue
Block a user