Repository navigation
feat: enhance console output handling and isolation in shell execution - #490
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #490 +/- ##
==========================================
+ Coverage 70.64% 70.74% +0.10%
==========================================
Files 359 359
Lines 73771 73774 +3
==========================================
+ Hits 52112 52195 +83
+ Misses 16113 16030 -83
- Partials 5546 5549 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request improves the reliability and clarity of console output handling and error reporting in the shell environment. The main changes ensure that console output is properly isolated during agent code execution, error messages are consistently reported via the shell environment rather than standard logging, and the implementation of console functions in the JavaScript runtime is more robust and testable.
Console output isolation and reliability:
ExecAgentCodeinai.goto temporarily replace the VM'sconsoleobject with a custom one during agent code execution, ensuring that console output is captured and restored correctly. This prevents output leakage and side effects on the global VM state.TestExecAgentCodeConsoleIsolation) to verify that console output is properly isolated, captured, and restored, including handling startup failures.Consistent and environment-aware error reporting:
log.Printfandlog.Printlncalls withsh.printShellErrorthroughoutpipeline.goandshell.go, ensuring that error messages are written to the shell's configured output rather than standard output. This improves user-facing error reporting and testability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]Console and logging implementation improvements:
SetConsoleand related functions inlog.goto allow per-VM console output redirection, rather than relying on a global writer. Console methods (log,print, etc.) are now bound to the provided writer, improving modularity and preventing cross-test interference. [1] [2] [3] [4] [5]Test and code hygiene:
log_test.goto support new and existing tests.These changes collectively improve the shell's reliability, make console output behavior more predictable and testable, and enhance the clarity of error messages for end users.