Skip to content

Return 404 for missing simulation gateway jobs #474

@anth-volk

Description

@anth-volk

Problem

After enabling gateway auth on beta, the auth smoke test exposed that polling a definitely missing job ID can return a 500 instead of a 404:

GET /jobs/auth-smoke-probe-does-not-exist

The endpoint expected a missing job to be reported as not found, but Modal can construct a lazy FunctionCall handle from an arbitrary object ID. That means FunctionCall.from_id(job_id) is not enough to prove the gateway issued the job or that the job exists. The endpoint then falls through into the generic worker-failure path and returns a redacted 500.

Impact

  • Auth smoke tests fail even though auth enforcement itself works.
  • Clients cannot distinguish a missing/unknown job from a real simulation worker failure.
  • The gateway behavior diverges from Modal's documented FastAPI job queue example, which maps expired/missing output to 404.

Desired behavior

  • Job IDs not issued by the gateway should return 404.
  • Modal not-found or expired-output errors while polling a previously issued job should return 404.
  • Running jobs should still return 202.
  • Actual worker exceptions should still return redacted 500 responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions