next-issue 6.6.92 → 6.6.93

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/README.md CHANGED
@@ -396,7 +396,9 @@ Recorded for each step: `claim`, `comments`, `reply`, `worktree`, `setup`,
396
396
  command is recorded with its exit code and duration. A `tool` event holds the
397
397
  tool name, and for a `bash` tool the command too. Each agent call adds a `usage`
398
398
  event with the tokens, the turn count, the
399
- tool-call count, the model and the session id.
399
+ tool-call count, the model and the session id. A call that times out, ends
400
+ with a model error or is stopped after its session started adds one too, and
401
+ its tokens count in the summary totals.
400
402
 
401
403
  ```bash
402
404
  jq -r 'select(.kind=="usage") | [.issue,.role,.turns,.total] | @tsv' \
package/dist/agents.mjs CHANGED
@@ -33,7 +33,14 @@ export async function runAgent(recorder, request) {
33
33
  try {
34
34
  refuseWhenStopped();
35
35
  await session.bindExtensions({});
36
- await session.prompt(request.prompt, { expandPromptTemplates: false });
36
+ let result;
37
+ try {
38
+ await session.prompt(request.prompt, { expandPromptTemplates: false });
39
+ }
40
+ finally {
41
+ // A call that times out, fails or is stopped has spent tokens too.
42
+ result = sessionResult(recorder, request, session, started);
43
+ }
37
44
  refuseWhenStopped();
38
45
  if (timer.timedOut()) {
39
46
  throw new Error(`The ${request.name} agent did not finish in ${request.timeoutMs} ms.`);
@@ -42,7 +49,7 @@ export async function runAgent(recorder, request) {
42
49
  if (failure !== undefined) {
43
50
  throw new Error(`The ${request.name} agent failed: ${failure}`);
44
51
  }
45
- return sessionResult(recorder, request, session, started);
52
+ return result;
46
53
  }
47
54
  finally {
48
55
  timer.clear();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.92",
3
+ "version": "6.6.93",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",