ework-daemon 0.4.53 → 0.4.54

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/opencode.ts +6 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.53",
3
+ "version": "0.4.54",
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/opencode.ts CHANGED
@@ -1299,11 +1299,11 @@ export class Engine {
1299
1299
  const superseded = () => this.generation.get(k) !== gen;
1300
1300
 
1301
1301
  // running.delete deferred to dequeuePending
1302
- this.currentMessage.delete(k);
1303
- this.currentModel.delete(k);
1304
-
1305
1302
  const started = this.startedAt.get(k);
1306
1303
  this.startedAt.delete(k);
1304
+ const usedModel = this.currentModel.get(k) ?? "";
1305
+ this.currentMessage.delete(k);
1306
+ this.currentModel.delete(k);
1307
1307
 
1308
1308
  const progressId = this.progressCommentId.get(k);
1309
1309
  const ref = this.sessionToRef(session, issue);
@@ -1361,9 +1361,10 @@ export class Engine {
1361
1361
  const hasRecent = this.hasRecentBotReply(commentsNow, tracker, started ?? undefined);
1362
1362
 
1363
1363
  if (hasRecent) {
1364
- const matched = commentsNow.find(c => tracker.isBotUser(c.author) && !this.isSystemComment(c) && c.createdAt && new Date(c.createdAt).getTime() > (started ?? 0));
1364
+ // oldest-first comment lists would match a pre-run bot reply when started
1365
+ // is undefined; pick the LAST qualifying comment instead.
1366
+ const matched = [...commentsNow].reverse().find(c => tracker.isBotUser(c.author) && !this.isSystemComment(c) && c.createdAt && new Date(c.createdAt).getTime() > (started ?? 0));
1365
1367
  log.info(`engine: [bot] reply found for ${k} after prompt (comment ${matched?.id ?? "?"} createdAt ${matched?.createdAt ?? "?"}), marking done`);
1366
- const usedModel = this.currentModel.get(k) ?? "";
1367
1368
  if (matched && usedModel) {
1368
1369
  void tracker.setCommentModel(ref, matched.id, usedModel).catch(() => { /* display-only */ });
1369
1370
  }