Repository navigation
fix(world): log swallowed applyWorldCommand errors - #436
Conversation
f994bbf to
f0040ca
Compare
prabu-openclaw
left a comment
There was a problem hiding this comment.
Scope is broader than the title suggests ("log swallowed applyWorldCommand errors"): this also (1) resets this.world/this.meta to null when a preview health-bind isn't admitted, to stop PLAY from reusing a stale in-memory world on the same isolate, and (2) wraps applyCommand in try/catch in the DO's /command handler so uncaught exceptions become a structured COMMAND_FAILED response instead of a 500. Both changes look correct and are well covered by the new enter-command-do.test.ts (which specifically exercises the stale-world-reuse and no-500-on-ENTER scenarios), and the FROZEN_GENESIS_ID inlining matches the current constant value in genesis.ts.
However, the worker CI check is currently failing for real reasons introduced by this PR, not pre-existing noise: test/enter-command-do.test.ts builds PlayerPrincipal objects missing the now-required protocol_version and authentication_context fields (lines 80, 135), which fails typecheck. (test/genesis-successor.test.ts:106 also fails on a missing request_id in CommandEnvelope, but that file isn't touched by this diff, so that one may be pre-existing on main -- worth confirming separately.) The test and llm-agent jobs pass fine since they don't run the strict tsc --noEmit step.
Given the DO-level exception handling and in-memory-state-reset behavior here directly affects world-state consistency, I'd rather a human confirm the fix is complete once the typecheck failure in the new test file is resolved, rather than approve with a known-broken worker build.
COMMAND_FAILED after #435 still has no stack. Log the throw. No reseed.