ework-daemon 0.4.68 → 0.4.69

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 +11 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-daemon",
3
- "version": "0.4.68",
3
+ "version": "0.4.69",
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
@@ -1458,7 +1458,10 @@ export class Engine {
1458
1458
 
1459
1459
  this.processes.set(k, handle);
1460
1460
  this.lastOutputAt.set(k, Date.now());
1461
- if (!this.startedAt.has(k)) this.startedAt.set(k, Date.now());
1461
+ // Budget is strictly per-run: a replacement spawn must never inherit the
1462
+ // previous run's start timestamp (observed: a fresh pid killed 30s after
1463
+ // spawn because the 3h watchdog still held the superseded run's start).
1464
+ this.startedAt.set(k, Date.now());
1462
1465
  this.currentPrompt.set(k, msg.content);
1463
1466
 
1464
1467
  await this.store.updateSession(session.id, { opencodePid: handle.pid });
@@ -1974,7 +1977,13 @@ export class Engine {
1974
1977
  log.warn(`engine: run exceeded max runtime (${hrs}h) on ${k}, stopping`);
1975
1978
  await tracker.createComment(this.sessionToRef(session, issue), `[system] ⏹ **${session.name}** run exceeded ${hrs}h — stopped. Reply again on the issue to continue.`).catch(() => { /* best-effort */ });
1976
1979
  this.nudgeRounds.set(k, Engine.MAX_NUDGE_ROUNDS);
1977
- this.forceStop(k);
1980
+ await this.forceStop(k);
1981
+ // forceStop clears daemon-side state but intentionally skips
1982
+ // finishRun (stopping flag), so without this the web ai_status
1983
+ // stays "processing" forever — the exact stuck state users see
1984
+ // after a capped run. Capped runs may have delivered partial
1985
+ // work, so "completed" (not "failed") is the honest terminal.
1986
+ void tracker.updateStatus(this.sessionToRef(session, issue), "completed");
1978
1987
  continue;
1979
1988
  }
1980
1989