From 396d68e4905dd822b39c7f53aae95a87a5ab969f Mon Sep 17 00:00:00 2001 From: Wyatt Alt Date: Sat, 13 Jun 2026 10:01:37 -0700 Subject: [PATCH] fix: JobHandle resolves the manifest job id from the submission id db.job(id) gets the submission id the refresh/backfill endpoints return, but list_jobs / cancel report the agent's manifest id (--). JobHandle now matches that (exact id or submission prefix) so wait()/progress() truly track, and cancel() cancels by the resolved canonical id instead of the unusable submission uuid. Co-Authored-By: Claude Opus 4.8 (1M context) --- python/python/lancedb/udf.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/python/python/lancedb/udf.py b/python/python/lancedb/udf.py index c26fd26f0..84c17929d 100644 --- a/python/python/lancedb/udf.py +++ b/python/python/lancedb/udf.py @@ -439,9 +439,19 @@ class JobHandle: self._created = time.monotonic() self._seen = False + def _matches(self, listed_id: str) -> bool: + # The refresh/backfill endpoints return the submission id (a uuid), + # but the agent names the manifest job "
--" -- which is what list_jobs and cancel report. + # Match the canonical id directly, or by that submission prefix. + if listed_id == self.id: + return True + prefix = self.id[:8] + return len(prefix) >= 4 and prefix in listed_id + def _job(self): for j in self.conn.list_jobs(): - if j.job_id == self.id: + if self._matches(j.job_id): return j return None @@ -479,4 +489,7 @@ class JobHandle: raise TimeoutError(f"job {self.id} still {self.status()} after {timeout}s") def cancel(self) -> None: - self.conn.cancel_job(self.id) + # Cancel by the canonical manifest id (what cancel matches), found + # via the submission prefix; fall back to the raw id. + job = self._job() + self.conn.cancel_job(job.job_id if job is not None else self.id)