Skip to content

fix(clob): fail rejected order submissions - #105

Open
Kewe63 wants to merge 1 commit into
Polymarket:mainfrom
Kewe63:fix/issue-94-order-rejection-exit-status
Open

Kewe63 wants to merge 1 commit into
Polymarket:mainfrom
Kewe63:fix/issue-94-order-rejection-exit-status

Conversation

@Kewe63

@Kewe63 Kewe63 commented Oct 25, 2026 •

Copy link
Copy Markdown

Summary

  • return command failure for rejected single order submissions
  • fail partially rejected batches after preserving every per-order result
  • keep successful single and batch submissions unchanged

Problem

CLOB responses with success: false were printed and then returned as command success. Trading automation could therefore treat rejected orders as accepted.

Approach

Shared response validation now classifies unsuccessful single responses and aggregates batch failures only after output has been rendered. This covers create-order, market-order, and batch posting paths.

Tests

  • focused RED/GREEN unit coverage: 16 passed
  • full suite: 87 unit and 49 integration tests passed
  • loopback E2E: rejected create, market, and batch commands exited 1 with output preserved; successful controls exited 0
  • cargo +1.91.1 fmt --check
  • cargo +1.91.1 clippy --locked --all-targets -- -D warnings

Risk

Low. Response output is unchanged; only process status changes when the server explicitly reports rejection.

Fixes #94


Note

Low Risk
Only CLI exit status changes when the server reports rejection; response printing and successful paths are unchanged.

Overview
CLOB create, market, and batch post commands now exit with failure when the API returns success: false, instead of printing the rejection and still exiting 0.

Shared helpers derive rejection text from error_msg (with an unknown error fallback) and run after existing print helpers so stdout/JSON output is unchanged. Batch failures aggregate every rejected order into one message with singular/plural wording.

Unit tests cover accepted/rejected single orders and full/partial batch rejections.

Reviewed by Cursor Bugbot for commit fc52679. Bugbot is set up for automated code reviews on this repo. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Rejected order submissions exit successfully

1 participant