Skip to content

Bug: logs polling loops forever when deployment status is error #223

@codxbrexx

Description

@codxbrexx

What's happening

The logs poller in src/logs.ts exits only when status becomes ready. If the deployment hits an error state (or any other terminal failure), the loop never breaks and keeps polling every 10 seconds indefinitely — hanging the CLI forever.

Steps to reproduce

  1. Trigger a deployment that fails on the backend and ends in error state.
  2. Watch metacall-deploy — it keeps polling with no exit path.

What you'd expect

The CLI stops as soon as a terminal state (error, etc.) is reached, prints the last available logs, and exits with a non-zero code.

What actually happens

Infinite polling loop, hanging CLI session.

Relevant code in src/logs.ts:

while (status !== 'ready') { // no check for 'error' or other terminal states
    // ...
    await sleep(10000);
}

The fix

Define terminal states and break accordingly:

const TERMINAL_STATES = ['ready', 'error'];

while (!TERMINAL_STATES.includes(status)) {
    // ...
}

if (status === 'error') {
    error('Deployment failed. Check logs above.');
    process.exit(1);
}

Note: Also worth adding a max-retry / timeout fallback as a safety net.

I'm happy to open a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions