posit-dev / posit-dev/btw

btw Addin cannot access R Environment / session objects (unlike `btw_app()`)

Open
#179 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
137
Forks
10
Avg merge
10h 48m
Merged PRs (30d)
4

Description

Summary

There is a functional discrepancy between launching the btw chat interface via the RStudio Addin vs. calling btw_app() directly: the Addin does not have access to the current R session environment, making env and session tools non-functional when used through the Addin.

Expected behavior

The btw RStudio Addin should behave equivalently to btw_app() with respect to tool availability, including access to the current R environment and session objects (e.g., loaded data frames, model objects, defined variables).

Actual behavior

When launching via the RStudio Addin:

  • The tool selection UI correctly reflects the btw.md configuration (e.g., tools: [docs, env, session])
  • However, the env and session tools appear to have no access to the live R GlobalEnvironment — objects present in the session are not visible to the LLM

When launching via btw_app() in the console:

  • Full access to the current R environment works as expected
  • However, btw_app() blocks the R session, making parallel work in RStudio impossible

This creates a forced trade-off with no good solution:

  • Addin → non-blocking, but no environment access
  • btw_app() → environment access, but session is blocked
Environment
R version: 4.5.2
Platform: macOS (Apple Silicon)
RStudio version: 2026.4.0.347
btw version: 1.1.0
ellmer version: 0.4.0
questions
  • Could the Addin be modified to run in the same R process (or share environment state) rather than as a separate process?
  • Alternatively, could btw_app() gain a background = TRUE argument that launches non-blocking (e.g., via rstudioapi::jobRunScript()) while retaining environment access?
  • Or could environment snapshots be serialized and passed to the Addin process at launch time?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the RStudio Addin launch path with the btw_app() entry point, focusing on how the env and session tools receive R session state. Verify behavior using the issue's example configuration and live GlobalEnvironment objects; done means the Addin retains environment and session access without blocking parallel RStudio work.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.