@yagni-app/code-staging 1.2.3-staging.1632.1 → 1.2.3-staging.1659.1

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.
@@ -128,6 +128,14 @@ function incompleteHandoff(r) {
128
128
  * against stderr/errorMessage only — never a stage's real output.
129
129
  */
130
130
  const CREDIT_EXHAUSTION_RE = /out of credits|insufficient_quota|payment required|\b402\b/;
131
+ /**
132
+ * The run-scoped budget shapes: a Run's own approved budget or model-request
133
+ * limit, which the proxy refuses with a 429 typed `insufficient_quota`. The
134
+ * workspace can have plenty of credits when this fires, so it is checked first
135
+ * and never reported as the workspace's credits (production 2026-10-08: a $25
136
+ * run budget read as "the workspace ran out of credits").
137
+ */
138
+ const RUN_BUDGET_EXHAUSTION_RE = /run_budget_exhausted|run_request_limit_exhausted|This Run has reached its model-request or approved packet budget|This Run has used its \d+ model requests/;
131
139
  /**
132
140
  * The silent-402 landmine: when the workspace runs out of credits mid-run, the
133
141
  * proxy 402s every model request, the child pi exits 0 with an EMPTY transcript,
@@ -135,12 +143,16 @@ const CREDIT_EXHAUSTION_RE = /out of credits|insufficient_quota|payment required
135
143
  * "clean" stop with the real cause buried in stderr. Detect it and stop with an
136
144
  * actionable message instead. Gated on the stage having produced no real output
137
145
  * (or having failed outright) so a healthy stage whose stderr happens to contain
138
- * a matching token can never trip it.
146
+ * a matching token can never trip it. A Run that spent its own budget stops the
147
+ * same way, with its own message.
139
148
  */
140
149
  function creditExhaustionReason(r) {
141
150
  if (r.finalOutput.trim().length > 0 && !isFailed(r))
142
151
  return undefined;
143
152
  const hay = `${r.errorMessage ?? ""}\n${r.stderr}`;
153
+ if (RUN_BUDGET_EXHAUSTION_RE.test(hay)) {
154
+ return "this run reached its approved budget (the model proxy refused further calls). Raise the Team's run budget or revise the plan, then re-run /go.";
155
+ }
144
156
  if (!CREDIT_EXHAUSTION_RE.test(hay))
145
157
  return undefined;
146
158
  return "the workspace is out of YAGNI credits (the model proxy returned 402). Top up credits, then re-run /go.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagni-app/code-staging",
3
- "version": "1.2.3-staging.1632.1",
3
+ "version": "1.2.3-staging.1659.1",
4
4
  "description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
@@ -58,5 +58,5 @@
58
58
  "turndown": "^7.2.4",
59
59
  "typebox": "^1.3.15"
60
60
  },
61
- "yagniSourceSha": "3275eb7ef2a6e502e47bd2e835aa38bd4fb28b37"
61
+ "yagniSourceSha": "b384d042526710ecc56fb3c2bbb2dc4bd83925e3"
62
62
  }