feat: improve goal mode and Codex App resilience
This commit is contained in:
@@ -429,6 +429,10 @@ function createCodexAppRuntime(deps = {}) {
|
||||
return safeStringifyPreview(value, 2000, { maxDepth: 3, maxArray: 10, maxKeys: 20 });
|
||||
}
|
||||
|
||||
function isCodexAppReconnectNotice(value) {
|
||||
return /^reconnecting(?:\.\.\.)?\s*\d+\s*\/\s*\d+\s*[.!]?$/i.test(codexAppErrorMessage(value).trim());
|
||||
}
|
||||
|
||||
function sendRuntime(entry, sessionId, payload) {
|
||||
wsSend(entry.ws, { ...payload, sessionId });
|
||||
}
|
||||
@@ -1020,10 +1024,12 @@ function createCodexAppRuntime(deps = {}) {
|
||||
? codexAppErrorMessage(params)
|
||||
: (params.message || params.title || '');
|
||||
if (message) {
|
||||
if (method === 'error') entry.lastError = message;
|
||||
const reconnectNotice = method === 'error' && isCodexAppReconnectNotice(params);
|
||||
if (method === 'error' && !reconnectNotice) entry.lastError = message;
|
||||
if (method === 'error' || shouldShowRuntimeNotice(method, message)) {
|
||||
sendRuntime(entry, sessionId, { type: 'system_message', message });
|
||||
}
|
||||
if (reconnectNotice) return { done: false, transient: true };
|
||||
}
|
||||
return { done: method === 'error' };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user