mirror of
https://github.com/cocoindex-io/cocoindex-code.git
synced 2026-09-14 16:39:38 +08:00
fd99851cd5
Fixes #237. Upgrading 0.2.37 → 0.2.38 bricked every ccc command with "ValidationError: Object missing required field `pid`": 0.2.38 added a required `pid` field to HandshakeResponse, so the reply of a still-running pre-upgrade daemon no longer decoded — before the client could see the `ok=False` version mismatch and restart it. The same uncaught error also broke `ccc daemon stop`, the recovery path. Three layers: - `HandshakeResponse.pid` gets a default (None), with a comment stating the wire-compat rule: handshake fields added after a release must have defaults, since the handshake is the one message exchanged between mismatched versions. - An undecodable handshake reply now raises `DaemonProtocolError` instead of escaping as a raw decode error; `_connect_and_handshake` treats it like a version mismatch (restart on first contact, fail fast once a matching daemon was ensured). This protects against any future wire drift, not just this field. - `stop_daemon` tolerates the decode failure and falls through to its SIGTERM/SIGKILL escalation, so `ccc daemon stop` always works. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>