Skip to content

fix: register conversation ID with workspace for completion callback#114

Draft
jpshackelford wants to merge 1 commit into
mainfrom
fix/register-conversation-id-in-callback
Draft

fix: register conversation ID with workspace for completion callback#114
jpshackelford wants to merge 1 commit into
mainfrom
fix/register-conversation-id-in-callback

Conversation

@jpshackelford
Copy link
Copy Markdown
Contributor

Summary

Fixes #113 - UI shows "Conversation not created" when conversations actually started successfully.

Problem

The preset scripts (sdk_main.py for both prompt and plugin presets) create conversations but never call workspace.register_conversation() to tell the workspace what conversation ID to include in the completion callback.

When the workspace context manager exits, it sends a completion callback to the automation service, but conversation_id is always None because it was never registered.

Solution

After creating the conversation, call workspace.register_conversation(str(conversation.id)) so the conversation ID is included in the callback payload.

Changes

  • openhands/automation/presets/prompt/sdk_main.py: Add workspace.register_conversation() call after conversation creation
  • openhands/automation/presets/plugin/sdk_main.py: Add workspace.register_conversation() call after conversation creation

Testing

New automations created after this fix will include the conversation_id in their completion callbacks, allowing the UI to link directly to the conversation.


This PR was created by an AI agent (OpenHands) on behalf of the user.

@jpshackelford can click here to continue refining the PR

After creating a conversation, call workspace.register_conversation() so the
conversation ID is included in the completion callback sent to the automation
service. This fixes the UI showing 'Conversation not created' for runs that
actually completed successfully.

Fixes #113

Co-authored-by: openhands <openhands@all-hands.dev>
@jpshackelford jpshackelford added the bug Something isn't working label May 15, 2026 — with OpenHands AI
@github-actions
Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py10100% 
app.py1428341%40, 43, 46, 52, 54, 57, 60–63, 66, 71–73, 75, 80–81, 83, 85–87, 89, 93, 95–96, 98–99, 102–108, 111–112, 115, 122–123, 126–127, 131, 139–140, 143, 150–151, 153, 156–157, 160, 165–173, 175–177, 263–265, 270–271, 273–274, 276, 279–281, 283–284, 286–287, 292–293, 297, 300, 302
auth.py127596%82, 124, 344, 352–353
config.py1570100% 
constants.py160100% 
db.py672956%60, 74–75, 78–80, 82, 89, 92–93, 96, 104, 111, 144, 147–148, 152–153, 161, 169, 174, 201, 204–210
dispatcher.py1704374%68, 80, 82–83, 164–167, 204, 207, 222–223, 229–231, 248–249, 255–259, 262–264, 333–334, 359–366, 386, 401–402, 416–417, 426–427, 429
event_router.py591967%83, 88, 119–121, 137–138, 156, 158, 160–161, 163, 173, 179–181, 184, 186, 188
exceptions.py40100% 
execution.py21913339%39–41, 76–79, 87–91, 93, 101–103, 108–112, 114, 128–131, 133, 135, 137–140, 142–147, 149, 151–158, 160–161, 163, 199–201, 207–209, 220–223, 229–231, 271–275, 284, 292, 296, 298–299, 304–305, 310, 382–383, 462–464, 466–472, 475–476, 478, 480–482, 485, 488, 491–494, 496, 499–500, 503–505, 509–510, 514–517, 519, 527–528, 532–534, 536–542, 546, 548, 557–559, 561–563
filter_eval.py50296%161–162
logger.py551769%37, 50–51, 53–59, 74, 77, 101, 103–106
models.py790100% 
preset_router.py1835669%130–132, 240–241, 246–253, 258, 261, 263–264, 275–278, 280–284, 289, 298, 359–361, 472–473, 478–485, 490, 493, 495–496, 507–510, 512–516, 521, 531
router.py1136344%77–78, 98, 100, 103, 105, 119, 132, 134–135, 137–138, 141–143, 154–156, 174–177, 196, 199, 202, 209, 211, 245–247, 250–252, 256–257, 262, 266–269, 271, 279, 281–282, 287–288, 291, 293, 295–297, 300–303, 308, 310–311, 320, 341–343, 347
scheduler.py60985%134–135, 172–173, 188–189, 199–200, 202
schemas.py2651793%31, 165, 171–173, 232–234, 236, 319–320, 323, 328, 333, 477, 485, 492
trigger_matcher.py28389%72–74
uploads.py1075944%142–145, 153–155, 161–162, 165, 174–175, 178–179, 187–188, 190–193, 196–199, 201, 203–205, 207–210, 212–213, 215, 230, 236–237, 240, 243, 246, 249, 251, 264–265, 279, 282–284, 286–287, 289, 295–296, 309, 317–319, 323
watchdog.py984554%55–57, 69–70, 162–163, 204–205, 207, 209, 218, 220–222, 224, 231–233, 235–237, 239–240, 242, 257, 259, 264–267, 269–274, 276–282, 284
webhook_router.py804840%57, 82–83, 107–108, 110, 113–114, 116, 126, 128–132, 137, 139, 151, 154, 157, 164–165, 167, 180, 182–183, 188, 204, 206–207, 213–215, 217–218, 220, 235, 237–238, 243–244, 261, 263–264, 270–271, 273, 275
backends
   __init__.py130100% 
   base.py290100% 
   cloud.py1306252%43–45, 50–52, 103, 116–118, 131–135, 142–143, 145, 147, 159–160, 228–229, 231–232, 234–237, 239–244, 246–254, 256–257, 259, 266–268, 271–272, 274, 281–283, 288–292, 294
   local.py420100% 
