@ducci/jarvis 1.0.96 → 1.0.97
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/server/agent.js +2 -1
package/package.json
CHANGED
package/src/server/agent.js
CHANGED
|
@@ -782,6 +782,7 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [],
|
|
|
782
782
|
} else {
|
|
783
783
|
userContent = userMessageWithContext;
|
|
784
784
|
}
|
|
785
|
+
const interactionStartIndex = session.messages.length;
|
|
785
786
|
session.messages.push({ role: 'user', content: userContent });
|
|
786
787
|
session.metadata.handoffCount = 0;
|
|
787
788
|
session.metadata.failedApproaches = [];
|
|
@@ -820,7 +821,7 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [],
|
|
|
820
821
|
// Safety check: if the last two assistant messages are both model_error
|
|
821
822
|
// synthetic notes, we are in a confirmed failure loop. Escalate immediately
|
|
822
823
|
// rather than burning more iterations on a stuck session.
|
|
823
|
-
if (hasConsecutiveModelErrors(session.messages)) {
|
|
824
|
+
if (hasConsecutiveModelErrors(session.messages.slice(interactionStartIndex))) {
|
|
824
825
|
finalResponse = 'The model has failed twice in a row. This is likely due to the conversation being too long for the model to process. Please start a new session or switch to a model with a larger context window.';
|
|
825
826
|
finalLogSummary = 'Consecutive model_error detected: session escalated to intervention_required without running another agent loop.';
|
|
826
827
|
finalStatus = 'intervention_required';
|