1. Feedback Actions
  2. Stubbucks Soft Limit Reached

Feedback Actions

Stubbucks Soft Limit Reached Feedback Action

Explains the soft stubbucks limit feedback action that runs when a stub's lifetime spend crosses the soft threshold. Useful for cost alerting, early warnings to case owners, and spotting runaway stubs before they get expensive.

Overview

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

The soft limit is the early warning. Nothing is stopped by default, so this action is where you decide who should be told and what should happen. The stricter counterpart is _stubbucks_hard_limit_reached.

The action is only triggered if the soft 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.

NOTE

The action is triggered on the crossing, not on every action once the stub is over the limit. To keep being told while a stub stays over the line, set Run again after (seconds) on the limit.

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

        Stubbucks soft limit reached: 262.50 of 250.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.

Data Structure

Feedback Action Data

Example data that is passed to the _stubbucks_soft_limit_reached feedback action:

        "_stubber_platform": {
  "stubbucks_limit": {
    "limit_key": "soft",
    "reason": "crossed",
    "threshold_msb": 250000,
    "threshold_stubbucks": 250,
    "previous_msb": 240000,
    "total_price_msb": 262500,
    "total_price_stubbucks": 262.5
  }
}

      

Properties

limit_key
string

Which limit tripped, soft or hard. Useful when both limits point at the same action.


reason
string

Why the action was triggered.

Value Meaning
crossed The stub went from under the threshold to over it. The normal case.
already_above The stub was already over the threshold the first time the limit was evaluated, because the threshold was lowered or added after the stub had spent.
re_triggered The stub is still over the threshold and the Run again after (seconds) window has elapsed.

threshold_stubbucks
number

The threshold that was crossed, in stubbucks. This is the value set in Org Settings.


threshold_msb
number

The same threshold in msb. 1000 msb = 1 stubbuck.


total_price_stubbucks
number

The stub's total lifetime spend, in stubbucks, at the moment the limit tripped.


total_price_msb
number

The stub's total lifetime spend in msb.


previous_msb
number

The stub's total lifetime spend in msb before the action that tripped the limit. The difference between this and total_price_msb is what the triggering action cost.

Linking Data

The stubpost that triggered the limit is recorded on the feedback action's metadata, at stubpost.metadata.linking_data.send_action_details.sent_from:

        "sent_from": {
  "action_name": "run_expensive_task",
  "stubref": "2024-01-01-XXXX-FAKE",
  "stubpostuuid": "9dd3a93b-d17c-52f4-a677-0a0d89f2f123"
}

      

This is how you find the action that pushed the stub over the limit.

JSONSchema

The JSONSchema of the stubpost.data._stubber_platform.stubbucks_limit is:

        {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Stubbucks Limit",
  "type": "object",
  "properties": {
    "_stubber_platform": {
      "type": "object",
      "properties": {
        "stubbucks_limit": {
          "type": "object",
          "properties": {
            "limit_key": {
              "type": "string",
              "enum": ["soft", "hard"],
              "description": "Which configured limit tripped."
            },
            "reason": {
              "type": "string",
              "enum": ["crossed", "already_above", "re_triggered"],
              "description": "Why the limit action was triggered."
            },
            "threshold_msb": {
              "type": "number",
              "description": "The threshold that was crossed, in msb."
            },
            "threshold_stubbucks": {
              "type": "number",
              "description": "The threshold that was crossed, in stubbucks."
            },
            "previous_msb": {
              "type": "number",
              "description": "The stub's total spend in msb before the action that tripped the limit."
            },
            "total_price_msb": {
              "type": "number",
              "description": "The stub's total lifetime spend in msb when the limit tripped."
            },
            "total_price_stubbucks": {
              "type": "number",
              "description": "The stub's total lifetime spend in stubbucks when the limit tripped."
            }
          },
          "required": [
            "limit_key",
            "reason",
            "threshold_msb",
            "threshold_stubbucks",
            "previous_msb",
            "total_price_msb",
            "total_price_stubbucks"
          ],
          "additionalProperties": false
        }
      },
      "required": ["stubbucks_limit"],
      "additionalProperties": false
    }
  },
  "required": ["_stubber_platform"],
  "additionalProperties": false
}