Repository navigation
fix(cursor): subagent grep results in files and count modes are no longer empty - #32220
MarcoDotIO wants to merge 1 commit into
Conversation
…nger empty Cursor serializes a Task subagent's conversation steps with protobuf toJson(), where each workspace's GrepUnionResult is a oneof of `content`, `files` or `count`. The nested converter read only `content`, so a subagent grep in files_with_matches or count mode showed no results in its child thread. Map the `files` and `count` cases to the SDK's own grep result shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This restores file lists and match counts in Cursor subagent grep results using existing rendering support. The change is limited to result conversion, with no changes to search execution or product defaults. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
When a Cursor Task subagent runs a grep in
files_with_matchesorcountmode, its row in the subagent's child thread shows no results, even when the grep found files.The call path: a completed
tasktool call reachesemitSubagent, which replays the subagent'sconversationStepsthroughtoolCallsFromConversationSteps→nestedToolCallFromEnvelope→nestedGrepWorkspaceResults. The SDK builds those steps with protobuftoJson()(conversationSteps.map((e) => e.toJson?.() ?? e)in@cursor/sdk1.2.0). In that format each workspace'sGrepUnionResultis a oneof ofcontent,filesorcount.nestedGrepWorkspaceResultsread onlycontent, so afilesorcountresult became acontentresult with no matches.cursorToolSearchResultsthen had nothing to show.Change
nestedGrepWorkspaceResultsnow maps thefilesandcountcases to the same shapes the SDK uses for top-level grep calls:{ type: "files", output: { files, count } }and{ type: "count", output: { counts, total } }.cursorToolSearchResultsalready renders both shapes for top-level grep calls, so the child thread now lists the matching files, or each file with its "N matches" count. Thecontentcase is unchanged.Scope and approval
This is a small fix for an obvious bug, so it has no issue. It changes one converter in the Cursor adapter, and the converter now matches the proto's own
GrepUnionResultoneof. Contracts, settings and clients do not change. The child thread's grep row now shows the results it should have shown; the layout does not change.Not in this PR, and covered elsewhere:
Verification
I extended
projects subagent search results Cursor serialized with protobuf toJsoninpackages/provider-cursor/src/server/adapter.test.ts, the existing subagent test whose steps are shaped liketoJson()output. It now includes onefiles_with_matchesgrep step and onecountgrep step.Before the fix (upstream
main), both new rows come back empty:After the fix:
Targeted
vp lintandvp fmt --checkonpackages/provider-cursor/src/serverpassed, andeffect-tsgotypecheck inpackages/provider-cursorreported 0 errors.Not checked: a live Cursor subagent run. The
toJson()shape comes from the SDK's proto descriptors (GrepUnionResult|1 count|2 files|3 content,GrepFilesResult|1 files|2 total_files,GrepCountResult|1 counts|2 total_files|3 total_matches) and from the SDK code that serializes the steps. It was not captured from a real run.Reviewed with sol-loop: 1 round with gpt-6.1-sol. Sol verdict: approved
Created with Claude Opus 5.5 in the Claude Code desktop app.
🤖 Generated with Claude Code