1. Four Strictly Separated Domain Entities
Legacy social schedulers collapse draft text, channel formatting, queue attempts, and platform results into a single mutable row, hiding retries and making platform failures impossible to reconcile. CopyStage models four distinct domain entities with explicit ownership:
- Editorial Drafts (Source Content & Review State): Tracks
studio_draft,inbox,approved, andrejectedlifecycle states, cited facts, and Quality Gate reports. - Channel Variants (Platform Representation): Stores platform-specific segments, weighted character metrics, and the authoritative
content_fingerprinthash. - Dispatch Tasks (Account Execution Task): Holds target account binding, IANA
scheduled_fortimestamp,authorized_fingerprint, delivery strategy, and active lease state. - Publishing Receipts (Platform Proof): Records immutable publication proof governed by a database check constraint requiring either a verified
tweet_urlor a non-emptyscheduled_readbackconfirmation string.
2. Content Fingerprint & Approval Lock
When a draft is approved and scheduled, the Dispatch Task snapshots the exact text and media IDs alongside authorized_fingerprint. Any subsequent edit in AI Studio recalculates content_fingerprint on the Channel Variant; when a node attempts to claim a task whose variant fingerprint drifted without re-confirmation, dispatch cleanly skips or invalidates the stale snapshot.
3. Fenced Leases & 30-Minute Stale Catch-Up Guard
Node polling and window wakeups operate concurrently across browser profiles. CopyStage protects queue integrity with three mechanisms enforced inside the Dispatch Coordinator and Timezone Slot Planner:
- Monotonic
lease_generationFencing: Claiming a queued task atomically transitions status toleased, incrementslease_generation, sets a 60-second lease window, and writes an idempotent attempt record. All subsequent runner callbacks (sending: 90s lease,awaiting-confirm: 15m lease,receipt,fail) require matchingnodeIdandleaseGeneration. - Pre-Fill
@handleVerification: The runner checks the logged-in X handle in the active tab before filling any field. Mismatches fail safely withidentity_mismatchand never inject copy into an unintended account. - 30-Minute Stale Catch-Up Guard: When a desktop browser wakes up after hours offline, tasks older than 30 minutes past their scheduled slot wait for explicit human reschedule, reflow, or skip choices so offline nodes never burst stale backlogs.
4. Honest sending -> ambiguous Recovery
The hardest failure in social publishing occurs right after clicking Publish or Schedule: if the browser tab closes, the network drops, or the 90-second sending lease expires before a GraphQL response completes, a blind retry risks double-posting the exact same thread.
Zero silent retries after send: Once a task enters sending, any timeout (sending_lease_timeout), tab closure, or uncertain runner error transitions the task to ambiguous. The task stays paused until an operator verifies the live X account and submits a human_reconciled_tweet receipt or explicitly cancels/reschedules.
5. Ephemeral MAIN-World Receipt Verification
To keep page scripts completely isolated during idle browsing and editing, the Chrome MV3 extension executes copy/image injection inside the ISOLATED world with zero web_accessible_resources. Strictly for the brief submission window, chrome.scripting.executeScript({ world: 'MAIN' }) attaches a nonce-verified interceptor listening for X GraphQL CreateTweet and CreateScheduledTweet responses, capturing root_rest_id, canonical tweet_url, native schedule confirmation text, and complete thread_urls_json across multi-segment threads.
queued
├─[node claims with lease_generation++]──────────> leased (60s window)
│ ├─[@handle mismatch / guard / pre-send err]─> failed
│ ├─[semi_auto ready for human click]─────────> awaiting_human_confirm (15m window)
│ └─[submit clicked]──────────────────────────> sending (90s window)
│ ├─[GraphQL CreateScheduledTweet]───────> native_scheduled (+ receipt row)
│ ├─[GraphQL CreateTweet + threadUrls]───> published (+ receipt row)
│ └─[tab closed / timeout / uncertain]───> ambiguous -> human_reconciled_tweet