lean cloud push exits 0 when a project can't be pushed

Open Beginner friendly
#757 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@yutianjiang39 is already working on this.

Since Nov 30, 2026.

  • #790 by @yutianjiang39 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in lean/commands/cloud/push.py and trace how it handles the return value from PushManager.push_projects; the issue says that method already returns False when a push fails. Check the existing tests for lean cloud push, then verify that failed project or library pushes produce a nonzero exit after all requested items are attempted, while retaining the warning messages.

Written by the indexing model from the issue text.

Description

priority:P2

Problem

lean cloud push exits 0 when it could not push a project. It prints a warning such as:

[1/1] Pushing 'Example'
Cannot push 'Example': The project could not be saved as another collaborator 
controls the write permission. Request write permission from your collaborator 
#CbnquaQ7LCY6
Please pull any required changes and push with --force

and then returns success. Scripts and CI that chain commands on its exit status, such as lean cloud push --project Example && lean cloud backtest Example, then backtest the cloud's previous files and report that as a result for the local changes.

#718 made lean cloud backtest/optimize/live deploy --push stop with exit code 1 in this case. That PR intentionally kept lean cloud push itself unchanged, so this is still the behavior in 1.0.234.

Reproduction (1.0.234)

  1. lean create-project Example --language python and lean cloud push --project Example.
  2. Edit main.py in the cloud from another client, such as the web IDE or an MCP client. That client now holds the project's write lock.
  3. Change the local main.py and run lean cloud push --project Example; echo $?.

Observed: the Cannot push warning above, then 0. The cloud file keeps the other client's version.

Expected

When any requested project or library can't be pushed, lean cloud push exits nonzero after it has tried all of them. It keeps the same warnings. PushManager.push_projects already returns False in this case (#718), and lean/commands/cloud/push.py ignores that return value.

This changes the exit status that scripts see for a failed push. That is the reason for the change, but it is still a behavior change for callers.

Dominant language
Python
Stars
335
Forks
172
Avg merge
6h 54m
Merged PRs (30d)
37

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/lean-cli

All issues in QuantConnect/lean-cli

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.