dashclaw 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashclaw.js +12 -1
- package/package.json +1 -1
package/dashclaw.js
CHANGED
|
@@ -115,10 +115,21 @@ class DashClaw {
|
|
|
115
115
|
const startTime = Date.now();
|
|
116
116
|
while (Date.now() - startTime < timeout) {
|
|
117
117
|
const { action } = await this._request(`/api/actions/${actionId}`, 'GET');
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
// Explicitly unblocked by approval metadata
|
|
120
|
+
if (action.approved_by) return action;
|
|
121
|
+
|
|
122
|
+
// Denial cases
|
|
119
123
|
if (action.status === 'failed' || action.status === 'cancelled') {
|
|
120
124
|
throw new ApprovalDeniedError(action.error_message || 'Operator denied the action.', action.status);
|
|
121
125
|
}
|
|
126
|
+
|
|
127
|
+
// Requirement 4: If an action leaves pending_approval without approval metadata, throw an error.
|
|
128
|
+
// This prevents "auto-approval" bugs where status is changed by non-approval paths.
|
|
129
|
+
if (action.status !== 'pending_approval') {
|
|
130
|
+
throw new Error(`Action ${actionId} left pending_approval state without explicit approval metadata (Status: ${action.status})`);
|
|
131
|
+
}
|
|
132
|
+
|
|
122
133
|
await new Promise(r => setTimeout(r, interval));
|
|
123
134
|
}
|
|
124
135
|
throw new Error(`Timed out waiting for approval of action ${actionId}`);
|