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

fix: handle escaped quotes in PS1 metadata parsing #6827

Closed
wants to merge 6 commits into from

Conversation

neubig
Copy link
Contributor

@neubig neubig commented Feb 19, 2025


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:8c60e51-nikolaik   --name openhands-app-8c60e51   docker.all-hands.dev/all-hands-ai/openhands:8c60e51

- Add .replace(r'"', '"') to unescape quotes before parsing JSON in matches_ps1_metadata and from_ps1_match
- Add test to verify PS1 metadata parsing works correctly
- Fixes #6826
@neubig neubig marked this pull request as draft February 19, 2025 12:38
The issue was not with escaped quotes, but with backslashes in the JSON values
being treated as literal backslashes. Fixed by properly escaping them with
double backslashes.

Fixes #6826
@neubig neubig force-pushed the fix/6826-ps1-metadata-parsing branch 2 times, most recently from 7167eb5 to 56bac91 Compare February 19, 2025 13:00
- Rename test to test_empty_command_ps1_metadata to reflect its purpose
- Add test case with empty command to match the actual issue
- Add better assertions for backslash handling
- Add docstring explaining the test's purpose

Part of #6826
@neubig neubig force-pushed the fix/6826-ps1-metadata-parsing branch from 56bac91 to 8d95ce6 Compare February 19, 2025 13:00
- Use raw strings for backslash sequences in PS1 metadata
- Remove unnecessary quote escaping since json.dumps already handles it
- Add tests to verify PS1 metadata parsing works correctly
- Fixes #6826
@neubig neubig closed this Feb 19, 2025
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.

[Bug]: "Failed to parse PS1 metadata" on empty command
2 participants