fix: handle missing clipboard in headless environments for langflow api-key command#12351
fix: handle missing clipboard in headless environments for langflow api-key command#12351andifilhohub wants to merge 2 commits intorelease-1.9.0from
Conversation
…pi-key command pyperclip.copy() was called without error handling, causing an unhandled PyperclipException in Docker/SSH environments where no clipboard mechanism is available. The crash happened after the key was generated and the previous one deleted, making the new key unrecoverable. - Wrap pyperclip.copy() in try/except; show key regardless of clipboard availability - Adapt banner hint text based on whether clipboard copy succeeded - Add unit tests covering headless fallback and UnicodeEncodeError scenarios
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (44.71%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## release-1.9.0 #12351 +/- ##
=================================================
- Coverage 48.23% 46.26% -1.97%
=================================================
Files 1848 1847 -1
Lines 160885 161555 +670
Branches 23643 23721 +78
=================================================
- Hits 77607 74751 -2856
- Misses 82394 85920 +3526
Partials 884 884
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
6a0e4c3 to
64d8863
Compare
Summary
langflow api-keycrashed withPyperclipExceptionin headless environments (Docker, SSH) becausepyperclip.copy()was called without error handling, before any output was shownpyperclip.copy()in a try/except: the API key is always displayed in the terminal regardless of clipboard availabilityChanges
api_key_banner: wrapspyperclip.copy()in try/except; adapts banner text based on whether clipboard is available or notTest plan
python -m pytest src/backend/tests/unit/test_cli.py::TestApiKeyBanner -vlangflow api-keyshould display the key without raising an exception