Repository navigation
fix(sdk): mark corrective nudge as environment event - #3954
Conversation
|
Hey @Sehlani042 thanks for the PR. Can you complete the HUMAN part? Moreover, the change is not complete |
Co-authored-by: openhands <openhands@all-hands.dev>
d039f05 to
0d1d789
Compare
|
[Automatic Post]: It has been a while since there was any activity on this PR. @Sehlani042, are you still working on it? If so, please go ahead, if not then please request review, close it, or request that someone else follow up. This comment was created by an AI agent (OpenHands) on behalf of the user. |
|
[Automatic Post]: I have assigned @neubig as a reviewer based on the repository MAINTAINERS file. Thanks in advance for the help! This comment was created by an AI agent (OpenHands) on behalf of the user. |
neubig
left a comment
There was a problem hiding this comment.
Actually tests, are failing. Could you please fix them and re-request my review?
|
@Sehlani042 tests are failing |
|
Thanks for the contribution The code looks good, but there is still one related case to address before this is complete.
Could you update |
|
Thank you! |
HUMAN:
This makes framework-generated corrective nudges appear as environment-origin events while preserving the user-role message sent to the model. I reviewed the follow-up scope, including visualizer/event attribution, so the PR should no longer treat synthetic recovery nudges as human input.
AGENT:
This PR was created by an AI agent (OpenHands) on behalf of Sehlani042.
Why
The corrective nudge emitted after an empty or reasoning-only model response is synthetic framework feedback. It should remain a user-role LLM message so the model receives the same instruction, but the event source should not be
user; otherwise UI/event consumers and stuck detection can treat it as human input.Summary
MessageEventwithsource="environment"while keepingllm_message.role == "user".Issue Number
Closes #3883
How to Test
Baseline before the fix:
OPENHANDS_SUPPRESS_BANNER=1 uv run pytest tests/sdk/agent/test_response_dispatch.py::test_empty_response_sends_nudge tests/sdk/agent/test_response_dispatch.py::test_reasoning_only_sends_nudge -qfailed withassert "user" == "environment"on both regression cases.After the fix:
OPENHANDS_SUPPRESS_BANNER=1 uv run pytest tests/sdk/agent/test_response_dispatch.py::test_empty_response_sends_nudge tests/sdk/agent/test_response_dispatch.py::test_reasoning_only_sends_nudge -qpassed: 2 passed.OPENHANDS_SUPPRESS_BANNER=1 uv run pytest tests/sdk/agent/test_response_dispatch.py tests/cross/test_stuck_detector.py -qpassed: 29 passed.OPENHANDS_SUPPRESS_BANNER=1 uv run pre-commit run --files openhands-sdk/openhands/sdk/agent/response_dispatch.py tests/sdk/agent/test_response_dispatch.pypassed Ruff format, Ruff lint, pycodestyle, pyright, import dependency rules, and tool registration checks.Note: local
uv runstill prints the existing settings-discovery warning aboutexclude-newer = "7 days", but the commands exit successfully.Video/Screenshots
N/A - SDK behavior change covered by regression tests.
Type
Notes
This keeps the LLM-visible message role unchanged and only changes event attribution, matching the existing stop-hook feedback pattern of
source="environment"plusrole="user".