{"record":{"id":"c41570278d21701b","repo":"toeverything/AFFiNE","slug":"frontend-timeout","errorCode":"FRONTEND_TIMEOUT","errorMessage":"The focused editor did not respond before the deadline.","messagePattern":"The focused editor did not respond before the deadline\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend/server/src/plugins/copilot/delegated/service.ts","lineNumber":156,"sourceCode":"      });\n    });\n    this.publisher.publish(\n      'copilot.delegated.tool.requested',\n      { clientId: lease.clientId },\n      { type: 'request', ...identity, tool, args, deadlineAt },\n      { room: realtimeUserRoom(lease.userId, `copilot:${lease.clientId}`) }\n    );\n\n    let reason: 'aborted' | 'timeout' | undefined;\n    let timeout: ReturnType<typeof setTimeout> | undefined;\n    let abort: (() => void) | undefined;\n    const interrupted = new Promise<DelegatedToolResponse>(resolve => {\n      timeout = setTimeout(() => {\n        reason = 'timeout';\n        resolve({\n          ...identity,\n          error: {\n            code: 'FRONTEND_TIMEOUT',\n            message: 'The focused editor did not respond before the deadline.',\n            retryable: true,\n          },\n        });\n      }, TOOL_TIMEOUT_MS);\n      timeout.unref?.();\n      abort = () => {\n        reason = 'aborted';\n        resolve({\n          ...identity,\n          error: {\n            code: 'ABORTED',\n            message: 'The delegated read was cancelled.',\n            retryable: false,\n          },\n        });\n      };\n      if (signal?.aborted) {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/copilot/delegated/service.ts#L138-L174","documentation":"The published delegated tool request was not answered by the focused editor within TOOL_TIMEOUT_MS; the timeout timer resolves the interrupted promise with a FRONTEND_TIMEOUT structured error so execute() returns a retryable failure to the model rather than hanging.","triggerScenarios":"Returned as FRONTEND_TIMEOUT when the delegated request is published but the focused editor does not answer within TOOL_TIMEOUT_MS.","commonSituations":"The client was busy, asleep, or on a slow connection when the copilot requested a delegated read. Retry the action once the editor is responsive.","solutions":["Retry the delegated read; reduce the requested range if the editor is slow.","Check the focused editor is responsive."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}