Skip to content

Phase 4 · RQ worker: agentgateway startup health guard #192

Description

@theuseless-ai

Context

Phase 1b added a fail-fast agentgateway health guard to pipelit's FastAPI lifespan (platform/main.py). The RQ worker bootstrap (platform/worker_class.py, PipelitWorker.__init__) did not get an equivalent guard — flagged during Phase 1b as a real design decision (sync/async boundary) rather than a trivial add.

This is fail-closed, not fail-open: there is no direct-provider path left, and create_llm_from_db / _create_llm_via_agentgateway raise if the gateway is disabled or unreachable (the latter health-checks per call). So the only cost is a job failing at runtime instead of the worker refusing to boot — a DX/ops papercut, not a security gap. Filed as a follow-up, not a blocker.

Scope

Add a startup health check in PipelitWorker.__init__ (or the worker entrypoint) mirroring the lifespan guard: when AGENTGATEWAY_ENABLED, assert check_agentgateway_health and fail fast with a clear, actionable message. Handle the sync/async boundary cleanly (the lifespan guard is async; the worker init is sync).

Acceptance

  • Starting the RQ worker with AGENTGATEWAY_ENABLED=true and the gateway down fails fast with an actionable message, instead of accepting jobs that will error at execution time.
  • With the gateway healthy (or the flag disabled), worker startup is unaffected.

References

  • platform/worker_class.py (PipelitWorker.__init__)
  • platform/services/agentgateway_client.py (check_agentgateway_health)
  • platform/main.py (the lifespan guard to mirror)
  • Surfaced by the Phase 1b post-implementation review (residual Improve backend test coverage from 61% to 90% #5, non-blocking).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions