Skip to content

Graceful fallback from update-task-v2 to v1 when server doesn't support it#385

Open
v1r3n wants to merge 1 commit intomainfrom
v2_compatiblity_mode
Open

Graceful fallback from update-task-v2 to v1 when server doesn't support it#385
v1r3n wants to merge 1 commit intomainfrom
v2_compatiblity_mode

Conversation

@v1r3n
Copy link
Contributor

@v1r3n v1r3n commented Mar 11, 2026

Summary

  • Auto-detect when the server doesn't support the POST /tasks/update-v2 endpoint (HTTP 404 or 501) and seamlessly fall back to the standard POST /tasks endpoint for the lifetime of the runner
  • On fallback, the tight execute loop exits and the worker resumes normal poll-based operation — no task results are lost
  • Detection happens once per runner on the first failed v2 call; all subsequent updates go directly to v1 with no overhead
  • Added unit tests (11) covering both sync TaskRunner and async AsyncTaskRunner: fallback on 404/501, subsequent calls skip v2, v2 success path unchanged, non-404 errors don't trigger fallback, v1 retry on
    fallback failure
  • Added integration test that runs real workflows against the server and verifies completion regardless of v2 availability

Test plan

  • Unit tests: python -m pytest tests/unit/automator/test_v2_fallback.py -v (11 passed)
  • Existing tests: python -m pytest tests/unit/automator/ -v (235 passed, no regressions)
  • Integration perf test: python -m pytest tests/integration/test_update_task_v2_perf.py -v -s (1000 workflows, p50 queue wait 26ms)
  • Integration fallback test: python -m pytest tests/integration/test_v2_fallback_intg.py -v -s (against server without v2 support)

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.

2 participants