Skip to content

Cursor SDK drops match text from grouped grep output #24919

Description

@noahcuadrado

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:

{
  "result": {
    "case": "content",
    "value": {
      "matches": [{
        "file": "src/one.ts",
        "matches": [{
          "lineNumber": 11,
          "content": "needle one",
          "isContextLine": false
        }]
      }],
      "totalMatchedLines": 1
    }
  }
}

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions