fix: configure pager, browser, and graphics device for headless mode#122
fix: configure pager, browser, and graphics device for headless mode#122
Conversation
Set R options at headless startup to prevent interactive programs from blocking or corrupting the server: - Custom pager function that dumps help text to stdout (captured by evaluate_with_capture) instead of spawning less/more - help_type="text" to avoid HTML help opening a browser - Custom browser function that prints URLs to stdout - File-based graphics device (png with pdf fallback) instead of X11 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- pdf() uses inches while png() uses pixels, so forwarding ... could create absurdly large files - Test now verifies the graphics device is actually file-based (png or pdf) rather than just checking success Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
macOS uses quartz which works headlessly (unlike X11), so the test should accept quartz_off_screen alongside png/pdf. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR hardens arf headless startup by configuring R options to avoid spawning interactive pagers/browsers/GUI graphics devices that can hang or corrupt a headless server session.
Changes:
- Configure headless-only R options (text help, stdout pager, URL-printing browser, file-based graphics device).
- Add integration tests ensuring
?meanandplot()complete without hanging in headless mode. - Document the fix in the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/arf-console/src/main.rs | Adds headless R option configuration (pager/browser/device) during run_headless() startup. |
| crates/arf-console/tests/headless_tests.rs | Adds end-to-end tests verifying help and plotting don’t hang and use the expected headless behaviors. |
| CHANGELOG.md | Notes the headless startup fix in Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
If the pager/browser/graphics options fail to apply, headless mode would regress to spawning interactive programs that hang the server. Return an error instead of logging a warning. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…test - Update comments and log message to mention all configured options (pager, help_type, browser, graphics device) - Add trailing newline after each pager file to prevent output merging - Add test for browseURL() printing URL to stdout Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dev.new() passes width/height in inches but png() interprets them as pixels. Use sensible defaults for both png and pdf fallback. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add attribution in doc comment and README Acknowledgements section. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The IPC server design was heavily informed by these Julia MCP server implementations, particularly the shared REPL pattern and agent code visibility approach. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Summary
evaluate_with_capture) instead of spawningless/morehelp_type="text"to force text-based help outputpngwithpdffallback) instead of X11/quartzpng()/pdf()use fixed defaults (no...forwarding) to avoid unit mismatch between inches and pixelsTest plan
test_headless_help_does_not_hang—?meancompletes without hanging and captures help texttest_headless_plot_does_not_hang—plot(1:10)completes without hanging, device is file-based (png/pdf)test_headless_browse_url_does_not_hang—browseURL()prints URL to stdoutcargo fmtandcargo clippyclean🤖 Generated with Claude Code