ework-daemon 0.4.40 → 0.4.41
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 +1 -1
- package/src/op.ts +1 -1
- package/src/opencode.ts +14 -4
package/package.json
CHANGED
package/src/op.ts
CHANGED
|
@@ -520,7 +520,7 @@ export class Store {
|
|
|
520
520
|
`SELECT m.* FROM {{messages}} m
|
|
521
521
|
INNER JOIN {{op_sessions}} s ON s.uid = m.session_id
|
|
522
522
|
INNER JOIN {{issues}} i ON i.uid = s.issue_id
|
|
523
|
-
WHERE i.owner_daemon_id = ? AND m.status IN ('pending', 'running')
|
|
523
|
+
WHERE i.owner_daemon_id = ? AND m.status IN ('pending', 'running', 'interrupted')
|
|
524
524
|
ORDER BY m.created_at ASC`,
|
|
525
525
|
[daemonId]
|
|
526
526
|
);
|
package/src/opencode.ts
CHANGED
|
@@ -1813,7 +1813,7 @@ export class Engine {
|
|
|
1813
1813
|
// Reset running messages to pending
|
|
1814
1814
|
for (const msg of stuck) {
|
|
1815
1815
|
if (msg.status === "running") {
|
|
1816
|
-
await this.store.updateMessageStatus(msg.id, "
|
|
1816
|
+
await this.store.updateMessageStatus(msg.id, "interrupted");
|
|
1817
1817
|
}
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
@@ -1831,16 +1831,26 @@ export class Engine {
|
|
|
1831
1831
|
const issue = await this.store.getIssue(session.issueId);
|
|
1832
1832
|
if (!issue || issue.state === "closed") continue;
|
|
1833
1833
|
|
|
1834
|
-
const gate = await this.
|
|
1834
|
+
const gate = await this.gateChecker(issue);
|
|
1835
1835
|
if (!gate.allowed) {
|
|
1836
|
-
log.info(`engine: recover — web gate blocked ${issue.trackerScopeKey}#${issue.trackerIssueId} (${gate.reason}),
|
|
1837
|
-
for (const m of msgs)
|
|
1836
|
+
log.info(`engine: recover — web gate blocked ${issue.trackerScopeKey}#${issue.trackerIssueId} (${gate.reason}), discarding queued (pending) messages`);
|
|
1837
|
+
for (const m of msgs) {
|
|
1838
|
+
if (m.status === "pending") {
|
|
1839
|
+
await this.store.updateMessageStatus(m.id, "failed", `web gate: ${gate.reason}`);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1838
1842
|
continue;
|
|
1839
1843
|
}
|
|
1840
1844
|
|
|
1841
1845
|
const k = this.sessionKey(session, issue);
|
|
1842
1846
|
if (this.running.has(k)) continue;
|
|
1843
1847
|
|
|
1848
|
+
for (const m of msgs) {
|
|
1849
|
+
if (m.status === "running") {
|
|
1850
|
+
await this.store.updateMessageStatus(m.id, "pending");
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1844
1854
|
const first = msgs.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime())[0]!;
|
|
1845
1855
|
|
|
1846
1856
|
// Check if AI already replied before the crash — skip re-running if so
|