1. Feedback Actions
  2. Stubbucks Hard Limit Reached

Feedback Actions

Stubbucks Hard Limit Reached Feedback Action

Explains the hard stubbucks limit feedback action that runs when a stub's lifetime spend crosses the hard threshold. Useful for stopping runaway stubs, enforcing per stub budget ceilings, and escalating to an administrator.

Overview

When a stub's total lifetime stubbucks spend crosses the hard threshold configured in Stubbucks Limits, the _stubbucks_hard_limit_reached feedback action is triggered on that stub.

The hard limit is the ceiling. It is usually set higher than the soft limit and is where you stop the stub, using the Disable Stub Task. The earlier warning is _stubbucks_soft_limit_reached.

The action is only triggered if the hard limit has been enabled in Org Settings. Setting a threshold on its own does nothing.

All the details of the limit that tripped are available in the stubpost.data._stubber_platform.stubbucks_limit data path, in the same structure as the soft limit action.

WARNING

If this action disables the stub, it is the last limit action that stub will ever see. A disabled stub accepts no further actions until it is reopened, so any queued limit action for it is discarded.

The stubpost message is set to a human readable summary, i.e. stubpost.message:

        Stubbucks hard limit reached: 1024.00 of 1000.00 stubbucks used

      

Like all followup actions, this action runs as the Stubber system contact rather than as a user, so its permissions must include a contact list that the system contact resolves into.

Stopping the stub

The Disable the stub setting on the limit does not stop anything by itself. It is a value your action reads, so that whether the stub is stopped stays a decision made inside the action.

The usual setup is a Disable Stub Task with a condition on the org setting:

loading...

That way an org can raise or lower its ceiling, and turn stopping on or off, without editing the template.

Data Structure

Feedback Action Data

Example data that is passed to the _stubbucks_hard_limit_reached feedback action:

        "_stubber_platform": {
  "stubbucks_limit": {
    "limit_key": "hard",
    "reason": "crossed",
    "threshold_msb": 1000000,
    "threshold_stubbucks": 1000,
    "previous_msb": 980000,
    "total_price_msb": 1024000,
    "total_price_stubbucks": 1024
  }
}

      

The properties, linking data and JSONSchema are identical to the soft limit action. See Stubbucks Soft Limit Reached for the full reference. The only difference is limit_key, which is hard here.

Both limits in one action

A single expensive action can cross both thresholds at once. When that happens both feedback actions are triggered, soft first and hard second, so the warning is always recorded before the stub is stopped.

If your hard limit disables the stub, keep in mind that the soft action will have already run by then.