Skip to content

Fix malformed-JSON handling and undefined error_message (CAN-290, CAN-291) - #82

Merged
iidsample merged 3 commits into
mainfrom
nickhuo/fix-error-msg-issues
Sep 14, 2026
Merged

iidsample merged 3 commits into
mainfrom
nickhuo/fix-error-msg-issues

Conversation

@nickhuo

@nickhuo nickhuo commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

CAN-290: POST / used to treat broken JSON as if it were empty {} and keep going. That meant the real problem was hidden, and you’d only see a confusing “missing argument” error later in /status.
Now it behaves properly:

  1. Empty body still becomes {} so workflows with only default args keep working
  2. Invalid JSON returns 400 right away with the actual parse error

CAN-291: WriteResult was trying to read an undefined variable called error_message after the result had already been written successfully. That caused a NameError and made the logs say WriteResult failed even though the write actually succeeded.

Now it reads the error from data.get("error", ""), which matches what the callback actually sends

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c4c3111f-e3c0-43e9-a74c-04ade645c9bf

📥 Commits

Reviewing files that changed from the base of the PR and between b5f2787 and 8f4d2a0.

📒 Files selected for processing (1)
  • canyonos_core/controller/deploy.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread canyonos_core/controller/deploy.py Fixed
@nickhuo
nickhuo marked this pull request as ready for review September 9, 2026 22:33
- deploy.py: POST /<workflow> silently coerced a malformed JSON body to
  {} via get_json(force=True, silent=True), dispatching the request
  anyway and surfacing a misleading "missing positional argument"
  error from the workflow function instead of the real parse problem.
  Now rejects a non-empty, invalid/non-object body with 400 and the
  actual JSON decode error; an empty body still defaults to {} for
  all-default-arg workflows.

- local_controller_frontend.py: WriteResult referenced an undefined
  error_message when relaying a result to on_result(), throwing on
  every successful write and logging a misleading "WriteResult failed"
  error after the result had already been persisted. error_message is
  now read from the same "error" field _send_result_callback sends.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nickhuo
nickhuo force-pushed the nickhuo/fix-error-msg-issues branch from ef79a98 to 69e27fe Compare September 9, 2026 22:38
Comment thread canyonos_core/controller/deploy.py Fixed
@nickhuo
nickhuo requested a review from iidsample September 9, 2026 22:40
Comment thread canyonos_core/controller/deploy.py
@iidsample
iidsample merged commit d63405d into main Sep 14, 2026
7 of 8 checks passed
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.

4 participants