Skip to content

awaitPendingManagerWork silently swallows all errors from pending sync/provider init on close #96766

Description

@LK-BLOG

Summary

In manager-BeivTKDc.js, the awaitPendingManagerWork function is called during session/manager close() to await in-flight memory sync and provider initialization. It silently discards all errors from both operations with empty catch {} blocks — no logging, no diagnostic, no fallback.

Code

async function awaitPendingManagerWork(params) {
    if (params.pendingSync) try {
        await params.pendingSync;
    } catch {}                          // silent swallow
    if (params.pendingProviderInit) try {
        await params.pendingProviderInit;
    } catch {}                          // silent swallow
}

Impact

If a memory sync fails during close (SQLite locking, disk full, filesystem error) or provider init fails, the failure is completely invisible. This can cause silent data loss of memory/index changes on shutdown.

Evidence of inconsistency

The adjacent code on the same file (around lines 460-464) for a similar operation uses params.onError(err) to log errors, confirming these empty catches are not a deliberate design choice for this specific function.

Suggested fix

At minimum, log the error. For example:

async function awaitPendingManagerWork(params) {
    if (params.pendingSync) try {
        await params.pendingSync;
    } catch (err) {
        params.onError?.(err);
    }
    if (params.pendingProviderInit) try {
        await params.pendingProviderInit;
    } catch (err) {
        params.onError?.(err);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:data-lossCan lose, corrupt, or silently drop user/session/config data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automation

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions