Skip to content

fix(slack): show the agent server's error when a conversation fails to start (OHE-3564) - #1021

Merged
hieptl merged 1 commit into
mainfrom
hieptl/ohe-3564
Oct 27, 2026
Merged

hieptl merged 1 commit into
mainfrom
hieptl/ohe-3564

Conversation

@hieptl

@hieptl hieptl commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

  • A human has tested these changes.

AGENT:


Why

When the agent server rejects a Slack-triggered conversation, the user only sees Uh oh! There was an unexpected error starting the job :(. The reproduction in OHE-3564 is a marketplace plugin whose plugin.json lacks $schema: the agent server fails to load it while sending the initial message and returns HTTP 500 with the cause in the body. None of that reached the user or the logs.

The body was dropped at every hop. The agent server's unhandled-exception handler puts the message in the exception field (with an error_id) and sets detail to Internal Server Error. The app server's _exception_detail stored str(httpx.HTTPStatusError) as the start task detail, which is only Server error '500 Internal Server Error' for url '<sandbox url>'. The Slack view then raised a plain RuntimeError for a failed start, and the follow-up path replaced the HTTP error with a fixed Exception('Failed to send message to v1 conversation'), so start_job fell through to its catch-all in both cases.

Summary

  • agent_server_error_detail (openhands/app_server/event_callback/util.py): reads the agent server's exception or detail field (string or {message} dict) and appends HTTP <status> and error_id. With no readable body it returns Agent server error: HTTP <status>, so the sandbox URL is never shown to a user.
  • _exception_detail (live_status_app_conversation_service.py): routes httpx.HTTPStatusError through that helper, so a rejected create reports the body's message in the start task detail. The existing secret redaction of the detail is unchanged. This is also what the Canvas start-task card and the other integrations' logs show.
  • Slack views (integrations/slack/slack_view.py): a failed start raises StartingConvoException('Failed to start the conversation: <detail>') instead of RuntimeError, and a rejected follow-up message raises StartingConvoException('Failed to send your message to the conversation: <detail>') with the body redacted the same way the app server redacts task details. start_job already posts that exception's message in the thread, so slack_manager.py is unchanged.
  • Tests: a failed start surfaces the task detail; a rejected follow-up surfaces the body's message and error_id; start_job posts the message; a rejected create carries the body's message in the start task detail; a non-JSON agent-server error reports the status without the URL.

For the reproduction, the Slack thread now reads Failed to start the conversation: Unsupported or missing $schema in /home/openhands/.openhands/cache/plugins/<package>/plugin.json: None. Supported: https://agent-plugins.org/schemas/1.0.0/plugin.schema.json (HTTP 500, error_id=<id>).

Issue Number

Fixes #745

How to Test

uv run pytest -q tests/unit/integrations/slack/test_slack_view.py \
  tests/unit/test_slack_integration.py \
  tests/unit/app_server/test_live_status_app_conversation_service.py
# 315 passed (5 new)
uv run pre-commit run --config ./dev_config/python/.pre-commit-config.yaml --files \
  integrations/slack/slack_view.py \
  openhands/app_server/event_callback/util.py \
  openhands/app_server/app_conversation/live_status_app_conversation_service.py \
  tests/unit/integrations/slack/test_slack_view.py \
  tests/unit/test_slack_integration.py \
  tests/unit/app_server/test_live_status_app_conversation_service.py

The five new tests fail on main (the Slack views raise RuntimeError / httpx.HTTPStatusError, and the start task detail is httpx's status-and-URL string) except the start_job relay test, which pins the existing behavior the fix relies on.

Outside the unit tests I fed agent_server_error_detail real httpx.Response objects for the shapes the pinned agent server 1.58.1 produces: an unhandled 500 (detail + exception + error_id), a 429 with a string detail, a {code, message} detail, a non-JSON 502 from a proxy, an empty detail, and a 422 list detail. None of the results contain the request URL.

Not tested: a live Slack run against a sandbox with a broken plugin.

Video/Screenshots

Not applicable: backend only, no UI change.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes


Enterprise server image for this PR:

ghcr.io/openhands/enterprise-server:sha-437b719

…o start (OHE-3564)

When the agent server rejects a Slack-triggered conversation, for example
because a marketplace plugin's plugin.json lacks $schema and the plugin
fails to load, the Slack user only saw "Uh oh! There was an unexpected
error starting the job :(". The response body, which names the cause and
carries an error_id, was dropped on the way: the app server stored
httpx's status-and-URL string as the start task detail, and the Slack
views raised a plain RuntimeError for a failed start or a fixed Exception
for a rejected follow-up message, so start_job fell through to its
catch-all in both cases.

- Add agent_server_error_detail, which reads the agent server's
  `exception` or `detail` field plus `error_id` and falls back to the
  HTTP status alone, so the sandbox URL is never shown.
- Route httpx.HTTPStatusError through it in _exception_detail so a
  rejected create reports the body's message in the start task detail.
- Raise StartingConvoException with that detail in the Slack views for a
  failed start and for a rejected follow-up message; start_job already
  posts that message in the thread.
@hieptl hieptl added the type: fix A bug fix label Oct 26, 2026
@hieptl hieptl self-assigned this Oct 26, 2026
@hieptl
hieptl marked this pull request as ready for review October 26, 2026 08:21
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/slack
  slack_view.py 296, 439-440
  openhands/app_server/app_conversation
  live_status_app_conversation_service.py
  openhands/app_server/event_callback
  util.py 82
Project Total  

This report was generated by python-coverage-comment-action

@tofarr tofarr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🍰

@hieptl
hieptl merged commit 138f27a into main Oct 27, 2026
23 checks passed
@hieptl
hieptl deleted the hieptl/ohe-3564 branch October 27, 2026 11:53
@openhands-release-bot openhands-release-bot Bot added the released: 1.81.0 Shipped in 1.81.0 label Oct 28, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in 1.81.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released: 1.81.0 Shipped in 1.81.0 type: fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack integration discards real API errors, shows generic 'Uh oh!' instead

2 participants