Skip to content

Fix code execution, R Markdown, and editor request bugs - #1874

Merged
renkun-ken merged 7 commits into
mainfrom
codex/fix-codebase-review-bugs
Oct 14, 2026
Merged

renkun-ken merged 7 commits into
mainfrom
codex/fix-codebase-review-bugs

Conversation

@renkun-ken

@renkun-ken renkun-ken commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Word-based commands could select the entire document when the cursor was outside a word, and the final R chunk could lose its last code line. This PR fixes those execution bugs along with failures in R Markdown jobs, generated-file prompts, and RStudio editor requests.

  • Preserve chunk boundaries and escaped strings, quote R literals correctly, and collect complete UTF-8 process output. Failed spawning and synchronous progress errors now settle their promises.
  • Handle R Markdown startup failures and fragmented completion markers, release busy state after errors, preserve quoted paths and custom knit expressions, use the document's workspace for site discovery, and clean temporary drafts reliably.
  • Preserve existing configuration files when overwrite prompts are dismissed and when compiler configuration generation fails; restore .lintr if replacement generation fails or R is unavailable, including partially written output. Await .gitignore writes and report errors.
  • Wait for RStudio document edits and editor opening before acknowledging requests, report errors when VS Code cannot apply an edit, and correct the one-based line check that added unwanted newlines.

Added 28 regression tests across these cases.

Validation

  • Build/test compilation, TypeScript typecheck, TypeScript lint, R lint, and git diff --check passed.
  • Node suite: 205 passing.
  • Latest local VS Code provider suite: 569 passing, including the review regressions.
  • CI passed the supported extension and Interactive suites on Linux, macOS, and Windows.
  • Bundled sess: 1,247 successful checks; source/release script tests: 29 passing.
  • Base R source-identity and manual-attachment checks passed.

Validated locally on macOS with VS Code 1.141.1. CI is passing on Linux, macOS, and Windows for the latest commit.

@renkun-ken
renkun-ken requested a review from eitsupi October 13, 2026 22:56

@eitsupi eitsupi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed with ChatGPT.

The changes look generally sound, and CI is passing on all three platforms. I found two issues worth addressing before merging:

  1. Preserve the existing .lintr file if generation fails

    After the user confirms overwriting, unlinkSync(lintrFilePath) deletes the existing configuration before lintr::use_lintr() runs. If R is unavailable or the command fails, the user's configuration is permanently lost. Please preserve the original until replacement generation succeeds, and add a regression test for this failure path.

  2. Check the result of workspace.applyEdit()

    Both insertOrModifyText() and documentNew() now await workspace.applyEdit(), which is an improvement. However, the API returns false when the edit cannot be applied, without necessarily rejecting the promise. These functions currently report successful completion even when no edit was applied. Please handle false explicitly and add a regression test.

The remaining changes look reasonable to me. In particular, the chunk boundary fixes, UTF-8 decoding, process completion handling, and busy-state cleanup are welcome improvements.

@renkun-ken
renkun-ken requested a review from eitsupi October 13, 2026 23:35
@renkun-ken
renkun-ken merged commit e2b28f1 into main Oct 14, 2026
5 checks passed
@renkun-ken
renkun-ken deleted the codex/fix-codebase-review-bugs branch October 14, 2026 00:06
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.

2 participants