fix(cloud): compare job owner as string so recovered jobs pass the guard

User.id is a uuid.UUID; live jobs store that object, but jobs recovered from
the .owner sidecar store its string form. 'UUID(x) != str(x)' is always True,
so after a restart the legitimate owner got 404 on /status, /transcript,
/hook etc. for their own recovered jobs. Compare str(user.id) != str(owner).
This commit is contained in:
juancarlos.cavero 2026-07-17 21:46:23 +02:00
parent be3dc665a3
commit ff38a9d7ee

4
app.py
View file

@ -232,7 +232,9 @@ async def _assert_job_owner(request, record):
if owner is None: if owner is None:
return return
user = await _user_from_request(request) user = await _user_from_request(request)
if user is None or user.id != owner: # Compare as strings: live jobs store a uuid.UUID, but jobs recovered from
# the .owner sidecar store its string form — UUID != str is always True.
if user is None or str(user.id) != str(owner):
raise HTTPException(status_code=404, detail="Not found") raise HTTPException(status_code=404, detail="Not found")
# Application State # Application State