merge(dev): resolve latest sync-task conflict for delegated fallback PR
Sync the PR branch with the latest dev branch and resolve the remaining conflict in sync-task.test.ts while preserving both the new upstream poll-recovery coverage and this branch's delegated bootstrap cleanup and isolation coverage. Re-verified the affected delegated fallback suites and typecheck after the merge resolution. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -20,6 +20,32 @@ import {
|
||||
registerDelegatedChildSessionBootstrap,
|
||||
} from "../../shared/delegated-child-session-bootstrap"
|
||||
|
||||
function shouldAttemptPollErrorRecovery(pollError: string): boolean {
|
||||
const trimmed = pollError.trim()
|
||||
|
||||
if (trimmed.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (/\bMessageAbortedError\b/u.test(trimmed)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (/\bDOMException\b/u.test(trimmed) && /\bAbortError\b/u.test(trimmed)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (/\bAbortError\b/u.test(trimmed) && !/\bTask aborted\b/u.test(trimmed)) {
|
||||
return true
|
||||
}
|
||||
|
||||
if (/^the operation was aborted\.?$/iu.test(trimmed)) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
export async function executeSyncTask(
|
||||
args: DelegateTaskArgs,
|
||||
ctx: ToolContextWithMetadata,
|
||||
@@ -225,6 +251,33 @@ export async function executeSyncTask(
|
||||
taskId,
|
||||
}, syncPollTimeoutMs)
|
||||
if (pollError) {
|
||||
if (shouldAttemptPollErrorRecovery(pollError)) {
|
||||
const recoveredResult = await deps.fetchSyncResult(client, activeSessionID, undefined, {
|
||||
strictAbortRecovery: true,
|
||||
})
|
||||
if (recoveredResult.ok) {
|
||||
const duration = formatDuration(startTime)
|
||||
|
||||
const actualModelStr = effectiveCategoryModel
|
||||
? `${effectiveCategoryModel.providerID}/${effectiveCategoryModel.modelID}`
|
||||
: undefined
|
||||
const parentModelStr = parentContext.model
|
||||
? `${parentContext.model.providerID}/${parentContext.model.modelID}`
|
||||
: undefined
|
||||
let modelRoutingNote = ""
|
||||
if (actualModelStr && parentModelStr && actualModelStr !== parentModelStr) {
|
||||
modelRoutingNote = `\n⚠️ Model fallback used: requested ${parentModelStr}, executed ${actualModelStr}`
|
||||
}
|
||||
|
||||
return `Task completed in ${duration}.\n\n---\n\n${recoveredResult.textContent || "(No text output)"}${modelRoutingNote}\n\n${buildTaskMetadataBlock({
|
||||
sessionId: activeSessionID,
|
||||
taskId: activeSessionID,
|
||||
agent: agentToUse,
|
||||
category: args.category,
|
||||
})}`
|
||||
}
|
||||
}
|
||||
|
||||
const nextFallbackModel = shouldRetryError({ message: pollError })
|
||||
? getNextSyncFallbackModel(activeSessionID, fallbackState)
|
||||
: null
|
||||
|
||||
Reference in New Issue
Block a user