π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(model-runtime): classify "Agent state not found" as StateStoreReadError (#15778)
Arvin Xuf51dd06a36a3
diff --git a/packages/locales/src/default/modelRuntime.ts b/packages/locales/src/default/modelRuntime.tsindex 40a8fffd08b..903b2198ce2 100644--- a/packages/locales/src/default/modelRuntime.ts+++ b/packages/locales/src/default/modelRuntime.ts@@ -70,7 +70,7 @@ export default {StateStorePersistError:'A temporary issue with the conversation state store interrupted this operation. Please try again; if it persists, contact support.',StateStoreReadError:- 'This operation was ended because the connection closed before it finished. This is usually harmless β reopen the conversation to continue.',+ 'This operation could not be resumed because its session state was unavailable. Please reopen the conversation to continue; if it persists, contact support.',StreamChunkError:'Error parsing the message chunk of the streaming request. Please check if the current API interface complies with the standard specifications, or contact your API provider for assistance.',UpstreamGatewayError:diff --git a/packages/model-runtime/src/errors/match.test.ts b/packages/model-runtime/src/errors/match.test.tsindex 91f37e1cbad..8652e525711 100644--- a/packages/model-runtime/src/errors/match.test.ts+++ b/packages/model-runtime/src/errors/match.test.ts@@ -102,12 +102,20 @@ describe('matchErrorPattern', () => {).toBe(AgentRuntimeErrorType.StateStorePersistError);});- it('classifies a caller-gone blocking-read abort as StateStoreReadError (benign, not a persist failure)', () => {+ it('classifies a caller-gone blocking-read abort as StateStoreReadError', () => {expect(matchErrorPattern({ message: 'ERR caller gone' })?.code).toBe(AgentRuntimeErrorType.StateStoreReadError,);});+ it('classifies a missing-agent-state read as StateStoreReadError', () => {+ expect(+ matchErrorPattern({+ message: 'Agent state not found for operation op_1781276404066_agt_x_tpc_y_z',+ })?.code,+ ).toBe(AgentRuntimeErrorType.StateStoreReadError);+ });+it('classifies harness JS runtime crashes as AgentRuntimeError', () => {for (const message of ['e.trim is not a function',diff --git a/packages/model-runtime/src/errors/patterns.ts b/packages/model-runtime/src/errors/patterns.tsindex b45c9d96557..896200f3aca 100644--- a/packages/model-runtime/src/errors/patterns.ts+++ b/packages/model-runtime/src/errors/patterns.ts@@ -515,15 +515,21 @@ export const ERROR_PATTERNS: ErrorPattern[] = [},// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ- // StateStoreReadError β a blocking state-store READ (XREAD / BLPOP) aborted- // because the caller disconnected. Benign client abandonment; must precede- // StateStorePersistError so the write-side bucket doesn't claim it.+ // StateStoreReadError β a state-store READ failed: either a blocking read+ // (XREAD / BLPOP) aborted because the caller disconnected, or the operation's+ // agent state could not be loaded. Must precede StateStorePersistError so the+ // write-side bucket doesn't claim it.// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ{code: AgentRuntimeErrorType.StateStoreReadError,match: sub('ERR caller gone'),note: 'Upstash aborts the in-flight blocking read (XREAD/BLPOP) when the originating request is already gone.',},+ {+ code: AgentRuntimeErrorType.StateStoreReadError,+ match: sub('Agent state not found for operation'),+ note: 'coordinator.loadAgentState() returned null β the operation state was evicted/cleaned up before this read.',+ },// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ// StateStorePersistError β Redis / Upstash agent-state store (NOT the LLMdiff --git a/packages/model-runtime/src/errors/refine.test.ts b/packages/model-runtime/src/errors/refine.test.tsindex ec63e2b6eae..20d70415a69 100644--- a/packages/model-runtime/src/errors/refine.test.ts+++ b/packages/model-runtime/src/errors/refine.test.ts@@ -39,7 +39,7 @@ describe('refineErrorCode', () => {expect(refineErrorCode({errorType: String(ChatErrorType.InternalServerError),- message: 'Agent state not found for operation op_xxx',+ message: 'some opaque internal failure with no registered pattern',}),).toBeUndefined();});diff --git a/packages/model-runtime/src/errors/specs.ts b/packages/model-runtime/src/errors/specs.tsindex 4d5ca8c6194..e1cf0ad40f2 100644--- a/packages/model-runtime/src/errors/specs.ts+++ b/packages/model-runtime/src/errors/specs.ts@@ -422,13 +422,13 @@ export const ERROR_CODE_SPECS: SpecMap = {code: AgentRuntimeErrorType.StateStoreReadError,numericId: 7007,category: 'stream',- severity: 'warning',+ severity: 'error',attribution: 'system',httpStatus: 500,retryable: false,- countAsFailure: false,+ countAsFailure: true,description:- 'State-store (Redis / Upstash) blocking read (XREAD / BLPOP) aborted because the caller disconnected ("ERR caller gone") β benign client abandonment.',+ 'State-store (Redis / Upstash) read failed: a blocking read (XREAD / BLPOP) aborted because the caller disconnected ("ERR caller gone"), or the operation\'s agent state could not be loaded ("Agent state not found for operation β¦"). System-side β counts as a failure.',},// βββ 8xxx Provider (catch-all) ββββββββββββββββββββββββββββββββββββββββdiff --git a/packages/types/src/agentRuntime.ts b/packages/types/src/agentRuntime.tsindex 10b1198563b..845710a80d6 100644--- a/packages/types/src/agentRuntime.ts+++ b/packages/types/src/agentRuntime.ts@@ -138,12 +138,12 @@ export const AgentRuntimeErrorType = {*/StateStorePersistError: 'StateStorePersistError',/**- * A blocking state-store read (XREAD / BLPOP, e.g. consuming the agent event- * stream or waiting on a tool result) was aborted because the originating- * caller disconnected β Upstash replies "ERR caller gone". Benign client- * abandonment tied to the request lifecycle, not a harness fault; kept- * distinct from the write-side StateStorePersistError so it is not counted- * as a failure.+ * A state-store (Redis / Upstash) READ failed: either a blocking read+ * (XREAD / BLPOP, consuming the agent event stream or waiting on a tool+ * result) was aborted because the caller disconnected ("ERR caller gone"), or+ * the operation's agent state could not be loaded ("Agent state not found for+ * operation β¦"). System-side read failure, kept distinct from the write-side+ * StateStorePersistError; counts as a failure.*/StateStoreReadError: 'StateStoreReadError',/**