Skip to content

Add beta feature that uses Reprint for pulls - #4430

Open
gcsecsey wants to merge 11 commits into
trunkfrom
gcsecsey/use-pull-reprint-command
Open

Add beta feature that uses Reprint for pulls#4430
gcsecsey wants to merge 11 commits into
trunkfrom
gcsecsey/use-pull-reprint-command

Conversation

@gcsecsey

@gcsecsey gcsecsey commented Aug 4, 2026

Copy link
Copy Markdown
Member

Related issues

How AI was used in this PR

I used Opus 5 to investigate and implement the solution, and GPT 5.6 Sol to do an initial review.

Proposed Changes

Studio can now pull a live site with Reprint instead of Jetpack backups, via a new Reprint pull engine beta feature.

Currently, only the Agentic UI pulls through the CLI. The Classic UI talks to the WordPress.com REST API straight from the renderer, so it and apps/local stay on the Jetpack engine.

Beyond wiring up the flag:

  • pull-reprint now takes --remote-site now instead of --url, accepting a site ID as well as a URL
  • Reprint pulls report an overall percentage, so the Agentic UI’s progress bar advances as expected
  • A pull-reprint run that failed its preflight was exiting 0. Since the desktop resolves the pull on the child’s exit code alone, the Agentic UI showed “Pull complete” earlier. Failures now exit non-zero and display the reason.
  • The STUDIO_ENABLE_PULL_REPRINT env gate is dropped, the beta feature replaces it
  • pull-reprint is listed in studio --help for everyone, including npm installs, for the duration of the beta

--options (a Jetpack Backups abstraction STU-1813 decided not to carry over) and --verbose remain unaligned on purpose.

Testing Instructions

The point is that the engines stay interchangeable, so these steps pull the same site three times, switching the engine in between:

  1. Run Studio with npm start
  2. The beta feature only reaches the pull that goes through the CLI, so enable the Agentic UI in Beta Features → New Studio experience.
  3. Create a local site and connect it to a WordPress.com or Pressable site.
  4. Leave Reprint pull engine unticked (the default) and pull.
  5. Check that the label switches to Pulling from live…, the progress bar advances, and it finishes with a Pull complete toast.
  6. Open the local site and confirm it serves the pulled content.
  7. Change something in the local content, so it's easy to identify remote content later.
  8. Toggle Reprint pull engine on, and do a second pull.
  9. Check that the progress bar climbs steadily to full for the length of the pull, and it ends again on Pull complete with the site serving the pulled content.
  10. Toggle Reprint pull engine off, and do a third pull.
  11. Check that the pull still completes, and the site serves the remote content.

If a Reprint pull dies with cURL error (23): Failed reading the chunked-encoded stream, re-run the same pull, Reprint should resume from its cursor.

Here's how the two engines are reporting the status:

jetpack backups reprint
CleanShot 2026-08-06 at 13 20 37@2x CleanShot 2026-08-06 at 13 22 27@2x

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@gcsecsey gcsecsey changed the title Align pull-reprint's remote source option with pull's --remote-site (STU-1815) Route the Agentic UI pull through pull-reprint behind a beta feature (STU-1815) Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new beta feature that lets the Agentic UI choose between the existing Jetpack-backup–based pull flow and the Reprint streaming pull-reprint flow when pulling a connected site via the CLI, while keeping other surfaces on the Jetpack engine. It also updates pull-reprint to accept --remote-site (URL or WordPress.com site ID), adds overall progress reporting for Reprint pulls, and fixes an engine-switch hang by ensuring the SQLite integration is installed before a Jetpack import on Reprint-pulled sites.

Changes:

  • Add a reprintPull beta feature and route Agentic UI pulls through either pull or pull-reprint based on that flag.
  • Update pull-reprint to use --remote-site (URL or ID) and align source resolution with the shared identifier resolver.
  • Implement monotonic overall percentage reporting for Reprint pulls and ensure SQLite integration is installed to make engine switching reliable.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/common/types/sync.ts Introduces the PullEngine type used to select between Jetpack and Reprint pull engines.
