{"record":{"id":"2899c2d084116458","repo":"calesthio/OpenMontage","slug":"action-costs-estimated-2f-exceeds-single-acti","errorCode":null,"errorMessage":"Action costs ${estimated:.2f}, exceeds single-action threshold ${self.single_action_approval_usd:.2f}","messagePattern":"Action costs (.+?), exceeds single-action threshold (.+?)","errorType":"exception","errorClass":"ApprovalRequiredError","httpStatus":null,"severity":"warning","filePath":"tools/cost_tracker.py","lineNumber":129,"sourceCode":"            \"actual_usd\": 0.0,\n            \"timestamp\": self._now(),\n        })\n        self._save()\n        return entry_id\n\n    def reserve(self, entry_id: str) -> None:\n        \"\"\"Reserve budget for an estimated entry.\n\n        Raises BudgetExceededError in cap mode, or ApprovalRequiredError\n        when the action exceeds the single-action approval threshold.\n        \"\"\"\n        entry = self._find(entry_id)\n        estimated = entry[\"estimated_usd\"]\n\n        # Check single-action approval threshold\n        if estimated > self.single_action_approval_usd:\n            if self.mode != BudgetMode.OBSERVE:\n                raise ApprovalRequiredError(\n                    f\"Action costs ${estimated:.2f}, exceeds \"\n                    f\"single-action threshold ${self.single_action_approval_usd:.2f}\"\n                )\n\n        # Check new paid tool approval\n        if self.require_approval_for_new_paid_tool and estimated > 0:\n            if entry[\"tool\"] not in self._approved_tools:\n                if self.mode != BudgetMode.OBSERVE:\n                    raise ApprovalRequiredError(\n                        f\"First paid use of tool {entry['tool']!r} requires approval\"\n                    )\n\n        # Check budget\n        if estimated > self.usable_budget_usd:\n            message = (\n                f\"Reservation of ${estimated:.2f} exceeds usable budget \"\n                f\"${self.usable_budget_usd:.2f}\"\n            )","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/cost_tracker.py#L111-L147","documentation":"ApprovalRequiredError raised by CostTracker.reserve when a single entry's estimated_usd exceeds single_action_approval_usd and the tracker is not in OBSERVE mode. It is a policy gate, not a hard budget failure: the system is refusing to auto-execute one expensive action until a human/tool approves it. In OBSERVE mode it is skipped so telemetry-only runs never block.","triggerScenarios":"Calling reserve(entry_id) where the logged entry's estimated_usd > single_action_approval_usd and mode is CAP or WARN (anything but OBSERVE). Typical with premium video/image models (e.g. a multi-second generation priced above the configured per-action ceiling).","commonSituations":"Lowering single_action_approval_usd in config to tighten spend control, then running a previously-allowed expensive model; or first use of a premium tier model whose estimate exceeds the default threshold.","solutions":["If the cost is expected, approve the action through the tracker's approval flow (e.g. approve_tool / the entry approval mechanism) and retry the reserve.","Raise single_action_approval_usd in the budget configuration so this action falls under the per-action ceiling.","Switch to a cheaper model or shorter duration so estimated_usd stays under the threshold.","For dry runs / telemetry, set mode to OBSERVE so approval gates are bypassed entirely."],"exampleFix":"# before\ntracker.reserve(entry_id)  # raises ApprovalRequiredError when estimate > threshold\n\n# after\ntry:\n    tracker.reserve(entry_id)\nexcept ApprovalRequiredError:\n    tracker.approve_tool(entry[\"tool\"])\n    tracker.reserve(entry_id)","handlingStrategy":"try-catch","validationCode":"def would_need_approval(tracker, entry_id: str) -> bool:\n    entry = next((e for e in tracker.entries if e[\"id\"] == entry_id), None)\n    return bool(entry and entry[\"estimated_usd\"] > tracker.single_action_approval_usd)","typeGuard":null,"tryCatchPattern":"from tools.cost_tracker import ApprovalRequiredError\n\ntry:\n    tracker.reserve(entry_id)\nexcept ApprovalRequiredError as e:\n    if \"single-action threshold\" in str(e):\n        notify_human(e)  # surface for approval, then re-reserve after approval\n    raise","preventionTips":["Set single_action_approval_usd above your largest routine per-action cost.","Check estimates against the threshold before initiating expensive calls.","Use OBSERVE mode in pipelines where no human can approve interactively."],"tags":["budget","cost-tracking","approval","policy"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}