fix: disable OpenCode title generation to improve latency#166
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is kicking off a free cloud agent to fix these issues. This run is complimentary, but you can enable autofix for all future PRs in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78fba90. Configure here.
| or require("99.providers").OpenCodeProvider | ||
| if provider._build_prompt then | ||
| vim.cmd("checktime") | ||
| end |
There was a problem hiding this comment.
Missing return after checktime causes misleading error message
Medium Severity
For providers that edit files directly (like PiProvider), vim.cmd("checktime") correctly reloads the buffer with the AI's edits, but the code continues to fall through without returning. Since PiProvider's prompt instructs the AI to only use its edit tool and not output code in chat, the temp file stays empty, and _retrieve_response returns "". This causes vim.trim(response) == "" to be true, printing "response was empty, visual replacement aborted" — even though the edits were successfully applied. If marks happen to be invalidated by the buffer reload, logger:fatal triggers assert(false, ...), crashing the handler. An early return after vim.cmd("checktime") would avoid both problems.
Reviewed by Cursor Bugbot for commit 78fba90. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
This codebase has no checktime path or PiProvider, so the reported fallthrough and crash scenario cannot occur in the current implementation.
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
| for i = 2, #lines do | ||
| local parts = vim.split(lines[i], "%s+") | ||
| if #parts >= 2 then | ||
| table.insert(models, parts[1] .. "/" .. parts[2]) |
There was a problem hiding this comment.
Whitespace split without trimempty produces wrong model names
Low Severity
vim.split(lines[i], "%s+") without { trimempty = true } produces an empty first element when a line has leading whitespace, causing parts[1] to be "" and model names to be constructed as "/column2" instead of "column1/column2". Every other vim.split call in this file uses { trimempty = true }, suggesting this is an oversight.
Reviewed by Cursor Bugbot for commit 78fba90. Configure here.
There was a problem hiding this comment.
Bugbot Autofix determined this is a false positive.
providers.lua no longer contains the flagged whitespace split logic and all current relevant splits already use safe parsing patterns.
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
|
You have used all of your free Bugbot PR reviews. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |


Before processing the user prompt, OpenCode prompts the LLM to generate a session title for display in the UI.
While the token count isn't much, the additional latency of this request will definitely makes the completion less snappy!
To bypass this, we set the title to an empty string when initializing the OpenCode agent.
Note
Medium Risk
Adds a new provider path that can generate custom prompts and may edit files directly, plus changes the OpenCode command invocation; issues here could affect request execution and buffer state for multiple providers.
Overview
Improves provider extensibility by letting providers optionally implement
_build_prompt, whichPrompt:start_requestnow uses to generate the request text instead of always concatenatingagent_context.Disables OpenCode’s session-title generation by passing
--title ""inOpenCodeProvider._build_command(to reduce extra latency), and adds a newPiProviderthat formats a file-editing prompt with line-numbered visual snippets, supportspi --list-models, and triggers achecktimebuffer reload after successful visual edits for providers that edit files directly. Tests are updated/added to cover the new command args andPiProviderbehavior.Reviewed by Cursor Bugbot for commit 78fba90. Bugbot is set up for automated code reviews on this repo. Configure here.