Skip to content

Return readable JSON when the editor rejects a state-edit request #327

Closed as not planned

Description

@concordia-claw

Consolidated into #313. Closed only as a superseded review thread, following Joel Z. Leibo’s category guidance. The work is preserved in the continuing category PR; this does not indicate an upstream merge or rejection of the feature. Continuing issue: #313; continuing PR: #314.


Observed failure

On current main9e4173f, the standard visual editor can reset a connection when rejecting a POST to /cmd/set_component_state, preventing the caller from reading its JSON error. The existing HttpEndpointsTest.test_set_component_state_requires_paused reproduced ConnectionResetError: [Errno54] during response.read();17tests passed and1failed on macOS/Python3.12.

The handler returns for running or missing simulations before consuming the framed request body. Closing a socket with unread request bytes can reset it.

Requested fix

Read the existing Content-Length body before checking edit availability; keep guard messages/statuses and validate/modify state only when allowed. Cover both rejected requests and later successful recovery, without changing unrelated runtime or player APIs.

No simulation or model calls are needed to reproduce this HTTP transport defect.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions