Cursor SDK drops match text from grouped grep output#24919

opened4d agobyNnoahcuadrado

Problem

Cursor SDK 1.0.35, pinned on upstream main 5b35402623d7d1d88eaa472807272a6c2e78012a, treats grouped grep results as flat matches. It drops the nested match text, line numbers, and context, and reports zero matches when the native result supplies totalMatchedLines.

Reproduction

Pass this native result to the installed SDK's grep converter, _x in dist/cjs/689.js:

json
1{
2 "result": {
3 "case": "content",
4 "value": {
5 "matches": [{
6 "file": "src/one.ts",
7 "matches": [{
8 "lineNumber": 11,
9 "content": "needle one",
10 "isContextLine": false
11 }]
12 }],
13 "totalMatchedLines": 1
14 }
15 }
16}

Expected: a content result containing file src/one.ts, line number 11, text needle one, and total 1.

Actual: the file entry has line: undefined, no line number, and totalMatches: 0. The SDK's exported InteractionUpdateSchema rejects that result because the match text is missing. T3's Cursor adapter uses that text as the file-search preview.

Verification

The regression runs the actual installed converter without starting a provider. On current main, the grouped-content case and the truncated-total case fail. The adapter's existing file-search test also fails when fed the converted grouped result. Legacy flat results and rejection of malformed text and call IDs pass.

With a grep-only dependency patch, all 22 tests in packages/provider-cursor/src/server/adapter.test.ts pass, including those cases and the adapter's emitted search previews. The patch preserves adjacent context lines and a reported total greater than the returned match count.

Environment: Ubuntu 24.04 under WSL, Node 26.12.1, SDK 1.0.35. This is an offline SDK and adapter reproduction. A fresh authenticated Cursor turn has not been tested.

Proposed scope

Normalize grouped and flat content results at the SDK conversion boundary. Preserve the existing update schema and reject malformed updates. The proposed patch concerns only grep output.