Skip to content

fix(providers): normalize CursorAgent citations to qfix lines#188

Open
Spencer1O1 wants to merge 5 commits into
ThePrimeagen:masterfrom
Spencer1O1:fix/cursor-agent-response-pr
Open

fix(providers): normalize CursorAgent citations to qfix lines#188
Spencer1O1 wants to merge 5 commits into
ThePrimeagen:masterfrom
Spencer1O1:fix/cursor-agent-response-pr

Conversation

@Spencer1O1

@Spencer1O1 Spencer1O1 commented Jul 4, 2026

Copy link
Copy Markdown

Summary

cursor-agent often writes citation blocks (startLine:endLine:filepath fenced format) or mixed text to TEMP_FILE instead of 99 qfix lines. For search/vibe, normalize agent output to qfix format in _retrieve_response via normalize_qfix_response.

Depends on #185 and the workspace PR #186. Rebase onto master after they merge. When stacked on master, review only commit 121599a.

Closes #187 when response issue is filed

Verification

Linux

Repro: Neovim :pwd -> /home, search "Find the main entrypoint".

Agent writes qfix lines to TEMP_FILE; qf_list populated with correct paths:

{"path":"/home/spencerls/tmp/99-8255-prompt","msg":"saved prompt to file"}
{"command":["cursor-agent","--workspace","/home",...]}
{"msg":"stdout","data":"Task complete. Results are in `/home/spencerls/tmp/99-8255`.\n"}
{"msg":"qf_list created","qf_list":[
  {"filename":"/home/spencerls/test.js","lnum":2,"col":1,"text":"Main entry function..."},
  {"filename":"/home/spencerls/test.js","lnum":39,"col":1,"text":"Top-level main() invocation..."}
]}

Windows

Repro: cd C:\Dev, open C:\Dev\test\test.js, search "Find the main entrypoint".

qf_list populated (response fix works). Filename shows "C" instead of full path. This is a separate upstream bug, fixed by #178 (not in this PR stack):

{"path":"C:\\Dev\\test\\tmp/99-1626-prompt","msg":"saved prompt to file"}
{"command":["cursor-agent","--workspace","C:\\Dev",...]}
{"msg":"stdout","data":"```\nC:\\Dev\\test\\test.js:51:1,1,Script entry point...\n```\n"}
{"msg":"qf_list created","qf_list":[
  {"filename":"C","lnum":1,"col":1,"text":"Script entry point that invokes main to start program execution"}
]}

Test plan

  • Unit test: normalize_qfix_response converts citation -> qfix line
  • Unit test: existing qfix lines pass through
  • Manual Windows: search, qf_list populated (paths need fix: quickfix parser breaks on Windows paths with drive letters #178)
  • Manual Linux: search, qf_list populated with correct filenames
  • Manual: 9v visual, raw code replacement via TEMP_FILE (normalization skipped for visual)

Spencer1O1 and others added 3 commits July 4, 2026 01:54
99 saves the full prompt to tmp/99-*-prompt before make_request. Pass a single-line --print message referencing that file with @ instead of putting the multiline XML query on argv.

Closes ThePrimeagen#180
Pass --workspace and set vim.system cwd to the project root. Resolve context.tmp_file under that root so agent writes and 99 reads the same TEMP_FILE path.

Closes ThePrimeagen#181
Convert cursor-agent citation blocks in TEMP_FILE to 99 qfix lines for search/vibe in _retrieve_response via normalize_qfix_response.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Comment thread lua/99/providers.lua Outdated
Avoid false qfix matches from code inside citation blocks (e.g. strings containing colons).

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@Spencer1O1

Copy link
Copy Markdown
Author

Addressing Sentry review: parse citation fences before the per-line QFixHelpers.parse_line scan. Code inside citation blocks (e.g. strings with colons) could false-match as qfix and short-circuit before citation gmatch ran. 803d995 reverses order + adds a spec.

Comment thread lua/99/providers.lua
Plain ` fences without citation headers bypassed the citation-first path but still contained scannable lines. Only scan text outside fenced regions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Spencer1O1

Copy link
Copy Markdown
Author

Re: Sentry follow-up — valid. Citation-first parsing only protects content inside \\start:end:path fences. Plain \\javascript blocks bypassed that path and still ran the per-line qfix scanner. 80b79e9 scans only lines outside any markdown fence (toggle on ^\\ lines). Specs added for plain fences and qfix-outside + code-inside.

@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

Bugbot is not enabled for this team, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CursorAgentProvider: agent output is not parsed as qfix lines for search/vibe

1 participant