Add post-run automation callbacks#211
Open
malhotra5 wants to merge 1 commit into
Open
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
e64ac90 to
666ade6
Compare
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.
Summary
Implements post-run automation callbacks for APP-2489 / #208 using the callback-chain design.
automation_run_callbacksrecords with persisted callback lifecycle state.callbacksconfig with exactly-one-of validation forentrypointvsinline_python.keep_alive=Truewhenkeep_aliveis omitted, so normal sandbox cleanup can be left to runtime TTL/reaper.inline_pythoncallbacks into generated tarballs undercallbacks/<name>.pyand normalizes them to callback entrypoints.COMPLETEDorFAILEDvia either SDK completion callback or watchdog verification.POST /runs/{run_id}/callbacks/completefor the wrapper completion payload andGET /runs/{run_id}/callbacksfor inspecting callback records.keep_alive=Falseis explicitly used, callback completion can clean up after terminal callback records.Testing
uv run pre-commit run --files openhands/automation/models.py openhands/automation/schemas.py openhands/automation/preset_router.py openhands/automation/router.py openhands/automation/watchdog.py openhands/automation/app.py openhands/automation/backends/base.py openhands/automation/backends/cloud.py openhands/automation/backends/local.py openhands/automation/callbacks.py migrations/versions/010_post_run_callbacks.py tests/test_callbacks.py tests/test_schemas.py tests/test_preset_router.py --show-diff-on-failureuv run pytest tests/test_callbacks.py tests/test_schemas.py tests/test_preset_router.py::TestGenerateTarball -qNote:
tests/test_watchdog.pycould not be run in this environment because the Docker daemon is unavailable and the test fixture starts a Postgres testcontainer before executing tests.Closes #208
Linear: APP-2489
This PR description was updated by an AI agent (OpenHands) on behalf of the user.