stamp rotation-created escrows with the gateway protocol version#1454
Merged
DimaOrekhovPS merged 2 commits intoJul 15, 2026
Merged
Conversation
…rsion Escrows minted by the auto-rotator (and depletion replacement) were persisted without a protocol version, which defaults to v1 — so any gateway with rotation enabled drifted back to v1 escrows regardless of the protocol its escrows were registered with. Derive the protocol for rotation-created escrows from the gateway-wide route prefix (DEVSHARD_ROUTE_PREFIX / build version): a gateway serving /devshard/v3 now mints protocol-v3 escrows. The protocol is frozen into the write-ahead commitment record (with a sqlite column migration) so escrows recovered via reconcile keep it. Unparseable route versions fall back to the previous v1-default behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes protocol-version drift for rotation/depletion-created escrows by deriving a protocol version from the gateway route prefix and persisting it in the escrow rotation commitment record so reconcile can recover the correct protocol.
Changes:
- Adds
protocol_versionto theescrow_rotation_commitmentsSQLite table and round-trips it through save/load. - Stamps rotation-created escrows with a derived
ProtocolVersionduring persist and during commitment reconciliation. - Adds tests covering protocol propagation from
DEVSHARD_ROUTE_PREFIXand commitment recovery.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| devshard/cmd/devshardctl/gateway_store.go | Migrates commitments table and persists/loads protocol_version with each write-ahead commitment. |
| devshard/cmd/devshardctl/escrow_rotator.go | Derives a protocol version from the gateway route prefix and carries it through creation, persistence, and reconcile. |
| devshard/cmd/devshardctl/escrow_recovery_test.go | Adds coverage asserting protocol version propagation via direct persist and via commitment recovery. |
Comment on lines
+390
to
+398
| _, version, err := devshardpkg.ResolveRoutePrefix(routePrefix) | ||
| if err != nil { | ||
| return "" | ||
| } | ||
| pv, err := types.ParseProtocolVersion(version) | ||
| if err != nil { | ||
| return "" | ||
| } | ||
| return string(pv) |
Collaborator
There was a problem hiding this comment.
At least logging at warn level should be added if version couldn't be parsed
Warn-log each fallback path in rotationEscrowProtocolVersion instead of silently defaulting, and map semver-like route versions by their major component (v2.1.0 -> v2) so semver-named runtimes still get a protocol stamp. Co-authored-by: Cursor <cursoragent@cursor.com>
DimaOrekhovPS
enabled auto-merge (squash)
July 15, 2026 15:48
a-kuprin
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Escrows minted by the auto-rotator (and depletion replacement) were persisted without a protocol version, which defaults to v1 — so any gateway with rotation enabled drifted back to v1 escrows regardless of the protocol its escrows were registered with.
Derive the protocol for rotation-created escrows from the gateway-wide route prefix (DEVSHARD_ROUTE_PREFIX / build version): a gateway serving /devshard/v3 now mints protocol-v3 escrows. The protocol is frozen into the write-ahead commitment record (with a sqlite column migration) so escrows recovered via reconcile keep it. Unparseable route versions fall back to the previous v1-default behavior.