@teamvibe/poller 0.1.61 → 0.1.63

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.
@@ -32,14 +32,16 @@ export async function postMaintenanceReports(brainPath, channelId) {
32
32
  const content = await readFile(filePath, 'utf-8');
33
33
  const report = JSON.parse(content);
34
34
  if (!report.operationType) {
35
- logger.warn(`[MaintenanceReporter] Skipping ${file}: missing operationType`);
36
- emitError('maintenance', `Skipping report ${file}: missing operationType`, { severity: 'warn' });
35
+ logger.warn(`[MaintenanceReporter] Removing invalid report ${file}: missing operationType`);
36
+ emitError('maintenance', `Removing invalid report ${file}: missing operationType`, { severity: 'warn' });
37
+ await unlink(filePath).catch(() => { });
37
38
  continue;
38
39
  }
39
40
  const eventType = OPERATION_TO_EVENT_TYPE[report.operationType];
40
41
  if (!eventType) {
41
- logger.warn(`[MaintenanceReporter] Skipping ${file}: unknown operationType "${report.operationType}"`);
42
- emitError('maintenance', `Skipping report ${file}: unknown operationType "${report.operationType}"`, { severity: 'warn' });
42
+ logger.warn(`[MaintenanceReporter] Removing report ${file}: unknown operationType "${report.operationType}"`);
43
+ emitError('maintenance', `Removing report ${file}: unknown operationType "${report.operationType}"`, { severity: 'warn' });
44
+ await unlink(filePath).catch(() => { });
43
45
  continue;
44
46
  }
45
47
  const payload = {
package/dist/poller.js CHANGED
@@ -43,6 +43,7 @@ async function runInboxLoop(threadId, kbPath, queueMessage, sessionLog) {
43
43
  const typing = hasSlackContext
44
44
  ? startTypingIndicator(queueMessage)
45
45
  : undefined;
46
+ let succeeded = false;
46
47
  try {
47
48
  // Reconstruct queue message from stored inbox data
48
49
  const storedData = JSON.parse(message.content);
@@ -61,6 +62,7 @@ async function runInboxLoop(threadId, kbPath, queueMessage, sessionLog) {
61
62
  `duration: ${result.metrics.duration_ms}ms`);
62
63
  }
63
64
  if (result.success) {
65
+ succeeded = true;
64
66
  sessionLog.info(`[Loop] Claude completed iteration #${iteration}`);
65
67
  if (queueMessage.teamvibe.brain?.brainId) {
66
68
  await pushBrainChanges(kbPath, queueMessage.teamvibe.brain.brainId, queueMessage.teamvibe.workspaceId);
@@ -81,8 +83,10 @@ async function runInboxLoop(threadId, kbPath, queueMessage, sessionLog) {
81
83
  typing?.stop();
82
84
  sessionLog.error(`[Loop] Error in iteration #${iteration}: ${error instanceof Error ? error.message : error}`);
83
85
  }
84
- // Safety net: ensure the processing file is cleaned up
85
- markProcessed(kbPath, threadId, message.filename);
86
+ // Only delete processing file on success — failed/killed sessions get retried
87
+ if (succeeded) {
88
+ markProcessed(kbPath, threadId, message.filename);
89
+ }
86
90
  if (!hasUnprocessed(kbPath, threadId)) {
87
91
  break;
88
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamvibe/poller",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {