Skip to content

feat(sync): orchestrate prompt synchronization - #820

Merged
ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3448/prompt-sync-orchestration
Sep 29, 2026
Merged

ctawiah merged 1 commit into
mainfrom
ctawiah/AIC-3448/prompt-sync-orchestration

Conversation

@ctawiah

@ctawiah ctawiah commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Context

The reconciliation engine produces individual actions, but a complete sync run still needs review, conflict handling, revalidation, and watch behavior. This layer provides that internal orchestration without adding the Cobra command.

What changes

  • Reviews and confirms plans before execution.
  • Resolves conflicts with LaunchDarkly, local, or abort choices.
  • Rebuilds the plan after review so stale decisions cannot be applied.
  • Uses fsnotify to watch wrappers and referenced files without an initial sync.
  • Debounces file bursts and refreshes an open conflict prompt when sources change.
  • Routes command, conflict, result, and watch messages through the shared console writer.

Review focus

  • Are interactive and non-interactive paths explicit and safe?
  • Does revalidation prevent writes from stale plans?
  • Does watch mode handle editor atomic writes and continue after individual failures?

Verification

  • go test ./internal/sync/...
  • go test -race ./internal/sync/...
  • git diff --check

Related changes

Review the stack in this order:

  1. Sync foundations
  2. Prompt reference workspaces
  3. Prompt sync manifests
  4. Local prompt workspaces
  5. Bootstrap prompt workspaces
  6. Link and detach prompt resources
  7. Prompt reconciliation
  8. Prompt sync orchestration
  9. Prompt sync command

Note

Overview
Adds internal/sync/prompt orchestration for Git-backed prompt sync: a Runner wires bootstrap, link, detach, dry-run, and the full plan → conflict → review → revalidate → execute path.

Interactive flows show per-conflict diffs and prompt for LaunchDarkly, local, or abort; conflicts still require a TTY even with --yes. After review, local/server state is re-read and fingerprint-compared so writes use fresh data; conflict choices are applied on the reloaded plan, not the reviewed copy.

--watch uses direct fsnotify dependency: debounced watches on .launchdarkly and referenced files, content snapshots to ignore duplicate editor events, no sync until the first real change, and automatic plan refresh when sources change during sync or an open conflict prompt.

Interactive forms gain context cancellation via SelectContext / RunFormContext (RunWithContext, alt-screen removed) so watch mode can interrupt huh prompts.

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

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

Stale Bugbot comment from a previous run.

Comment thread internal/sync/prompt/watch.go Outdated
Comment thread internal/sync/prompt/watch.go
Comment thread internal/sync/prompt/watch.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from 754b2e0 to 89f2262 Compare September 25, 2026 15:31

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

Stale Bugbot comment from a previous run.

Comment thread internal/sync/prompt/conflict.go
Comment thread internal/sync/prompt/runner.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from 89f2262 to c234918 Compare September 25, 2026 16:00
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from c234918 to 070a54e Compare September 25, 2026 16:08
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from 070a54e to 16d6998 Compare September 25, 2026 16:11
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch 2 times, most recently from 60c617c to 527eff0 Compare September 28, 2026 21:38
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from 527eff0 to 21ff59e Compare September 28, 2026 21:44

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

Stale Bugbot comment from a previous run.

Comment thread internal/sync/prompt/watch.go
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch 3 times, most recently from bbeea91 to 501947b Compare September 29, 2026 00:04
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch 2 times, most recently from 4fe2b1a to 9d729d3 Compare September 29, 2026 00:17
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from 9d729d3 to 91636c3 Compare September 29, 2026 00:24
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch 4 times, most recently from 1109bb2 to d4c6aaf Compare September 29, 2026 00:45
Base automatically changed from ctawiah/AIC-3446/prompt-reconciliation to main September 29, 2026 00:49
@ctawiah
ctawiah force-pushed the ctawiah/AIC-3448/prompt-sync-orchestration branch from d4c6aaf to d712ac0 Compare September 29, 2026 00:49
@ctawiah
ctawiah merged commit dfbfa1b into main Sep 29, 2026
10 checks passed
@ctawiah
ctawiah deleted the ctawiah/AIC-3448/prompt-sync-orchestration branch September 29, 2026 00: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 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit d712ac0. Configure here.

return err == nil && filepath.Dir(relative) != "."
}
}
return false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Directory rename drops watch set

Medium Severity

Rename or Remove on a managed directory unregisters that subtree, but relevant ignores those events unless the path is an already-tracked file. When the platform does not also emit per-file events or a Create for the new path, watch stops seeing that tree until some later unrelated sync calls Refresh.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d712ac0. Configure here.

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