Skip to content

Add get_task_result() polling API#74

Merged
Aaron1011 merged 4 commits intomainfrom
andrew/polling
Feb 26, 2026
Merged

Add get_task_result() polling API#74
Aaron1011 merged 4 commits intomainfrom
andrew/polling

Conversation

@anndvision
Copy link
Member

@anndvision anndvision commented Feb 21, 2026

Summary

  • Adds get_task_result() to Durable<State> for polling task status and retrieving output/error info after spawning
  • New types: TaskStatus, TaskPollResult, TaskErrorInfo
  • New durable.get_task_result stored procedure (migration + schema.sql)
  • New InvalidState variant on DurableError

Note

Medium Risk
Adds a new Postgres stored procedure and a new public client API surface for querying task status/output, so compatibility depends on running the new migration and on state string parsing staying aligned with DB constraints.

Overview
Adds a polling API (Durable::get_task_result) to fetch a task’s current TaskStatus and, when terminal, its output (completed_payload) or failure details (failure_reason).

Implements this via a new durable.get_task_result(queue_name, task_id) PL/pgSQL function (migration + schema.sql) and new public types (TaskStatus, TaskPollResult, TaskErrorInfo), plus a new DurableError::InvalidState for unexpected DB state strings.

Adds integration tests covering polling for pending/completed/failed/cancelled and nonexistent tasks, including user-error vs step-error failure payloads.

Written by Cursor Bugbot for commit a34016f. This will update automatically on new commits. Configure here.

@anndvision
Copy link
Member Author

/merge-queue

@anndvision anndvision requested a review from Aaron1011 February 25, 2026 19:32
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@Aaron1011 Aaron1011 added this pull request to the merge queue Feb 26, 2026
Merged via the queue into main with commit 43d73ea Feb 26, 2026
2 checks passed
@anndvision anndvision deleted the andrew/polling branch February 26, 2026 18:53
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