Skip to content

fix(zerocode): detect daemon version mismatches#8192

Merged
singlerider merged 1 commit into
zeroclaw-labs:masterfrom
EyrieCommander:codex/fix-zerocode-version-mismatch
Jun 23, 2026
Merged

fix(zerocode): detect daemon version mismatches#8192
singlerider merged 1 commit into
zeroclaw-labs:masterfrom
EyrieCommander:codex/fix-zerocode-version-mismatch

Conversation

@Audacity88

@Audacity88 Audacity88 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Base branch: master
  • What changed and why:
    • Validate the daemon server_version returned by initialize in zerocode local and WSS RPC clients, so mismatched or missing versions fail during connect instead of surfacing later as generic RPC timeouts.
    • Stop the local startup path from treating a version mismatch as an unavailable daemon, so zerocode does not spawn or wait on another daemon when the running daemon is simply from a different build.
    • Format the startup mismatch message through zerocode Fluent catalogs and abort spawned read tasks before returning handshake errors.
  • Scope boundary: This PR does not change the already-running TUI reconnect screen if a daemon changes version after the TUI is open. It also does not change daemon protocol fields, config, or CLI flags.
  • Blast radius: zerocode RPC connect/startup paths for local IPC and WSS, plus zerocode locale catalogs for the new startup error.
  • Linked issue(s): Closes [Bug]: zerocode should detect daemon/TUI version mismatch during connect #8186
  • Labels: bug, risk: medium, size: S, zerocode

Validation Evidence (required)

  • Commands run and tail output:
    • zc-cargo fmt -p zerocode — passed.
    • zc-cargo test -p zerocode — passed: 115 passed in src/lib.rs; 360 passed in src/main.rs; doc-tests ran with 0 tests.
    • git diff --check — passed.
  • Beyond CI — what did you manually verify?
    • Added behavior tests for matching, mismatched, and missing initialize.server_version.
    • Added an i18n formatting assertion for the new argumented Fluent key.
  • If any command was intentionally skipped, why:
    • Workspace clippy and CI-shaped workspace nextest were not run locally. This PR currently has focused zerocode validation; run broad validation before reviewer sign-off if maintainers want full medium-risk local evidence.

Security & Privacy Impact (required)

  • New permissions, capabilities, or file system access scope? No
  • New external network calls? No
  • Secrets / tokens / credentials handling changed? No
  • PII, real identities, or personal data in diff, tests, fixtures, or docs? No
  • If any Yes, describe the risk and mitigation: N/A

Compatibility (required)

  • Backward compatible? Yes
  • Config / env / CLI surface changed? No
  • If No or Yes to either: Matching zerocode/daemon builds behave as before. If users see the new mismatch error, rebuild and restart the daemon from the same checkout as zerocode.

Rollback (required for risk: medium and risk: high)

  • Fast rollback command/path: git revert <merge-commit>
  • Feature flags or config toggles: None
  • Observable failure symptoms: zerocode exits at startup with the version-mismatch message, or fails to connect to a daemon that previously connected.

@Audacity88 Audacity88 added bug Something isn't working size: S Auto size: 81-250 non-doc changed lines. risk: medium Auto risk: src/** or dependency/config changes. zerocode Auto scope: apps/zerocode/** changed. labels Jun 22, 2026
@Audacity88 Audacity88 marked this pull request as ready for review June 22, 2026 21:27
@Audacity88 Audacity88 requested a review from singlerider as a code owner June 22, 2026 21:27

@singlerider singlerider left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I traced both connect paths, the main-loop fallback behavior, and the i18n wiring.

🟢 What looks good: the version mismatch no longer triggers a spurious daemon spawn

The real bug here is that a local-socket connect failure fell straight through to spawn_ephemeral_daemon, so a version-mismatched daemon would get masked by a fresh spawn or a silent retry. Now connect returns a typed DaemonVersionMismatch, and both main's fallback arm and the await_daemon_ready retry loop short-circuit with Err(e) if is_daemon_version_mismatch(&e). The user sees the actionable rebuild message instead of confusing spawn churn. That is the right place to cut the fallback.

🟢 What looks good: read_task is aborted on every failure path

The old code used ? after the initialize request, which would drop out without aborting the spawned read_task. The refactor replaces both the request and the parse with explicit match arms that call read_task.abort() before returning, on both the local and remote connect paths, symmetrically. That closes the task-leak on a failed handshake.

🟢 What looks good: the typed error round-trips cleanly

DaemonVersionMismatch carries the static client version from env!("CARGO_PKG_VERSION") and the server-reported string, and format_startup_error downcasts it to render the localized zc-error-daemon-version-mismatch with both versions interpolated. The error stays typed all the way to the top instead of being flattened into a string early.

🟢 What looks good: locale parity and interpolation are tested

All five locales (en, es, fr, ja, zh-CN) carry the new key, and the i18n test asserts both client_version and server_version placeholders actually interpolate. That guards against a locale that silently drops an argument.

CI green, no outstanding reviews.

@singlerider singlerider merged commit 8a72f16 into zeroclaw-labs:master Jun 23, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working risk: medium Auto risk: src/** or dependency/config changes. size: S Auto size: 81-250 non-doc changed lines. zerocode Auto scope: apps/zerocode/** changed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: zerocode should detect daemon/TUI version mismatch during connect

2 participants