{"record":{"id":"c2bc73b6ac90e6e0","repo":"coleam00/Archon","slug":"failed-to-list-workflow-events-since-after-toiso","errorCode":null,"errorMessage":"Failed to list workflow events since ${after.toISOString()}: ${(error as Error).message}","messagePattern":"Failed to list workflow events since (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/db/workflow-events.ts","lineNumber":251,"sourceCode":"    let typeClause = '';\n    if (eventTypes && eventTypes.length > 0) {\n      const placeholders = eventTypes.map((_, i) => `$${String(i + 2)}`).join(', ');\n      typeClause = ` AND event_type IN (${placeholders})`;\n      params.push(...eventTypes);\n    }\n    params.push(limit);\n    const limitParam = `$${String(params.length)}`;\n    const result = await pool.query<WorkflowEventRow>(\n      `SELECT * FROM remote_agent_workflow_events\n       WHERE created_at >= $1${typeClause}\n       ORDER BY created_at ASC, COALESCE(event_order, 0) ASC, id ASC\n       LIMIT ${limitParam}`,\n      params\n    );\n    return [...result.rows].map(parseEventRow);\n  } catch (error) {\n    getLog().error({ err: error as Error }, 'db.workflow_events_list_since_failed');\n    throw new Error(\n      `Failed to list workflow events since ${after.toISOString()}: ${(error as Error).message}`\n    );\n  }\n}\n\n/**\n * Return completed node outputs and cumulative usage (tokens AND cost) for a workflow\n * run. Used by the DAG executor to restore state when resuming a failed run.\n * Throws on DB error — caller owns the degradation policy.\n *\n * Both usage axes are summed from `node_completed` and `node_failed` rows, and only\n * from rows that are not marked `data.aggregate`. Failed rows contribute spend but\n * never completed outputs, so their nodes remain eligible for resume.\n *\n * This makes a run's total MONEY BURNED, not the cost of the surviving path — the\n * figure an operator watching a budget wants, and a deliberate change from what the\n * number meant before failed rows were summed (#2654). Three consequences follow, all\n * intended:","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/db/workflow-events.ts#L233-L269","documentation":"Error \"Failed to list workflow events since ${after.toISOString()}: ${(error as Error).message}\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/db/workflow-events.ts:251 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}