ework-daemon 0.4.23 → 0.4.24

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": "ework-daemon",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "description": "Issue-driven AI development daemon. Spawns opencode subprocesses to resolve Gitea issues.",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
package/src/gitea.ts CHANGED
@@ -75,8 +75,8 @@ export class GiteaClient {
75
75
  status,
76
76
  detail,
77
77
  }, true);
78
- } catch {
79
- // Status callback is best-effort — don't block processing on API failure.
78
+ } catch (e) {
79
+ console.warn("[gitea] updateIssueStatus failed:", (e as Error).message);
80
80
  }
81
81
  }
82
82
 
package/src/opencode.ts CHANGED
@@ -561,6 +561,11 @@ export class Engine {
561
561
  return;
562
562
  }
563
563
 
564
+ if (issueData.ai_status === "halted" && (event.type === "issue_opened" || event.type === "comment_created")) {
565
+ log.info(`engine: issue halted — skipping ${event.type} for ${ref.trackerType}:${scopeKey}#${ref.issueId}`);
566
+ return;
567
+ }
568
+
564
569
  const issueMapKey = `${ref.trackerType}:${scopeKey}#${ref.issueId}`;
565
570
  if (groupConfig) {
566
571
  this.groupConfigs.set(issueMapKey, groupConfig);
@@ -1163,6 +1168,7 @@ export class Engine {
1163
1168
  if (exitCode === null) {
1164
1169
  log.info(`engine: spawn failed for ${k}, skipping completion check`);
1165
1170
  await this.store.updateSession(session.id, { opencodePid: undefined });
1171
+ void tracker.updateStatus(ref, "failed", "spawn failed");
1166
1172
  await this.deactivateIfIdle(k, session, issue);
1167
1173
  return;
1168
1174
  }
@@ -1185,6 +1191,7 @@ export class Engine {
1185
1191
  this.nudgeRounds.delete(k);
1186
1192
  this.emptyResponseRounds.delete(k);
1187
1193
  await this.persistRuntimeState(session.id);
1194
+ void tracker.updateStatus(ref, "");
1188
1195
  } else {
1189
1196
  const sessionOutput = await this.checkSessionOutput(session.opencodeSessionId);
1190
1197
  const emptyRound = this.emptyResponseRounds.get(k) ?? 0;
@@ -1207,6 +1214,7 @@ export class Engine {
1207
1214
  this.emptyResponseRounds.delete(k);
1208
1215
  this.nudgeRounds.delete(k);
1209
1216
  await tracker.createComment(ref, `[system] ❌ **${session.name}** 模型返回空响应(0 token),已重试 ${emptyRound} 次。请检查模型配置或稍后重试。`).catch(() => {});
1217
+ void tracker.updateStatus(ref, "failed", "empty model response");
1210
1218
  } else {
1211
1219
  const nudgeRound = this.nudgeRounds.get(k) ?? 0;
1212
1220
  if (exitCode === 0 && nudgeRound < Engine.MAX_NUDGE_ROUNDS) {
@@ -1225,6 +1233,7 @@ export class Engine {
1225
1233
  this.nudgeRounds.delete(k);
1226
1234
  const detail = exitCode === 0 ? "ran but did not post a reply" : `crashed (exit ${exitCode})`;
1227
1235
  await tracker.createComment(ref, `[system] ❌ **${session.name}** ${detail}. Try posting again or @${session.name} to retry.`).catch(() => {});
1236
+ void tracker.updateStatus(ref, "failed", detail);
1228
1237
  }
1229
1238
  }
1230
1239
 
@@ -140,6 +140,7 @@ export class GiteaTracker implements IssueTracker {
140
140
  };
141
141
 
142
142
  const issueUser = issue.user as Record<string, string>;
143
+ const aiStatus = typeof issue.ai_status === "string" ? issue.ai_status : "";
143
144
 
144
145
  if (action === "opened" || action === "reopened") {
145
146
  return {
@@ -150,6 +151,7 @@ export class GiteaTracker implements IssueTracker {
150
151
  body: (issue.body as string) ?? "",
151
152
  state: (issue.state as string) ?? "open",
152
153
  author: issueUser?.login ?? "",
154
+ ai_status: aiStatus,
153
155
  },
154
156
  model,
155
157
  cloneUrl,
@@ -167,6 +169,7 @@ export class GiteaTracker implements IssueTracker {
167
169
  body: (issue.body as string) ?? "",
168
170
  state: (issue.state as string) ?? "open",
169
171
  author: issueUser?.login ?? "",
172
+ ai_status: aiStatus,
170
173
  },
171
174
  comment: {
172
175
  id: String(comment.id),
@@ -188,6 +191,7 @@ export class GiteaTracker implements IssueTracker {
188
191
  body: (issue.body as string) ?? "",
189
192
  state: "closed",
190
193
  author: issueUser?.login ?? "",
194
+ ai_status: aiStatus,
191
195
  },
192
196
  model,
193
197
  cloneUrl,
@@ -205,6 +209,7 @@ export class GiteaTracker implements IssueTracker {
205
209
  body: (issue.body as string) ?? "",
206
210
  state: (issue.state as string) ?? "open",
207
211
  author: issueUser?.login ?? "",
212
+ ai_status: aiStatus,
208
213
  },
209
214
  status: {
210
215
  from: status?.from ?? "",
@@ -23,6 +23,7 @@ export interface TrackerEvent {
23
23
  body: string;
24
24
  state: string;
25
25
  author: string;
26
+ ai_status?: string;
26
27
  };
27
28
  comment?: {
28
29
  id: string;