Skip to content

fix: match dev server webhook payload to cloud format - #585

Open
Swigler wants to merge 1 commit into
runpod:mainfrom
Swigler:fix/webhook-payload-parity
Open

fix: match dev server webhook payload to cloud format#585
Swigler wants to merge 1 commit into
runpod:mainfrom
Swigler:fix/webhook-payload-parity

Conversation

@Swigler

@Swigler Swigler commented Sep 3, 2026

Copy link
Copy Markdown

Summary

  • Dev server webhook payloads now match the cloud format — includes id, status, input, webhook, delayTime, and executionTime fields alongside output/error
  • Webhooks now fire on failed jobs — previously the error path returned before reaching the webhook dispatch code
  • Execution timing tracked via time.time() so executionTime reports real milliseconds (delayTime is always 0 in local dev since there's no queue)

Fixes #409
Fixes #410

What was wrong

The three simulation endpoints (_sim_runsync, _sim_stream, _sim_status) in rp_fastapi.py had two issues:

  1. Incomplete webhook payload — only the raw handler output ({"output": ...}) was sent to the webhook URL, while the cloud API sends a full envelope with job metadata. Developers building webhook handlers against the local dev server would see breakage on deploy.

  2. No webhook on failure — in _sim_runsync and _sim_status, the error check returned early before the webhook code, so failed jobs never triggered a webhook callback. In production, RunPod sends a webhook with "status": "FAILED".

What changed

  • Added import time and job_start/execution_time tracking in each method
  • Construct full cloud-parity payload before dispatching the webhook
  • Moved webhook dispatch above the early error return so it fires on both success and failure
  • Updated tests to assert webhook payload structure (all 7 fields) and added a test for error-path webhook delivery

Test plan

  • All existing tests pass (pytest tests/test_serverless/test_modules/test_fastapi.py — 8/8)
  • New assertions verify webhook payload contains id, status, input, webhook, delayTime, executionTime, output
  • New test verifies webhook fires with "status": "FAILED" when handler raises an exception

…npod#410)

The local dev server (--rp_serve_api) sent only {"output": ...} to
webhooks, while the cloud sends the full payload with id, status, input,
webhook, delayTime and executionTime. Additionally, webhooks were never
triggered when jobs failed because the error path returned before
reaching the webhook code.

- Build cloud-parity webhook payload in _sim_runsync, _sim_stream,
  _sim_status
- Send webhook on both COMPLETED and FAILED status
- Track execution time with time.time()
- Add tests asserting payload structure and error-path webhook delivery

Closes runpod#409
Closes runpod#410
@Swigler
Swigler force-pushed the fix/webhook-payload-parity branch from a0f4404 to c050478 Compare September 3, 2026 17:56
@Swigler

Swigler commented Sep 3, 2026

Copy link
Copy Markdown
Author

Friendly ping — the dev server returns a different webhook shape than cloud, which breaks local testing. This aligns them. Ready for review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Development server webhook not triggered on failed requests Development server serverless webhook is not the same with the cloud version

1 participant