Skip to content

fix(impl-generate): suppress renv stdout in R version probe#6948

Merged
MarkusNeusinger merged 2 commits into
mainfrom
fix/impl-generate-renv-version-probe
May 16, 2026
Merged

fix(impl-generate): suppress renv stdout in R version probe#6948
MarkusNeusinger merged 2 commits into
mainfrom
fix/impl-generate-renv-version-probe

Conversation

@MarkusNeusinger
Copy link
Copy Markdown
Owner

Summary

  • First R/ggplot2 pipeline run crashed because renv's "- The project is out-of-sync -- use \renv::status()` for details."notice prints on **stdout** from.Rprofile, so 2>/dev/nullleft it insideLANGUAGE_VERSION/LIBRARY_VERSION`.
  • The polluted multi-line value then broke the downstream Python heredoc (SyntaxError: unterminated string literal), and a backtick in the notice split the bash command so --model ended up as a standalone token (--model: command not found).
  • Fix: prefix both Rscript probes with RENV_CONFIG_STARTUP_QUIET=TRUE and pipe through tail -n1 as a belt-and-suspenders against future stdout leaks. Both getRversion() and packageVersion() emit a single line, so trailing-line slicing is safe.

Context

Observed in run 25972681609 (bulk-generate ggplot2 for scatter-basic), which dispatched 2+ failing impl-generate runs with identical traces:

  • 25972690929 (failure)
  • 25972790865 (failure)

The underlying renv.lock-vs-installed-packages drift that triggers the notice is a separate concern; this PR just stops the version probe from being a footgun.

Test plan

  • PR's own CI (lint + tests) passes
  • After merge, re-trigger bulk-generate.yml -f specification_id=scatter-basic -f library=ggplot2 and confirm impl-generate's version-probe step logs e.g. Library version: ggplot2 = 3.5.1 (r runtime 4.4.1, pipeline python 3.13.13) without renv noise
  • Full chain (impl-generate → impl-review → impl-merge) completes and produces plots/scatter-basic/metadata/r/ggplot2.yaml with populated language_version, quality_score, and a reachable GCS preview image

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 16, 2026 21:11
renv prints its "project out-of-sync" notice on stdout from .Rprofile,
so 2>/dev/null leaves it inside the captured value. The polluted
multi-line string then breaks the downstream Python heredoc with an
unterminated string literal, and a backtick in the notice splits the
bash command so --model lands as a standalone token. Setting
RENV_CONFIG_STARTUP_QUIET=TRUE silences renv at startup; piping
through tail -n1 keeps a single clean version line as a fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the implementation generation workflow’s R version probes so renv startup output does not pollute generated metadata or break downstream shell/Python interpolation.

Changes:

  • Suppresses renv startup notices during R version probes with RENV_CONFIG_STARTUP_QUIET=TRUE.
  • Pipes R runtime and package version probe output through tail -n1.
  • Adds a fallback to unknown for empty R language version output.

Comment thread .github/workflows/impl-generate.yml Outdated
}
get_r_version() {
Rscript -e "cat(as.character(packageVersion('$1')))" 2>/dev/null
RENV_CONFIG_STARTUP_QUIET=TRUE Rscript -e "cat(as.character(packageVersion('$1')))" 2>/dev/null | tail -n1
Apply Copilot review feedback on #6948: if Rscript exits non-zero
after partial stdout, `tail -n1` would still return that leaked line
as LIBRARY_VERSION, defeating the renv-quiet protection. Add an
is_version() regex (`^[0-9]+(\.[0-9]+)*$`) and reject anything that
doesn't match — empty result falls through to the existing "unknown"
fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MarkusNeusinger MarkusNeusinger merged commit bb8def4 into main May 16, 2026
7 checks passed
@MarkusNeusinger MarkusNeusinger deleted the fix/impl-generate-renv-version-probe branch May 16, 2026 21:17
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