Repository navigation
fix(cursor): grep content results keep their matched lines - #25037
juliusmarminge wants to merge 7 commits into
Conversation
Red test for #24919: @cursor/sdk 1.0.35 converts grouped GrepContentResult protos as if they were flat, dropping match text, line numbers, context lines, and totalMatchedLines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor/sdk 1.0.35 converts GrepContentResult protos as if each entry were a
flat match, but the proto groups lines per file (GrepFileMatch{file, matches:
[{lineNumber, content, isContextLine}]}). Every match lost its text and line
number and totalMatches fell to 0.
Patch the SDK converter (esm, cjs, bundled) to flatten grouped results, attach
adjacent context lines as beforeContext/afterContext, read totalMatchedLines,
skip malformed lines, and keep flat legacy results unchanged.
Fixes #24919
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Macroscope skipped reviewing this pull request. Per-review cost limit exceeded (workspace setting). This review would cost an estimated $192.00, which exceeds your per-review limit of $15.00. The top 2 files driving up this estimate:
Tip To get this pull request reviewed, you can:
|
ApprovabilityVerdict: Needs Human Approval Macroscope's review found this PR requires human approval — The change patches Cursor SDK grep conversion to retain matched lines and adds regression coverage. It also introduces a file-level Needs human approval because:
Review your spending limits in Billing settings, or comment |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
SDK version and patch registration pnpm-workspace.yaml |
Pins @cursor/sdk to version 1.0.35 and registers its patch. |
Installed converter regression tests packages/provider-cursor/src/server/adapter.test.ts |
Adds a helper that extracts the installed converter from the ESM or CJS chunk. Tests check grouped matches, context lines, reported totals, legacy-shaped results, malformed entries, and context around gapped matches. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- pingdotgg/t3code#24920: Changes the same Cursor SDK grep conversion behavior and supports grouped and legacy results.
Suggested reviewers: t3dotgg, macroscopeapp
Merge Risk: 
Minimal · previous review c3ab3
-
No actionable merge-blocking issue remains in the reviewed grep change. The converter preserves the reported totals and marked context under the established contract.
Pre-merge checks: 
4
-
Full details: Linked Issues check
-
Explanation
Issue
#24919is the active direct linked issue. The PR patches the Cursor grep converter in the CJS, ESM, and bundled builds. The converter flattens grouped content matches and preserves file, line number, match text, context, and the reported total. The PR retains flat-result handling and rejects malformed entries. The adapter tests cover grouped matches, context, totals, flat compatibility, malformed entries, and both module builds. The SDK override pins the patched dependency.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within the grep-output scope of issue
#24919. The SDK patch changes the grep conversion expression. The workspace override pins that patch. The adapter test loader and regression tests verify the conversion boundary. No client, renderer, settings, or unrelated product behavior changes are reported.
Full details: Description check
-
Explanation
The description includes the required Problem, Change, Scope and approval, and Verification sections. It explains the bug, implementation, linked issue, test results, runtime validation, and untested environments.
-
Finishing Touches: 💡 1
-
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
…rter (#24919) These tests reproduce #24919: @cursor/sdk's grep result converter reads grouped content results as flat matches, so match text, line numbers, context and the reported total are dropped in both the esm and cjs builds. The loader now finds the converter chunk by scanning the build directory instead of a hardcoded chunk number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cursor/sdk 1.0.38 converts native grep content results as flat matches, but the
wire shape groups lines per file (GrepFileMatch{file, matches: [{lineNumber,
content, isContextLine}]}). Every match lost its text, line number and context,
totalMatches fell to 0, and Cursor file-search previews rendered empty.
Patch the SDK converter in the esm, cjs and bundled builds to flatten grouped
results into one match per non-context line, attach contiguous context lines as
beforeContext/afterContext, and report totalMatchedLines. Entries that already
carry `line` keep the SDK's flat handling.
Fixes #24919
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
@cursor/sdk1.0.38 (and 1.0.35 through 1.2.0) converts native grep content results as if they were flat matches. The wire shape is grouped (file+matches[{lineNumber, content, isContextLine}]), so every match loses its text, line number and context, andtotalMatchesbecomes 0. T3's Cursor adapter uses that text as the file-search preview, so a content-mode grep shows bare file names. Reproduced on main97e35bcf23with a real Cursor agent grep (transcript below).Change
A pnpm patch of
@cursor/sdk@1.0.38rewrites only the converter'scontentcase, in the cjs, esm and bundled builds. Grouped results become one match per non-context line, with adjacent context lines attached asbeforeContext/afterContext.totalMatchestakestotalMatchedLines, thentotalMatches, then the match count. Entries that are already flat pass through unchanged. The patch file is large because the SDK ships single-line minified chunks; the logical change is one expression per file. The test reads the installed converter, finds the chunk that holds it instead of hardcoding a chunk number, and fails loudly if a future SDK rewrites it.Scope and approval
Fixes #24919
Triaged via the automated issue flow; GitCafe issue https://git.cafe/pingdotgg/t3code/issues/24919. No settings, contracts or client changes.
Verification
keeps grouped grep content match text, lines, and totals in the %s Cursor SDK build(esm and cjs) fails on unpatched 1.0.38 withline: undefined, nolineNumber/context, andtotalMatches: 0instead of7.vp test run packages/provider-cursor/src/server/adapter.test.ts: 23 passed.vp run check:changed: all checks passed (unused patches, format, lint, knip, typecheck of 39 packages, tests).Agent.create, modeldefault, local cwd = a synthetic two-file fixture) asked for one content-mode grep with one line of context. Same driver, same prompt, before and after:Before: main 97e35bc, unpatched SDK
After: fix/issue-24919 cc081f9, patched SDK
Driver script (scratch, not committed)
Not checked: no before/after UI capture at this head. The renderer is unchanged and the adapter maps
linestraight to the search preview (adapter.ts:486); captures from the earlier 1.0.35 revision were dropped as stale. The bundled build was not run under Bun. Electron and mobile were not run; both consume the same server-side search result.Implemented with Claude Opus 5.5 in Claude Code; reviewed with GPT-6.1-Sol in Codex and Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code