Skip to content

Publish Autopilot pages conditionally through native WordPress - #25

Merged
henry-mosh merged 8 commits into
mainfrom
codex/autopilot-native-publish
Dec 4, 2026
Merged

henry-mosh merged 8 commits into
mainfrom
codex/autopilot-native-publish

Conversation

@henry-mosh

@henry-mosh henry-mosh commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Autopilot can request a live native WordPress Page through the existing signed content endpoint, observe the original post after a lost reply, promote its own site-held draft, and undo the revision it owns. WordPress enforces its current Maximum status and content-push consent. Manual edits, including identical-content saves, invalidate Autopilot ownership.

The optional protocol includes revision evidence in public Page rendering and status reports. Conditional writes serialize with editor and legacy writes.

Verified with three Composer test configurations (547 cases each, with configuration-specific skips), PHP lint, PHPCS, and a disposable WordPress site. The signed endpoint created a capped draft, deduplicated a replay, promoted the same Page ID, served its permalink anonymously with the expected contents and revision, and returned the Page to Draft on undo.

This prepares the plugin for the coordinated CiteCue app change. Plugin distribution is a separate release step.

Managed SEO tags retain their operation and revision when the plugin fills a missing tag. The application checks that proof before recording public delivery. Companion application PR.

henry-idingo and others added 8 commits December 3, 2026 22:12
A rollback flushed the whole object cache even when the command never
wrote a row. command_conflict, operation_conflict, revision_conflict,
publication_absent and the rest are decided on reads alone, and they are
ordinary outcomes of the protocol — a lost reply, a stale revision. On a
site with a persistent object cache each one emptied the cache for the
whole site, so a client retrying a conflict charged the site again every
time. The flush now happens only once a command has begun writing, which
is the only way the cache can hold a row the rollback took away.

An observation took the external-ID lock, probed three tables for their
storage engine, opened a transaction, took the settings row in shared
mode and the page row FOR UPDATE. A read-only poll could therefore be
refused with transactional_storage_required, and it blocked an editor's
save until it committed. It now holds the external-ID lock alone, and
still reads consent from the row rather than the cache, so a revoked
push cannot be observed through a stale one.

Uninstall left behind every command receipt, operation binding and
revision token — three rows per command, for the life of the install —
and the ownership record on each page. Nothing prunes them while the
plugin lives, on purpose, so uninstall is the only place they can go.
The pages themselves still belong to the site.

The protocol doc's error list now names every code the endpoint returns;
five were missing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Some databases refuse GET_LOCK on every call; a strict Galera cluster is
one. The plugin read a refusal as "another publish is running", so on such
a host every ordinary push answered 503 and every owner save of a managed
page died with "please retry the save", for good.

A held lock and an unavailable one are now separate answers. Ordinary
pushes and owner saves stop only while another writer really holds the
lock, and otherwise go ahead as they did before the lock existed, still
revoking ownership. Conditional commands keep requiring the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… cache

Two creates for one operation that named different external IDs took
different locks, and add_option() overwrites a row it did not expect, so
the second could replace the first one's binding and strand a published
page. Writes now queue on the operation ID as well. Receipts, bindings and
revision tokens are read from their rows and inserted without overwriting.

With a persistent object cache, the new page and its revision were in the
shared cache before the commit, and an old copy cached just before it
could outlive it. Reads inside the transaction are no longer added to the
cache, and the page's caches are purged again once it has committed.

Also:
- An observation no longer fires the hook page caches purge on.
- A command whose ownership record cannot be stored rolls back instead of
  answering that CiteCue owns the page.
- Status reports use the same ownership test as observations and the public
  marker, so a status change that skips the save hooks reads the same.
- A present force field and a null action get the documented 400.

A new test renders the marker through a block template. It passed without
a change, on WordPress 5.9 as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version strings, changelog and upgrade notice. The External services section
now names the ids a status report carries for a page Autopilot published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@henry-mosh
henry-mosh merged commit d11362b into main Dec 4, 2026
8 checks passed
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.

1 participant