shraga 0.1.36 → 0.1.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shraga",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "The teammate you delegate coding to — a self-hostable, multi-user AI coding agent web UI (Claude Code, with a pluggable engine seam).",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -398,6 +398,18 @@ export class ClaudeCodeEngine implements AgentEngine {
398
398
  if (!waitingForBg) { waitingForBg = true; clearBgTimer(); console.log(`[claude] Holding stream for ${outstandingTasks.size} bg tasks (${elapsed()})`); }
399
399
  continue;
400
400
  }
401
+ // The SDK reports `subtype: 'success'` even when the API call failed (e.g. an org spend
402
+ // cap → HTTP 400) — the only tells are `is_error` / `api_error_status`. Trusting the
403
+ // subtype makes an all-turns-failing agent look healthy: schedules store lastRun 'ok',
404
+ // the failure notifier stays silent, and Slack simply gets nothing. Surface it as an
405
+ // error so the run fails loudly.
406
+ // `error_max_turns` also sets is_error but is a benign stop reason we already model.
407
+ if ((m.is_error || m.api_error_status) && sub !== 'max_turns_reached') {
408
+ const detail = typeof m.result === 'string' && m.result ? m.result : `api_error_status=${m.api_error_status ?? '?'}`;
409
+ console.error(`[claude] API error result — ${detail}`);
410
+ yield { type: 'error', message: `Claude API error: ${detail}` };
411
+ return;
412
+ }
401
413
  if (textDeltaCount === 0) {
402
414
  console.warn(`[claude] Empty response — result keys: ${Object.keys(m).join(',')}`);
403
415
  }