packages/common/sites/sync.ts Adds engine selection to pullSite, switching CLI args between pull and pull-reprint.
packages/common/sites/sync.test.ts Adds coverage for default (Jetpack) and Reprint-engine CLI invocation behavior.
docs/design-docs/cli.md Updates CLI design docs to reflect pull-reprint --remote-site <url-or-id> behavior.
apps/studio/src/stores/beta-features-slice.ts Adds reprintPull to the persisted beta-features Redux state defaults.
apps/studio/src/modules/sync/lib/ipc-handlers.ts Routes Agentic UI pull IPC to pull vs pull-reprint based on the reprintPull beta feature.
apps/studio/src/modules/site-settings/tests/edit-site-details.test.tsx Updates test preloaded beta-features state shape to include reprintPull.
apps/studio/src/lib/beta-features.ts Defines the new reprintPull beta feature (label, description, default).
apps/studio/src/ipc-types.d.ts Extends the BetaFeatures type to include reprintPull.
apps/studio/src/components/tests/remote-session-indicator.test.tsx Updates beta-features hook mocks to include reprintPull.
apps/studio/src/components/tests/content-tab-settings.test.tsx Updates test store beta-features state to include reprintPull.
apps/cli/lib/pull/pull-progress.ts Adds Reprint overall-progress banding and (N%) token formatting helpers.
apps/cli/lib/pull/pull-progress.test.ts Tests the overall-percent mapping and token formatting behavior.
apps/cli/lib/pull/migration-client.ts Enhances progress reporting callbacks with per-step fractions (via snapshotFraction).
apps/cli/lib/pull/migration-client.test.ts Adds unit tests for snapshotFraction derivation and fallback behavior.
apps/cli/index.ts Registers pull-reprint unconditionally (removes the env-gate).
apps/cli/commands/tests/pull-reprint.test.ts Updates tests for --remote-site and identifier-based source resolution.
apps/cli/commands/pull.ts Ensures SQLite integration is installed for Reprint-imported sites before Jetpack import.
apps/cli/commands/pull-reprint.ts Switches to --remote-site, uses shared identifier resolution, and emits overall pull percentages.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…print-command

# Conflicts:
#	apps/cli/lib/import-export/import/importers/importer.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated no new comments.

Suppressed comments (1)

apps/cli/commands/pull-reprint.ts:1298

  • The comment here says the helper throws when several sites share the hostname, but findSyncSiteByIdentifier matches on normalizeHostname(...) (scheme stripped + trailing slash trimmed) and only throws on multiple matches of that normalized identifier. Updating the comment avoids misleading future changes (e.g. thinking it matches host-only).
		// Throws when nothing matches, when several sites share the hostname,
		// or when the match isn't syncable.

@gcsecsey gcsecsey changed the title Route the Agentic UI pull through pull-reprint behind a beta feature (STU-1815) Add beta feature that uses Reprint for pulls Aug 6, 2026
@gcsecsey
gcsecsey requested review from a team and fredrikekelund August 6, 2026 12:30
@gcsecsey
gcsecsey marked this pull request as ready for review August 6, 2026 12:30
@gavande1

gavande1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Thank you for working on this @gcsecsey. It works as expected in my testing, and I have one question.

What happens if a pull-reprint run fails partway through, and how does the UI reflect it? I think the selection sidecar would survive, since it is only cleared on the success path at pull-reprint.ts#L568 while applySelection returns the persisted value at pull-reprint.ts#L670 before it checks the CLI flags or the non-TTY branch. That would mean an interrupted --only run silently scopes the next Agentic UI pull of that site, which still reports a full pull.

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gcsecsey , the PR looks great. I tested it in the Agentic UI and worked well. Around 2 minutes to pull my remote site.

This change only affects when pulling from the desktop app right? If so, then we set that expectation in the beta feature description.

pull-with-reprint.mp4

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gcsecsey , I don't have all the context about Reprint and I'm not sure if it's a known issue, but I found that pulling a site it makes the existing site to have symlinks to the folder ~/.studio/pulls/.....

Image

I also found that mu-plugins/sqlite-database-integration is gone and the site cannot open phpMyAdmin, although the site runs correctly 🤔 .

Image Screenshot 2026-08-07 at 13 50 16

@gavande1

gavande1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

also found that mu-plugins/sqlite-database-integration is gone and the site cannot open phpMyAdmin, although the site runs correctly 🤔 .

Maybe this is same issue as STU-2056 or related to WordPress/reprint#334.

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.

4 participants