Skip to content

fix: Empty catch blocks in orchestrator silently swallow cleanup errors #29

Description

@nigel-dev

Description

The orchestrator has two empty `catch {}` blocks that silently swallow errors during cleanup and cancellation operations. While the intent is to continue cleanup even if one step fails, completely swallowing errors makes it impossible to diagnose why cleanup sometimes leaves stale resources.

Locations

1. Job launch cleanup (`orchestrator.ts:734`)

```typescript
} catch {} // tmux session/window cleanup on launch failure
```
When a job launch fails partway, the cleanup of the tmux session/window silently swallows any error.

2. Plan cancellation loop (`orchestrator.ts:823`)

```typescript
} catch {} // per-job cleanup during plan cancel
```
When cancelling a plan, each job's cleanup error is silently dropped.

Expected Behavior

Errors during cleanup should be logged (not thrown) so operators can diagnose stale resource issues:

```typescript
} catch (err) {
console.warn(`[MC] Cleanup warning for job ${job.name}:`, err);
}
```

Proposed Fix

Replace both empty `catch {}` blocks with `catch (err) { console.warn(...) }`. This is the same pattern already used elsewhere in the codebase (e.g., state transition validators use `console.warn`).

Files Involved

  • `src/lib/orchestrator.ts:734` — launch cleanup
  • `src/lib/orchestrator.ts:823` — cancel cleanup

Additional Context

This is a good first issue — two-line change, clear pattern to follow, and teaches the orchestrator cleanup flow. The `CONTRIBUTING.md` code style guide explicitly states: "Avoid explicit `any` types" — empty catch blocks are the error-handling equivalent of the same anti-pattern.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: lowNice to have — polish, cleanup, or long-termbugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions