Skip to content

Update API groundwork: update scope, failed-auth rate limit and single-flight guard (rigforge#684 1/3) #699

Open

Description

@pithead-developer

What's the problem

#684 adds update routes to the control server, but the server has no rule for which tokens may update a rig, no request rate limiter (util/control-server.py has MAX_BODY and MAX_PENDING only) and no guard against two updates at once. None of this depends on pithead#4013, so it can land before the routes.

What it impacts

Nothing user-visible on its own. It is the base for the update routes in #684, which the Pithead v2.0.5 per-rig update needs.

How I found it

Split from #684 while grooming v1.20.0 on 2026-11-17. #684 is too large for one PR and its routes are blocked on pithead#4013; this part is not.

How important is it

High for v1.20.0. It is the first step of #684 and the only part that can start before pithead#4013 lands.

Acceptance criteria

  • Only the control token may call a route marked update-scoped. A derived read token is always refused. A named consumer token is refused unless it is explicitly granted an update scope.
  • A missing or wrong token gets 401. Failed-auth attempts are rate limited and logged, the limit (global or per source) is stated in the docs, and a request over it gets 429.
  • A single-flight guard returns 409 while an update request is in flight.
  • Unit tests cover each rule and status code. This change exposes no update route to users yet.

Possible solutions

  • Extend the existing ACCESS_TOKENS and derive_read_token scope checks in util/control-server.py with an update scope.
  • Keep a small in-memory failure counter per source with a time window.
  • Hold a lock in the spool action while an update runs.

Activity

  1. added this to the v1.20.0 milestone on Nov 17, 2026
  2. added
    enhancement
    size:M
    on Nov 17, 2026
  3. pithead-developer commented on Nov 23, 2026

    @pithead-developer
    ContributorAuthor

    Needs an operator action (do it, then remove the operator-action label):

    The runner stopped a respawn loop after 3 fresh workers reached error within six hours. Inspect the repeated outcome, then remove this label to release one new worker.

  4. added
    operator-action
    on Nov 23, 2026
  5. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Owner decision (2026-11-27): the USB stick rig's remote update path is a priority, so this goes back to work now. Releasing one new worker. #700 follows once this one is under way, and #701 starts after pithead#4013 merges.

  6. removed
    operator-action
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsize:M

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions