* Mark a pending evolution run as rejected (state-only, no git rollback). * @param {string} statePath - Path to evolution_solidify_state.json * @returns {boolean} true if a pending run was found and rejected
(statePath)
| 356 | * @returns {boolean} true if a pending run was found and rejected |
| 357 | */ |
| 358 | function rejectPendingRun(statePath) { |
| 359 | try { |
| 360 | const state = readJsonSafe(statePath); |
| 361 | if (state && state.last_run && state.last_run.run_id) { |
| 362 | state.last_solidify = { |
| 363 | run_id: state.last_run.run_id, |
| 364 | rejected: true, |
| 365 | reason: 'loop_bridge_disabled_autoreject_no_rollback', |
| 366 | timestamp: new Date().toISOString(), |
| 367 | }; |
| 368 | const tmp = `${statePath}.tmp`; |
| 369 | fs.writeFileSync(tmp, JSON.stringify(state, null, 2) + '\n', 'utf8'); |
| 370 | fs.renameSync(tmp, statePath); |
| 371 | return true; |
| 372 | } |
| 373 | } catch (e) { |
| 374 | console.warn('[Loop] Failed to clear pending run state: ' + (e.message || e)); |
| 375 | } |
| 376 | |
| 377 | return false; |
| 378 | } |
| 379 | |
| 380 | function isPendingSolidify(state) { |
| 381 | const lastRun = state && state.last_run ? state.last_run : null; |
no test coverage detected