Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

eval: cover mixed image paste through the note editor

Louis Beaumont6ebac3c2b3d1
diff --git a/evals/coding-agent/README.md b/evals/coding-agent/README.md
index fc7aa98e4..47175a6d6 100644
--- a/evals/coding-agent/README.md
+++ b/evals/coding-agent/README.md
@@ -22,6 +22,17 @@ This does not execute the full search modal, native window events, macOS focus,
real IPC, execution isolation or model trials. Current cache prewarm is checked
separately and is allowed while the view is hidden.
+`app-mixed-note-paste` mounts the actual React and TipTap meeting-note editor
+with synthetic image conversion and inert menus/localization. Five outcomes cover
+mixed text/image paste, ordinary text, image-only files and HTML, and a delayed
+image after a keyed meeting switch. The parent loses mixed-paste text; four nearby
+outcomes pass. The historical fix and current source pass all five. Run
+`bun test evals/coding-agent/calibrate-note-paste.test.js` for calibration,
+including unused correct code, equivalent paragraph construction, lost text or
+images, blanket paste refusal and missing-source classification. Fixtures and
+dependency links appear only when grading begins. This does not execute native
+clipboard delivery, image encoding, disk autosave, agent isolation or model trials.
+
The current app corpus contains 80 git-mined regressions. See
[DESIGN.md](./DESIGN.md) for the Anthropic guidance, source contract, and
history-mining workflow. The companion website manifest uses this same harness.
diff --git a/evals/coding-agent/calibrate-note-paste.test.js b/evals/coding-agent/calibrate-note-paste.test.js
new file mode 100644
index 000000000..f8cd25a9e
--- /dev/null
+++ b/evals/coding-agent/calibrate-note-paste.test.js
@@ -0,0 +1,47 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import { afterAll, expect, test } from 'bun:test';
+import { execFileSync, spawnSync } from 'node:child_process';
+import { dirname, join, resolve } from 'node:path';
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+const repo = resolve(import.meta.dir, '../..'), app = 'apps/screenpipe-app-tauri';
+const item = JSON.parse(readFileSync(join(import.meta.dir, 'cases.json'), 'utf8')).cases.find(c => c.id === 'app-mixed-note-paste');
+const hook = `${app}/components/meeting-notes/note-editor.tsx`;
+const root = mkdtempSync(join(tmpdir(), 'note-paste-calibration-')), archives = new Map();
+const receipts = process.env.SCREENPIPE_EVAL_CALIBRATION_RECEIPTS;
+afterAll(() => rmSync(root, {recursive: true, force: true}));
+function replace(cwd, file, from, to) {
+ const p = join(cwd, file), text = readFileSync(p, 'utf8');
+ expect(text.split(from)).toHaveLength(2);
+ writeFileSync(p, text.replace(from, to));
+}
+function grade(name, ref = item.oracle_ref, mutate = () => {}) {
+ const cwd = join(root, name); mkdirSync(cwd);
+ if (!archives.has(ref)) {
+ // Archive historical frontend source/config, never node_modules, credentials,
+ // native build outputs or future source. No evaluated agent runs here.
+ const children = execFileSync('git', ['ls-tree', '--name-only', `${ref}:${app}`], {cwd: repo, encoding: 'utf8'}).trim().split('\n');
+ const paths = children.filter(n => !['src-tauri', 'public', 'e2e', '.e2e'].includes(n) && !n.startsWith('.env')).map(n => `${app}/${n}`);
+ for (const path of ['packages/workflows-ui', 'crates/screenpipe-core/assets']) { if (execFileSync('git', ['ls-tree', ref, path], {cwd:repo, encoding:'utf8'}).trim()) paths.push(path); }
+ archives.set(ref, execFileSync('git', ['archive', ref, ...paths], {cwd: repo, maxBuffer: 128 * 1024 * 1024}));
+ }
+ execFileSync('tar', ['-x', '-C', cwd], {input: archives.get(ref)});
+ for (const f of item.grader.fixtures) { const dest = join(cwd, f.destination_path); mkdirSync(dirname(dest), {recursive:true}); writeFileSync(dest, readFileSync(join(import.meta.dir, f.local_path))); }
+ symlinkSync(join(repo, app, 'node_modules'), join(cwd, app, 'node_modules'), 'dir');
+ mutate(cwd);
+ const r = spawnSync('/bin/bash', ['-c', item.grader.command], {cwd, encoding:'utf8', timeout:60000, maxBuffer:4*1024*1024, env:{PATH:process.env.PATH, HOME:cwd, CI:'true', TZ:'UTC', NO_COLOR:'1'}});
+ if (receipts) { mkdirSync(receipts,{recursive:true}); writeFileSync(join(receipts, name+'.stdout'), r.stdout||''); writeFileSync(join(receipts,name+'.stderr'),r.stderr||''); writeFileSync(join(receipts,name+'.json'),JSON.stringify({ref,command:item.grader.command,exit_code:r.status,signal:r.signal,error:r.error?.message},null,2)); }
+ expect(r.error).toBeUndefined(); expect(r.signal).toBeNull(); return r;
+}
+function passes(r) { expect(r.status).toBe(0); expect(r.stdout).toContain('5 passed'); expect(r.stdout+r.stderr).not.toMatch(/Unhandled|Uncaught/); }
+function fails(r) { expect(r.status).toBe(1); expect(r.stderr).toMatch(/AssertionError|TestingLibraryElementError|Error: expect\(element\)\.toHaveFocus\(\)/); expect(r.stdout+r.stderr).not.toMatch(/Unhandled|Uncaught|Failed to resolve import|Failed to load url|Cannot find module/); }
+test('parent loses mixed-paste text and preserves four outcomes',()=>{const r=grade('parent',item.base_ref);fails(r);expect(r.stdout).toContain('1 failed | 4 passed');},60000);
+test('historical reference passes five outcomes',()=>passes(grade('reference')),60000);
+test('current editor passes five outcomes',()=>passes(grade('current','HEAD')),60000);
+test('a different paragraph construction preserves the same result',()=>passes(grade('equivalent',item.oracle_ref,cwd=>replace(cwd,hook,'return plainTextToEditorContent(text);','return text.split("\\n").map(line => line ? ({type: "paragraph", content: [{type: "text", text: line}]}) : ({type: "paragraph"}));'))),60000);
+test('unused correct editor does not hide an active broken editor',()=>fails(grade('unused',item.oracle_ref,cwd=>{writeFileSync(join(cwd,`${app}/unused-editor.tsx`),readFileSync(join(cwd,hook)));writeFileSync(join(cwd,hook),execFileSync('git',['show',`${item.base_ref}:${hook}`],{cwd:repo}));})),60000);
+test('dropping mixed-paste text fails',()=>fails(grade('lost-text',item.oracle_ref,cwd=>replace(cwd,hook,'const textContent = meetingNotePasteTextContent(payload);','const textContent = null;'))),60000);
+test('dropping clipboard images fails preserved image behavior',()=>fails(grade('lost-images',item.oracle_ref,cwd=>replace(cwd,hook,'insertImages(imageSources);','insertImages([]);'))),60000);
+test('blanket paste refusal fails ordinary text',()=>fails(grade('refuse',item.oracle_ref,cwd=>replace(cwd,hook,'handlePaste(_view, event) {','handlePaste(_view, event) { event.preventDefault(); return true;'))),60000);
+test('missing editor remains an infrastructure failure',()=>{const r=grade('missing',item.oracle_ref,cwd=>rmSync(join(cwd,hook)));expect(r.status).toBe(1);expect(r.stdout).toContain('no tests');expect(r.stdout+r.stderr).toMatch(/Failed to resolve import|Failed to load url/);},60000);
diff --git a/evals/coding-agent/cases.json b/evals/coding-agent/cases.json
index baeb4edd9..73cd99feb 100644
--- a/evals/coding-agent/cases.json
+++ b/evals/coding-agent/cases.json
@@ -4758,6 +4758,49 @@
],
"command": "cd apps/screenpipe-app-tauri && node node_modules/vitest/vitest.mjs run --config vitest.config.ts eval-search-lifecycle.test.tsx"
}
+ },
+ {
+ "id": "app-mixed-note-paste",
+ "name": "Preserve text when pasting an image into meeting notes",
+ "source": {
+ "kind": "git_regression",
+ "fix_commit": "7c4e89fb03d9e39f680a440bef37152f9207fd2e"
+ },
+ "base_ref": "46fe476a01841e3b20b4ded99d87d6abd20dcfbc",
+ "oracle_ref": "7c4e89fb03d9e39f680a440bef37152f9207fd2e",
+ "oracle_paths": [
+ "apps/screenpipe-app-tauri/components/meeting-notes/note-editor.tsx"
+ ],
+ "gate": "advisory",
+ "trigger_paths": [
+ "apps/screenpipe-app-tauri/components/meeting-notes/note-editor.tsx",
+ "apps/screenpipe-app-tauri/components/meeting-notes/image-utils.ts"
+ ],
+ "tags": [
+ "regression",
+ "escaped-failure",
+ "meeting-notes",
+ "clipboard",
+ "data-loss"
+ ],
+ "prompt": "Pasting a clipboard image together with readable text into a meeting note loses the text. Fix the actual editor paste path so the resulting document and emitted markdown retain both the image and the accompanying text. Preserve ordinary text paste, image-only file paste, and HTML-only image paste without duplicating the image URL as visible text. If the meeting changes while an image is being converted, the old paste must not insert into the newly keyed note. Preserve public editor interfaces. Checks mount the real React and TipTap editor with synthetic image conversion, inert menus and localization; native clipboard delivery, image encoding and disk autosave are outside this task. Any implementation satisfying these outcomes is accepted.",
+ "agent_timeout_seconds": 900,
+ "grader_dependency_links": [
+ {
+ "source_path": "apps/screenpipe-app-tauri/node_modules",
+ "destination_path": "apps/screenpipe-app-tauri/node_modules"
+ }
+ ],
+ "grader": {
+ "timeout_seconds": 60,
+ "fixtures": [
+ {
+ "local_path": "graders/mixed-note-paste.fixture.tsx.txt",
+ "destination_path": "apps/screenpipe-app-tauri/eval-mixed-note-paste.test.tsx"
+ }
+ ],
+ "command": "cd apps/screenpipe-app-tauri && node node_modules/vitest/vitest.mjs run --config vitest.config.ts eval-mixed-note-paste.test.tsx"
+ }
}
]
}
diff --git a/evals/coding-agent/graders/mixed-note-paste.fixture.tsx.txt b/evals/coding-agent/graders/mixed-note-paste.fixture.tsx.txt
new file mode 100644
index 000000000..8e95e1f4a
--- /dev/null
+++ b/evals/coding-agent/graders/mixed-note-paste.fixture.tsx.txt
@@ -0,0 +1,21 @@
+// screenpipe — AI that knows everything you've seen, said, or heard
+// https://screenpipe.com
+import React from 'react';
+import {afterEach,beforeEach,expect,test,vi} from 'vitest';
+import {render,fireEvent,waitFor,cleanup,act} from '@testing-library/react';
+const ports=vi.hoisted(()=>({convert:vi.fn()}));
+vi.mock('./components/meeting-notes/image-utils',async importOriginal=>({...await importOriginal<any>(),imageFileToDataUrl:(f:File)=>ports.convert(f)}));
+vi.mock('./components/meeting-notes/editor-menus',()=>({FormatToolbar:()=>null,SlashCommandMenu:()=>null}));
+vi.mock('gt-react',async importOriginal=>({...await importOriginal<any>(),useGT:()=>(text:string)=>text}));
+vi.mock('@/lib/i18n/provider',()=>({useUiLocale:()=> 'en'}));
+import {NoteEditor} from './components/meeting-notes/note-editor';
+const image='data:image/png;base64,iVBORw0KGgo=';
+beforeEach(()=>{ports.convert.mockReset();ports.convert.mockResolvedValue(image);HTMLElement.prototype.scrollIntoView=()=>{}; Range.prototype.getClientRects=()=>[] as any; Range.prototype.getBoundingClientRect=()=>({x:0,y:0,left:0,top:0,right:0,bottom:0,width:0,height:0,toJSON:()=>({})});});
+afterEach(()=>cleanup());
+async function mount(key='a') {const changes=vi.fn();const result=render(<NoteEditor key={key} value="" onChange={changes}/>);await waitFor(()=>expect(result.container.querySelector('.tiptap')).not.toBeNull());return {...result,changes,editor:result.container.querySelector('.tiptap')!};}
+function paste(editor:Element,{file=true,text='',html=''}={}){const img=new File(['synthetic'],'shot.png',{type:'image/png'});const event=new Event('paste',{bubbles:true,cancelable:true});Object.defineProperty(event,'clipboardData',{value:{files:file?[img]:[],items:file?[{kind:'file',getAsFile:()=>img}]:[],types:['text/plain','text/html'],getData:(format:string)=>format==='text/plain'?text:format==='text/html'?html:''}});fireEvent(editor,event);return event;}
+test('mixed clipboard preserves readable text and an image',async()=>{const r=await mount();paste(r.editor,{text:'agenda followup'});await waitFor(()=>expect(r.editor.querySelector('img')?.getAttribute('src')).toBe(image));expect(r.editor.textContent).toContain('agenda followup');expect(r.changes.mock.calls.at(-1)?.[0]).toContain('agenda followup');expect(r.changes.mock.calls.at(-1)?.[0]).toContain(image);});
+test('image-only file paste remains usable',async()=>{const r=await mount();paste(r.editor);await waitFor(()=>expect(r.editor.querySelectorAll('img')).toHaveLength(1));});
+test('HTML-only image is inserted without duplicating its URL as text',async()=>{const r=await mount();paste(r.editor,{file:false,text:image,html:`<img src="${image}">`});await waitFor(()=>expect(r.editor.querySelector('img')?.getAttribute('src')).toBe(image));expect(r.editor.textContent).not.toContain(image);});
+test('ordinary text paste remains readable',async()=>{const r=await mount();paste(r.editor,{file:false,text:'ordinary agenda'});await waitFor(()=>expect(r.editor.textContent).toContain('ordinary agenda'));expect(ports.convert).not.toHaveBeenCalled();});
+test('late old-note image does not reach a newly keyed meeting',async()=>{let resolve!:(s:string)=>void;ports.convert.mockReturnValue(new Promise<string>(r=>resolve=r));const r=await mount();paste(r.editor,{text:'old note'});await waitFor(()=>expect(ports.convert).toHaveBeenCalledTimes(1));r.rerender(<NoteEditor key="b" value="new note" onChange={r.changes}/>);await waitFor(()=>expect(r.container.querySelector('.tiptap')?.textContent).toContain('new note'));await act(async()=>{resolve(image);await Promise.resolve();});expect(r.container.querySelectorAll('img')).toHaveLength(0);expect(r.container.querySelector('.tiptap')?.textContent).not.toContain('old note');});