Skip to content

Make sess pure R while retaining arf Interactive sessions - #1830

Merged
renkun-ken merged 9 commits into
mainfrom
codex/pure-r-sess
Oct 6, 2026
Merged

renkun-ken merged 9 commits into
mainfrom
codex/pure-r-sess

Conversation

@renkun-ken

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

Copy link
Copy Markdown
Member

Installing bundled sess currently requires a C compiler because the experimental Interactive console bridge lives in the package. This removes that bridge and makes sess a pure R package, implementing approach 2 from #1829 while retaining Interactive through arf.

Managed headless arf sessions retain streaming console output, interruption, queues, history/reconnection, workspace inspection, editor requests, rich tables, HTML, and JGD or standard plots. Execution uses arf user_input to avoid its unbounded evaluation-output capture. Rich events use authenticated sess RPC with small stdout references to preserve their order relative to console output; a stderr fence drains both pipes before completion. Buffer limits and fork guards protect the transport.

Attached arf sessions retain existing objects, return notebook console output on completion, and deliver rich events through sess RPC. Disposal leaves the adopted R process alive and restores its runtime hooks. Empty R notification parameters are accepted so real terminal task callbacks keep the transport connected. Bootstrap and notebook execution respect arf's visible IPC approval policy.

The installer checks the pure R Interactive API contract. CI installs arf 0.5.3 for Linux/macOS runtime tests. CI fixture fixes retain R discovery when tmux/standalone Node are excluded from PATH, and Windows process ancestry lookup allows cold PowerShell/CIM startup to complete.

Compatibility and limits:

  • New Interactive sessions require arf; ordinary R terminals remain available without it, and existing agents can still reconnect.
  • Notebook console input and debugger prompts are unavailable because arf IPC cannot answer nested R prompts. Attached sessions cannot subscribe to arbitrary terminal console output.
  • sess itself needs no compiler. Existing dependencies such as processx, later, and jsonlite still contain native code and need installed copies or repository binaries.
  • Persistent Interactive supervision remains limited to Linux/macOS. Windows CI verifies sess and ordinary extension behavior; the real arf runtime suite is skipped there.

Validation on macOS arm64 with R 4.6.1 and arf 0.5.3:

  • 116 Node tests, 391 VS Code extension tests, and 2 real VS Code installation-task tests passed. Standard graphics also passed its full applicable suite and both final output/adoption regression checks.
  • sess tinytest: all 1,246 results passed. Compiler-disabled source installation, source identity/bootstrap checks, TypeScript typecheck, R/TypeScript lint, and production VSIX identity checks passed; bundled sess has no native sources or libraries.
  • All 36 analysis workflows passed with both JGD and standard graphics (72 executions), including base/grid/lattice/ggplot2 plots, data.table/tidyverse analysis, statistical models, file exports, DT and Plotly widgets.
  • Browser verification passed DT search/sorting/paging/page-size controls and Plotly zoom/reset. The renderer passed 102 assertions in each of dark, narrow/light and high-contrast layouts.
  • Back-to-back cells retained complete 400 KB Unicode stderr, stdout and rich display before completion. Adopted sessions passed rich output, inspection, interruption, continued evaluation and detach checks.
  • A real interactive arf terminal passed adoption through its approval prompts, preserved objects, produced notebook console/table/plot output, detached and remained usable afterward. This check found and verified the empty-notification fix.
  • Full VS Code quit/reopen from 1.110 to 1.140 preserved the R PID and objects. New session launch also succeeded without standalone Node on PATH.
  • Large-table previews and final-page access passed at 100,000, 2,000,000 and 832,976,871 ALTREP rows with bounded allocations.

Remote SSH lifecycle behavior has not been manually verified. Latest cross-platform CI results are linked in the validation comment.

Closes #1829.

@renkun-ken renkun-ken added this to the 3.1.0 milestone Oct 5, 2026
@renkun-ken

Copy link
Copy Markdown
Member Author

Completed comprehensive Interactive verification on macOS arm64 with R 4.6.1 and arf 0.5.3, including both managed headless and adopted terminal sessions.

  • 116 Node tests, 391 VS Code extension tests, 2 real installation-task tests, and all 1,246 sess tinytest results passed locally. Standard graphics passed its applicable suite and the final adoption/output regressions.
  • All 36 analysis workflows passed with both JGD and standard graphics: 72 executions covering base/grid/lattice/ggplot2 plots, statistical models, data.table/tidyverse analysis, file exports, DT and Plotly.
  • Browser checks passed DT search, sorting, pagination and page-size controls, Plotly zoom/reset, and 102 renderer assertions in each of three layouts.
  • Verified complete stdout/stderr and rich output before completion across consecutive cells, output limits, interruption/recovery, inspection, queues, history/reconnection, HTML dependencies and plot-device ownership.
  • Verified a real interactive arf terminal through its default visible IPC approval prompts: adoption preserved existing objects; notebook console/table/plot output worked; detachment kept R alive and subsequent terminal/IPC evaluations retained both terminal and notebook objects.
  • Full VS Code exit/reopen from 1.110 to 1.140 preserved the R PID and objects; new launch also worked without standalone Node on PATH. Large-table preview/final-page checks passed through 832,976,871 ALTREP rows with bounded allocations.
  • Compiler-disabled sess source installation, source identity/bootstrap, typecheck, lint and production package identity checks passed. sess contains no native source or libraries.

Testing found and fixed an additional real-terminal adoption regression in 42b4697: parameter-free R task notifications encode their empty list as []; Interactive rejected it and disconnected immediately after bootstrap. Empty notification arrays now normalize to an object. Added a callback regression and verified the fix in a real TUI arf session. Other pushed fixes retain R discovery in restricted-PATH fixtures and allow cold Windows CIM process lookup to complete.

All checks passed at final commit 42b4697: CI run (Linux, macOS, Windows, build and lint). Linux/macOS CI exercises the real arf runtime; Windows skips that suite and verifies sess and ordinary extension behavior.

Remaining limits are documented in the PR: notebook stdin/debugger prompts are unavailable, arbitrary terminal output cannot be subscribed to, and Remote SSH lifecycle has not been manually verified. Existing dependencies may still contain native code; sess itself is compiler-free.

@renkun-ken
renkun-ken requested a review from eitsupi October 5, 2026 22:52

@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.

Thanks!

Comment thread sess/DESCRIPTION Outdated
@renkun-ken
renkun-ken merged commit 0594d4a into main Oct 6, 2026
5 checks passed
@renkun-ken
renkun-ken deleted the codex/pure-r-sess branch October 6, 2026 05:10
eitsupi added a commit that referenced this pull request Oct 7, 2026
vscode-R's installer could replace a failed bundled sess installation with a separately published R-universe package, whose source snapshot may differ from the extension's bundle.
Following #1819 and #1830, installation now uses the bundled pure-R package exclusively.

Missing Imports still use `install.packages()` with the existing repository and library selection.
Dependency errors propagate, a failed bundled `R CMD INSTALL` stops directly, and the shared fresh-R verifier checks the exact bundled source revision alongside the existing API/load checks for ordinary terminals and private Interactive runtimes.

Removes fallback-only repository discovery, binary compatibility logic, archive fixtures, and tests; updates current documentation and messages. Standalone R-universe installation instructions, badge, `bootstrap.R`, source stamping, and DESCRIPTION normalization identity tests remain intact.
Repository propagation, library placement, and runtime caching are unchanged.
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.

sess should be a pure R package

2 participants