@warpmetrics/coder 0.2.6 → 0.2.7

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": "@warpmetrics/coder",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "type": "module",
5
5
  "description": "Local agent loop for implementing GitHub issues with Claude Code. Powered by WarpMetrics.",
6
6
  "bin": {
package/src/revise.js CHANGED
@@ -36,13 +36,13 @@ export async function revise(item, { board, config, log, refActId }) {
36
36
  // Check revision limit
37
37
  if (config.warpmetricsApiKey) {
38
38
  try {
39
- const count = await warp.countRevisions(config.warpmetricsApiKey, { prNumber, repo: repoName });
40
- if (count >= maxRevisions) {
41
- log(` revision limit reached (${count}/${maxRevisions}) — moving to Blocked`);
39
+ const revisionCount = await warp.countRevisions(config.warpmetricsApiKey, { prNumber, repo: repoName });
40
+ if (revisionCount >= maxRevisions) {
41
+ log(` revision limit reached (${revisionCount}/${maxRevisions}) — moving to Blocked`);
42
42
  try { await board.moveToBlocked(item); } catch {}
43
- return false;
43
+ return { success: false, reason: 'max_retries', count: revisionCount };
44
44
  }
45
- log(` revision ${count + 1}/${maxRevisions}`);
45
+ log(` revision ${revisionCount + 1}/${maxRevisions}`);
46
46
  } catch (err) {
47
47
  log(` warning: revision check failed: ${err.message}`);
48
48
  }
@@ -268,5 +268,5 @@ export async function revise(item, { board, config, log, refActId }) {
268
268
  rmSync(workdir, { recursive: true, force: true });
269
269
  }
270
270
 
271
- return success;
271
+ return { success, reason: success ? 'ok' : 'error' };
272
272
  }
package/src/watch.js CHANGED
@@ -74,7 +74,24 @@ export async function watch() {
74
74
  for (const item of reviewItems) {
75
75
  if (!running) break;
76
76
  log(`Found review feedback: PR #${item._prNumber || item.content?.number}`);
77
- await revise(item, { board, config, log, refActId: item._reviewActId });
77
+ const result = await revise(item, { board, config, log, refActId: item._reviewActId });
78
+
79
+ // Record outcome on the issue run if revision failed terminally
80
+ const issueNumber = item.content?.number;
81
+ const issueCtx = issueNumber ? issueRuns.get(issueNumber) : null;
82
+ if (!result.success && issueCtx && config.warpmetricsApiKey) {
83
+ const name = result.reason === 'max_retries' ? 'Max Retries' : 'Revision Failed';
84
+ try {
85
+ await warp.closeIssueRun(config.warpmetricsApiKey, {
86
+ runId: issueCtx.runId,
87
+ name,
88
+ opts: { pr_number: String(item._prNumber || ''), revisions: String(result.count || '') },
89
+ });
90
+ log(` issue run: ${name}`);
91
+ } catch (err) {
92
+ log(` warning: issue run outcome failed: ${err.message}`);
93
+ }
94
+ }
78
95
  }
79
96
 
80
97
  // 3. Merge approved PRs