tuna-agent 0.1.87 → 0.1.88
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/dist/daemon/index.js +12 -0
- package/package.json +1 -1
package/dist/daemon/index.js
CHANGED
|
@@ -843,6 +843,18 @@ ${skillContent.slice(0, 15000)}`;
|
|
|
843
843
|
wsClient.sendPMStreamEnd(taskId, streamMsgId);
|
|
844
844
|
sessionId = result.sessionId || sessionId;
|
|
845
845
|
totalDurationMs += result.durationMs || 0;
|
|
846
|
+
// Detect stale/dead session: no stream events + empty or very short result
|
|
847
|
+
// This happens when daemon restarts and old Claude Code session is gone
|
|
848
|
+
const resultText = (result.result || '').trim();
|
|
849
|
+
if (messageCount === 0 && resultText.length < 10 && round === 0 && sessionId) {
|
|
850
|
+
console.log(`[Daemon] ⚠️ Stale session detected (no stream events, result=${resultText.length} chars) — retrying without resume`);
|
|
851
|
+
sessionId = undefined;
|
|
852
|
+
wsClient.sendPMMessage(taskId, {
|
|
853
|
+
sender: 'pm',
|
|
854
|
+
content: 'Session expired after restart. Starting fresh...',
|
|
855
|
+
});
|
|
856
|
+
continue; // retry this round without --resume
|
|
857
|
+
}
|
|
846
858
|
// Send finalized message for the last turn's remaining text
|
|
847
859
|
if (turnAccumulatedText.trim()) {
|
|
848
860
|
wsClient.sendPMMessage(taskId, {
|