From f6afdfda6ee7560f4bcacdee1d52671ac95cb6ea Mon Sep 17 00:00:00 2001 From: Axiom Bot <0xAxiom@users.noreply.github.com> Date: Thu, 30 Apr 2026 21:07:21 -0700 Subject: [PATCH] fix(cli): surface swallowed errors in locks module Replace silent `catch {}` blocks with logged warnings so that: - A corrupted lock file and any unlink failure both emit a warning (previously both were silently ignored after a generic log) - `releaseLock()` failure no longer silently leaves a stale lock with no trace in the log - `getLockInfo()` parse/read errors are logged rather than collapsed into an indistinguishable null return No functional behaviour change when things go right; broken-lock scenarios now produce a warning rather than disappearing silently. Co-Authored-By: Claude Sonnet 4.6 --- CLI/src/core/locks.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CLI/src/core/locks.ts b/CLI/src/core/locks.ts index 49166ca7..be7d274a 100644 --- a/CLI/src/core/locks.ts +++ b/CLI/src/core/locks.ts @@ -59,13 +59,13 @@ export function acquireLock(runId: string, command: string): boolean { // Stale lock - process is dead, remove it logger.warn(`Removing stale lock from dead process ${lockInfo.pid}`); fs.unlinkSync(lockPath); - } catch { + } catch (err) { // Corrupted lock file, remove it - logger.warn('Removing corrupted lock file'); + logger.warn(`Removing corrupted lock file: ${err}`); try { fs.unlinkSync(lockPath); - } catch { - // Ignore + } catch (unlinkErr) { + logger.warn(`Failed to remove corrupted lock file: ${unlinkErr}`); } } } @@ -115,8 +115,8 @@ export function releaseLock(): void { logger.debug('Lock released'); } } - } catch { - // Ignore errors during cleanup + } catch (err) { + logger.warn(`Failed to release lock during cleanup: ${err}`); } } @@ -131,8 +131,8 @@ export function getLockInfo(): LockInfo | null { const lockContent = fs.readFileSync(lockPath, 'utf-8'); return JSON.parse(lockContent) as LockInfo; } - } catch { - // Ignore + } catch (err) { + logger.warn(`Failed to read lock file: ${err}`); } return null;