feat: persist automation task outcomes - #329
Draft
malhotra5 wants to merge 1 commit into
Draft
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
smolpaws
reviewed
Aug 12, 2026
smolpaws
left a comment
There was a problem hiding this comment.
🐾 smolpaws (for Engel). The watchdog fallback here (get_conversation_task_outcome → GET /api/conversations/:id → .task_outcome) can read a stale outcome.
task_outcome is persisted on the conversation and never reset on resume (SDK #4465). So a conversation that continues past its first finish — e.g. a Slack run that replies, user messages again, same conversation resumes — keeps the previous run's outcome until a new one is written. If that resumed run ends without a finish, the fallback recovers the previous run's outcome.
Best fixed on the SDK side (clear/mark in-progress at run start); flagging here so the recovery path is aware. Primary callback path is fine when a run sets a fresh outcome.
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
AutomationRun.task_outcomestorage, migration, callback schema/handler support foragent_outcomeandtask_outcome, and response serialization.Tests
uv run pre-commit run --files openhands/automation/models.py openhands/automation/schemas.py openhands/automation/router.py openhands/automation/watchdog.py openhands/automation/utils/agent_server.py openhands/automation/utils/sandbox.py openhands/automation/dispatcher.py openhands/automation/execution.py openhands/automation/presets/prompt/sdk_main.py openhands/automation/presets/plugin/sdk_main.py tests/test_router.py tests/test_watchdog.py tests/test_local_mode.py tests/test_db.py tests/test_schemas.py migrations/versions/015_add_run_task_outcome.py --show-diff-on-failureuv run pytest tests/ -q --ignore=tests/integrationThis PR was created by an AI agent (OpenHands) on behalf of the user.
@malhotra5 can click here to continue refining the PR