Skip to content

bug(company-os): routine trigger answers 202 when the schedule write failed or Redis is absent #22003

Open

Description

@mrveiss

Phase M2.6. Found while inventorying Company OS write routes for #21332 (sibling under #19253).

Problem

POST /routines/{routine_id}/trigger answers 202 Accepted even when nothing was scheduled.

Evidence (origin/main at 9e0d1ed, read from code; not observed on a host)

autobot-backend/llc/api/routines.py, trigger_routine (l.286-303):

  • the Redis zadd that schedules the routine sits in try: ... except Exception: pass, so any Redis failure is swallowed, unlogged;
  • when get_async_redis_client() returns None the zadd is skipped with no error;
  • both paths fall through to return RoutineTriggerResponse(routine_id=routine_id) with status 202.

The caller cannot tell a scheduled trigger from a dropped one.

Not established

  • How often either path occurs on a running install (no log line exists to count).
  • Whether any caller retries on its own.

Proposed fix

One mechanism: the route answers 202 only after the zadd succeeded. A missing client or a failed zadd is logged and answered with 503 through the existing llc error helper. No bare except Exception: pass.

Acceptance criteria

  • A test with a Redis client whose zadd raises gets 503, not 202, and the failure is logged.
  • A test with no Redis client (None) gets 503, not 202.
  • A test with a working client gets 202 and the member is present in the schedule key.
  • No except Exception: pass remains in trigger_routine.

Note

llc/api/routines.py is touched by open PR #21960; this waits for it (same file, one PR).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: company-osWave 4 · cluster A — Company OS & LLC canvasbackendbugSomething isn't workingphase:M2.6Budgets enforced and costs recorded

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions