Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug][Resolver]: Multiline comments crashing resolver #5641

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

malhotra5
Copy link
Contributor

@malhotra5 malhotra5 commented Dec 17, 2024

End-user friendly description of the problem this fixes or functionality that this introduces

  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

Give a summary of what the PR does, explaining any non-trivial design decisions

Summary

There is a bug where comments with quotations or multi-line comments caused the resolver to crash. This is because we were using bash to check the event body for "openhands-agent` macro, but the event body string was not properly escaped.

In this PR, we've opted to move away from bash and use javascript instead to implement the same functionality.

Alternatives considered but opted against

  1. Properly escape the string in bash (if [[ "$(echo '${{ github.event.comment.body }}' | tr -d '\n' | sed "s/'/'\\\\''/g")" == "@openhands-agent-exp"* ]]; then)
    a. Opted against this as readability becomes tough and the expression needs to be used in multiple places
  2. Set the comment body as an ENV var in a previous step, then reference it in the conditional
    a. Opted against this as it would bloat the workflow with too many steps

Sample Test

Example workflow logs


Link of any specific issues this addresses
#5230


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:dcb6858-nikolaik   --name openhands-app-dcb6858   docker.all-hands.dev/all-hands-ai/openhands:dcb6858

Copy link
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

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

Oh, very significant difference in readability, thanks!

@malhotra5 malhotra5 merged commit 7071742 into main Dec 17, 2024
13 checks passed
@malhotra5 malhotra5 deleted the bug/resolver-multiline-comments branch December 17, 2024 02:31
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