Skip to content

fix(sess): separate runtime and transport lifecycles - #1739

Merged
eitsupi merged 10 commits into
masterfrom
refactor/sess-runtime-lifecycle
Sep 23, 2026
Merged

eitsupi merged 10 commits into
masterfrom
refactor/sess-runtime-lifecycle

Conversation

@eitsupi

@eitsupi eitsupi commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • separate the R runtime lifecycle from the IPC transport lifecycle
  • restore runtime-installed options, bindings, S3 methods, plot hooks/devices, callbacks, and rstudioapi overrides on disconnect
  • clean up after unexpected IPC loss and support reconnection without accumulating hooks
  • continue polling after transient empty reads, disconnecting only when EOF is confirmed
  • support runtime startup from the early R profile phase before default packages are attached
  • add lifecycle and transport coverage, and run the bundled sess tinytest suite in CI

Fixes #1726.

@eitsupi eitsupi changed the title refactor(sess): separate runtime and transport lifecycles fix(sess): separate runtime and transport lifecycles Sep 20, 2026
@eitsupi
eitsupi requested a review from Fred-Wu September 20, 2026 10:06
@eitsupi eitsupi added this to the 3.0.0 milestone Sep 20, 2026
@eitsupi
eitsupi merged commit 20291d7 into master Sep 23, 2026
5 checks passed
Fred-Wu pushed a commit that referenced this pull request Sep 23, 2026
## Summary

- separate the R runtime lifecycle from the IPC transport lifecycle
- restore runtime-installed options, bindings, S3 methods, plot hooks/devices, callbacks, and rstudioapi overrides on disconnect
- clean up after unexpected IPC loss and support reconnection without accumulating hooks
- continue polling after transient empty reads, disconnecting only when EOF is confirmed
- support runtime startup from the early R profile phase before default packages are attached
- add lifecycle and transport coverage, and run the bundled sess tinytest suite in CI
@eitsupi
eitsupi deleted the refactor/sess-runtime-lifecycle branch September 25, 2026 23:37
eitsupi added a commit that referenced this pull request Oct 7, 2026
Close #1845

The development build already requires sess IPC protocol 2 and is incompatible with past releases. Use this compatibility break to remove the old R API compatibility layer and helpers whose roles have ended.

- **`use_httpgd`, `use_jgd`, and their compatibility helpers:** `use_httpgd` was introduced in #1684, and `use_jgd` in #1706. #1817 replaced them with `plot_backend`, retaining the old arguments through `.warn_deprecated_plot_args()` and `.legacy_plot_backend()`. Extension callers already use `plot_backend`; removing the old arguments now also removes the need for these helpers.
- **`register_hooks()`:** Introduced in #1684 for standalone hook registration and re-registration. It now delegates to `runtime_start()`, which `connect()` already calls directly, and has no extension callers. Re-registering also resets runtime-owned devices and viewer state without updating reconnect options, so this wrapper no longer provides a coherent independent configuration API. Keep the internal runtime lifecycle and use `connect()` as the public integration entry point.
- **`rebind()`:** Introduced in #1684. #1739 migrated all callers to `.runtime_rebind()`, which records bindings for restoration when the runtime stops. Only the unused old definition remained.
- **`json_rpc_response()` and `json_rpc_error()`:** Included in [#1684](#1684), but the upstream `sess` branch history shows they served the earlier HTTP `/rpc` implementation. [The WebSocket conversion](41b298a) removed their callers before sess reached main. Delete these unused HTTP response builders; the active `"json_rpc_error"` condition class remains.

Update documentation, installer export checks, and test fixtures to match. Backend selection, fallback, and reconnect behavior remain unchanged, and the IPC protocol stays at version 2.

Breaking API change: `connect()` no longer accepts `use_httpgd` or `use_jgd`, and `register_hooks()` is no longer exported. Use `plot_backend` and `connect()` instead.
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 targets a dead connection after reload if session watcher turns from on to off

2 participants