fix(cli): surface swallowed errors in locks module#247
Open
Conversation
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
CLI/src/core/locks.tshad three silentcatch {}blocks where errors were swallowed with no log output:acquireLock— corrupt lock unlink failure: The outercatchlogged "Removing corrupted lock file" but if the subsequentfs.unlinkSyncalso failed, the innercatch {}was completely silent. A lock that can't be removed stays in place and blocks future runs with no explanation.releaseLock— all errors: The entiretryblock was wrapped incatch { // Ignore errors during cleanup }. If the lock file is corrupted at release time, the lock is never removed and the next run will either block or have to force-release it — with no log entry to explain why.getLockInfo— read/parse errors:catch { // Ignore }made a corrupted lock file returnnull, indistinguishable from "no lock exists". Callers can't tell the difference.Fix
Replace each
catch {}/catch { // Ignore }withcatch (err) { logger.warn(...) }so the error surfaces in the run log. No functional change when things work correctly.Why
Silent failures in the locking layer lead to ghost locks and hard-to-diagnose "pipeline won't start" situations. With a warn log, a developer or the user can see what actually went wrong.
🤖 Generated with Claude Code