Skip to content

fix(cli): align update protocol identity with the installed binary - #1799

Closed
ScriptedAlchemy wants to merge 5 commits into
masterfrom
cursor/align-update-protocol-identity-817e
Closed

ScriptedAlchemy wants to merge 5 commits into
masterfrom
cursor/align-update-protocol-identity-817e

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • tracedecay update on the GitHub-release path now reports the installed binary's --version as the maintenance window's protocol identity.
  • That string is what the daemon advertises ({release}+{sha}). Readiness still compares it exactly, so a bare release tag is no longer stored as expected_version.
  • An unreadable binary stays unversioned. Restore fails closed instead of substituting the tag.

Motivation

tracedecay update installed v0.1.0-beta.47, restarted the daemon, and refused the binary it had just started:

protocol identity mismatch (name=tracedecay,
version=0.1.0-beta.47+84598a0b..., expected version=0.1.0-beta.47)

The daemon also logged daemon_version_skew on every readiness poll. Both strings came from one binary.

The only actor that assigned the mismatch is run_versioned_upgrade. It stored the GitHub release tag. The package-manager path already asks the linked binary for --version, and the daemon advertises build_version(), which is that release plus +<sha>. Readiness and the handshake compare those strings with exact equality, which is what distinguishes two checkout builds of one release.

#1797 loosens that comparison so a missing commit is "less specific, not different." That papers over the update path still emitting a different identity, and it would treat a stale +sha daemon as ready whenever the expected version is the bare tag. This PR does not absorb that comparison. The release tag stays the operator-facing version; the protocol identity is the binary's own advertisement.

Changes

  • crates/tracedecay-cli/src/upgrade.rs: direct installs report installed_protocol_identity (the binary's --version) instead of the release tag.
  • crates/tracedecay-daemon-control/src/service/update_restore_tests.rs: readiness accepts that advertised build and still rejects the bare tag.

Test plan

  • cargo nextest run --workspace --no-fail-fast passes
  • cargo clippy has no new warnings
  • Focused local proof:
    • upgrade::tests::version_probe — 6 passed, including a_direct_install_reports_the_binary_identity_not_the_release_tag (a binary that prints tracedecay 0.1.0-beta.47+84598a0b… is the reported identity; a missing binary is None, not the tag)
    • service::update_restore_tests — 2 passed. The answering daemon is Ready against 0.1.0-beta.47+84598a0b… and IdentityMismatch against bare 0.1.0-beta.47.

Checklist

  • CHANGELOG.md updated (under [Unreleased] if no version bump)
  • No secrets, credentials, or .env files included
  • Breaking changes documented (if any)

Changelog is release-please generated; this commit does not hand-edit it.

Dispatch SHA: eb545b4e5b93f2e39a5924aebb41b0e7c2bde6b0

Open in Web Open in Cursor 

The GitHub upgrade path stored the release tag as the maintenance
window's expected version. The daemon advertises build_version(),
which is that release plus +sha, and readiness compares the two
exactly, so update refused the binary it had just installed.

Ask the published binary for --version, the same identity the
package-manager path already reports. An unreadable binary stays
unversioned instead of substituting the tag.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@changeset-bot

changeset-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cf89ba4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 19, 2026 06:31
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 19, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-19T06:35:34.446600Z eb545b4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb545b4e5b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// daemon advertises `{release}+{sha}`, and readiness compares those
// strings exactly, so the window must expect the binary's own
// identity rather than `latest`.
version: installed_protocol_identity(binary.as_deref()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject binaries that do not match the downloaded release

When a release asset is accidentally built from a different version than its tag—for example, the v1.2.4 archive contains a stale 1.2.3+sha binary—this now adopts 1.2.3+sha as the expected identity, so the restarted daemon is accepted even though the command reports a successful upgrade to v1.2.4. Previously the bare latest value caused readiness to expose this packaging mismatch. Validate that the self-reported identity's release component equals latest before accepting its build metadata, preserving the binding between hosted release provenance and installed bytes.

AGENTS.md reference: AGENTS.md:L135-L140

Useful? React with 👍 / 👎.

ScriptedAlchemy and others added 4 commits September 19, 2026 08:29
This PR's restore_readiness_accepts_the_advertised_build_and_rejects_its_release_tag asserted DaemonProtocolState::IdentityMismatch when a daemon advertising 0.1.0-beta.47+<sha> is probed against the bare release 0.1.0-beta.47.

Master 5e03dfa landed versions_name_same_build and makes exactly that pair Ready, with probe.rs a_daemon_naming_its_commit_is_ready_against_its_bare_release pinning it. After merging master the test failed (left: Ready, right: IdentityMismatch).

Its other half, Ready against an exactly equal build, is already covered by that probe.rs module, so the file returns to master's version rather than being rewritten.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The new installed_protocol_identity and the UpgradeOutcome::Installed version field justified themselves with "readiness compares those strings exactly". Master 5e03dfa replaced that raw == with versions_name_same_build, so the stated reason no longer describes the code.

The change itself is still right, for the opposite reason: because build metadata a side omits is ignored, a bare release tag as expected_version matches EVERY build of that release and silently disables the same-release different-commit skew detection 367a44a added. Reporting the installed binary's own identity keeps the window pinned to one build.

Comments only; no behavior change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Master run 35431539771 failed Check formatting (projector.rs, query.rs) and
Clippy (items_after_test_module in query.rs) after #1844/#1845 merged
without CI.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Review lane result: MERGE-AFTER-FIX on its own, but this PR, #1799 and #1809 implement the same one-line producer fix in run_versioned_upgrade (probe the installed binary's --version instead of reporting the release tag). Exactly one can land; #1822 is being taken because it also removes the duplicated probe in run_delegated_upgrade. This PR will be closed as superseded once #1822 merges via integration batch #1848. Thanks for the fix; the reasoning in the body was correct.

@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Closing per Session Miner: update-identity already on master via #1797.

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.

2 participants