feat: Display setup.sh command and output in UI #9318
Draft
+196
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a feature to display the setup.sh command execution and its output in the OpenHands UI, addressing issue #7797.
Changes Made
Backend Changes (
openhands/runtime/base.py
)maybe_run_setup_script()
method to add setup command execution events to the event streamCmdRunAction
with thought parameter for better context: "Running setup script to configure the workspace environment."CmdOutputObservation
to show the command output in the UIEventSource.ENVIRONMENT
to properly categorize runtime-initiated eventsFrontend Changes
frontend/src/i18n/translation.json
): Added multilingual support for setup script status messages:STATUS$SETUP_SCRIPT_SUCCESS
: "Setup script completed successfully"STATUS$SETUP_SCRIPT_FAILED
: "Setup script failed"frontend/src/i18n/declaration.ts
): Added new translation key enumsTesting
tests/runtime/test_setup.py
): Added tests to verify:EventSource.ENVIRONMENT
sourceHow It Works
When a setup.sh script is found and executed, the runtime now:
CmdRunAction
with the commandchmod +x .openhands/setup.sh && source .openhands/setup.sh
CmdOutputObservation
to the event streamThe UI will display:
Benefits
Testing
Fixes #7797
@neubig can click here to continue refining the PR
To run this PR locally, use the following command: