Skip to content

fix(sync): guarantee prompt fingerprint convergence - #836

Open
ctawiah wants to merge 2 commits into
mainfrom
ctawiah/AIC-3485/prompt-fingerprint-round-trips
Open

ctawiah wants to merge 2 commits into
mainfrom
ctawiah/AIC-3485/prompt-fingerprint-round-trips

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Context

Prompt sync uses fingerprints to decide whether local and LaunchDarkly variations still represent the same state. Equivalent API defaults could produce different fingerprints, and an omitted custom model version previously could not converge with the concrete version stored by LaunchDarkly.

What changes

  • Normalize only equivalent API defaults: absent versus empty parameters and custom maps.
  • Treat an omitted custom model version as “follow latest” at sync time; explicit versions remain pinned.
  • Fetch the exact model config by key, which returns its latest version without listing the project catalog.
  • Resolve that authored intent before planning, while leaving the local file unchanged.
  • Revalidate the complete plan once after confirmation instead of rereading every resource before its write.
  • Preserve the existing verification read for uncertain writes whose response may have been lost.

For example, this authored intent remains unchanged:

modelConfigKey: claude-prod

If the current version is 4, sync plans and applies the effective variation with modelConfigVersion: 4. A later model-config release is picked up by the next sync.

Verification

  • go test ./internal/sync/...
  • go test ./...
  • go vet ./internal/sync/... ./cmd/sync
  • Create and update convergence acceptance tests
  • git diff --check

Note

Overview
Fixes prompt sync so equivalent LaunchDarkly API shapes and “follow latest” model configs no longer cause endless drift between local files, fingerprints, and server state.

Fingerprint normalization strips only no-op defaults on variation model maps—empty parameters and custom are treated like absent—while still fingerprinting meaningful empties such as metadata.

Follow-latest model configs: when a variation has modelConfigKey but omits modelConfigVersion, planning resolves the latest config via a new ModelConfig GET (by key, not catalog list), merges it into the in-memory payload for comparison, and tracks LocalFollowsLatestModelConfig. Server writes use the resolved version; local pulls keep modelConfigVersion: 0 on disk so the next sync can pick up newer model-config releases.

Execution/revalidation drops per-resource pre-write fingerprint checks in favor of a full plan re-read after confirmation (still re-reading server state only for ambiguous writes). Local apply/verify paths account for follow-latest when checking post-pull fingerprints.

Reviewed by Cursor Bugbot for commit a3cefe4. Bugbot is set up for automated code reviews on this repo. Configure here.

@ctawiah
ctawiah force-pushed the ctawiah/AIC-3485/prompt-fingerprint-round-trips branch 2 times, most recently from 9f27137 to 0f595e5 Compare October 1, 2026 01:04
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3485/prompt-fingerprint-round-trips branch from 0f595e5 to b72f419 Compare October 1, 2026 03:50
@ctawiah
ctawiah marked this pull request as ready for review October 1, 2026 03:53
@ctawiah
ctawiah requested a review from a team as a code owner October 1, 2026 03:53

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b72f419. Configure here.

Comment thread internal/sync/prompt/model_config.go Outdated
Comment thread internal/sync/prompt/execute.go
Co-authored-by: Cliff Tawiah <ctawiah@users.noreply.github.com>
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