event_schemas
   __init__.py29196%53
   custom.py33584%52–53, 64–66
   detection.py320100% 
   github.py125496%306, 311, 456, 483
presets
   __init__.py00100% 
storage
   __init__.py60100% 
   factory.py15193%36
   file_store.py22577%21, 30, 35, 40, 64
   google_cloud.py721184%49, 97–102, 136–137, 190, 192
   local.py680100% 
   s3.py1121586%56, 100, 102–103, 107, 109, 190, 213–215, 269–270, 275, 337–338
utils
   __init__.py50100% 
   agent_server.py500100% 
   api_key.py322425%40–41, 46–48, 50, 55, 60, 62–65, 67–68, 70–71, 73, 79, 81–82, 89, 91–92, 98
   cron.py45686%39, 45, 74, 80, 123, 140
   log_context.py100100% 
   run.py77889%74–76, 183–184, 231, 237–238
   sandbox.py716114%49–50, 55–58, 60–62, 64–70, 80–81, 86–92, 115–116, 118–122, 124–128, 153–154, 156, 158–161, 166–167, 170, 172–173, 179–181, 186–188, 193–194, 202–204, 206
   tarball_validation.py480100% 
   time.py30100% 
   webhook.py57984%47, 52, 120, 130–132, 138, 201–202
TOTAL320684373% 

@github-actions
Copy link
Copy Markdown

🚀 Deploy Preview PR Created/Updated

A deploy preview has been created/updated for this PR.

Deploy PR: https://github.com/OpenHands/deploy/pull/4296
Automation SHA: 4a37cc3d46e5d131100a2df3d0381a8a74f03688
Last updated: May 15, 2026, 09:11:09 AM ET

Once the deploy PR's CI passes, the automation service will be deployed to the feature environment.

@jpshackelford
Copy link
Copy Markdown
Contributor Author

@malhotra5 Not sure if this is the way you expected this to work. It seems a bit brittle. Another approach would be to have a separate job (similar to watchdog) that used data in the conversation tags to establish the linkage so we weren't depending on presets.

Comment on lines +303 to +305
# Register conversation ID with workspace for completion callback
workspace.register_conversation(str(conversation.id))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should happen automatically inside the software agent sdk (when a workspace is passed to a conversation creation flow)

Reason is because we can't assume the user will always include this statement, it should be a default behavior

If this isn't working as of today, there is likely a regression inside the SDK

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: UI says conversations not started, when the conversation did start

3 participants