Skip to content

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

Open
nickhuo wants to merge 2 commits into
mainfrom
nickhuo/fix-error-msg-issues
Open

Fix malformed-JSON handling and undefined error_message (CAN-290, CAN-291)#82
nickhuo wants to merge 2 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

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c5c171fc-2b4a-4fc2-8e15-fee3b21f122e


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
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.

3 participants