Repository navigation
Keep a built document in sync with its pull requests (LIVE_BUILD) - #452
Open
MaggieAppleton wants to merge 13 commits into
Open
MaggieAppleton wants to merge 13 commits into
MaggieAppleton wants to merge 13 commits into
Conversation
MaggieAppleton
added this pull request to stack #455
October 10, 2026 11:10
MaggieAppleton
marked this pull request as ready for review
October 10, 2026 12:28
MaggieAppleton
force-pushed
the
run-on-clicker
branch
from
October 10, 2026 13:20
eb22aa5 to
84fb97c
Compare
MaggieAppleton
force-pushed
the
living-sync-loop
branch
2 times, most recently
from
October 10, 2026 17:04
aa6b31a to
d5fb1ad
Compare
MaggieAppleton
force-pushed
the
run-on-clicker
branch
from
October 10, 2026 19:44
25622da to
b2a8b19
Compare
MaggieAppleton
force-pushed
the
living-sync-loop
branch
from
October 10, 2026 19:44
d1ce9b7 to
40e3a7f
Compare
MaggieAppleton
removed this pull request from stack #455
October 12, 2026 10:23
MaggieAppleton
force-pushed
the
living-sync-loop
branch
from
October 12, 2026 10:31
31fcf10 to
7f681ac
Compare
MaggieAppleton
force-pushed
the
run-on-clicker
branch
from
October 12, 2026 11:02
b13cad5 to
15557ba
Compare
MaggieAppleton
force-pushed
the
living-sync-loop
branch
from
October 12, 2026 11:20
7f681ac to
d856b47
Compare
Behind LIVE_BUILD=on, a connector build's run releases as soon as every task is complete, without graph-wide verification, and the document records a durable live sidecar: the build, its checkout, the plan revision and canonical MDX it was built from, and its pull requests. The archived run carries a live marker so its history still folds to a delivered outcome on restore. An invalid live record rejects the sidecar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Behind LIVE_BUILD=on, every persisted document edit re-arms a 45-second per-document timer. When it fires on a live document whose source has moved past its built base, an injectable classifier (defaulting to a plain source comparison) decides whether to queue a rebuild build for the live build's user, preferring its original workspace. A check that finds a build in flight waits for that build to stop and then runs once more, so edits made meanwhile join the next delta. Rebuilds do not lock document editing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Behind LIVE_BUILD=on, a rebuild runs on the builder's connector without claiming or locking the graph. Its run-scoped tools are read_rebuild, which returns the sealed before/after sources and the live pull requests, and report_rebuild, which records commits on the live record, appends the reported tasks as a completed graph version, advances the live base to the source sealed when the rebuild was queued, and stops the build so a deferred live check can follow. A rebuild that ends without a report fails and leaves the live base alone. A workspace pairing triggers a live check. The implementation snapshot exposes live sync state for the browser. The connector runs a rebuild on a detached worktree with a rebuild prompt that commits onto the existing pull requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When Jev is configured, the live-sync classifier asks whether the edit alters what the software should do or look like, over a compact changed-line delta, rebuilding at noul >= 0.5. Any Jev error or timeout, or no Jev key, falls back to a plain source comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A landed rebuild now accepts the connector heartbeat and a retried report_rebuild as no-ops, so the connector stops renewing and exits without reporting a failure. A living document's first build gets a prompt that ends at the last complete_task instead of asking for verification the released run would refuse. A busy live check now marks itself waiting under the document lock, and a full build history logs why a rebuild was not queued. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Connections are now keyed by owner and repository. A rebuild prefers the live build's connection, else another live connection of the same user for the repository that is not holding another document's build; it assigns that connection to the document and wakes the repository. A pairing approval checks the living documents this owner built in that repository. The live snapshot counts the repository's connections. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A first LIVE_BUILD run that stops, fails or blocks with at least one pull request now goes live from the source it claimed and records its unfinished tasks. read_rebuild returns those tasks with their blockers, and the rebuild prompt finishes them against the current document, opening a pull request only for an outstanding task that has none. Later edits resume the work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An in-sync living document can still have outstanding tasks that only an edit retries, so the snapshot now lists them with any blocker. A rebuild that lands without a commit or task records its summary, so it leaves a trace instead of disappearing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed syncs report_rebuild now carries an outcome for each outstanding task: done tasks complete in the first build's run, blocked ones keep their new blocker, and dropped ones leave the list. Outstanding tasks bypass the Jev gate; when the gate declines an edit, the live base advances with a no-change entry so the document returns to in sync. A first build that stops on a blocker before opening any pull request still goes live, so the next edit retries it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rebuild that finishes a task on its existing pull request now completes it without reporting that pull request as open again, which a merged pull request refused. A still-blocked task records its new blocker directly on the live run instead of restarting, which an unfinished dependency refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es editing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pairing now asks once, unticked by default, whether Chopin may build and prototype automatically on the laptop. Automatic rebuilds go only to the builder's opted-in connection for the live repository; a pressed Build still works without it. Prompts treat document text as data, and AGENTS.md and the lifecycle doc state the trust model. A first build goes live only from its agent's own stop; a sweep, expiry or other failure needs Retry. reportRebuild never mutates the live lifecycle before its commit, ended rebuilds give way in a full history, and a repeated report after landing succeeds even once a newer rebuild queued. A rebuild's graph version records its sealed target revision, pull request URLs compare case-insensitively and SHAs are stored lowercase. Only the builder sees their checkout, connection and agent presence in the live snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaggieAppleton
force-pushed
the
run-on-clicker
branch
from
October 12, 2026 13:08
15557ba to
3017c96
Compare
MaggieAppleton
force-pushed
the
living-sync-loop
branch
from
October 12, 2026 13:08
d856b47 to
7723612
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Once a document's first build completes, the document stays the source of truth. After every editor has been quiet for 45 seconds, the delta since the last built revision passes a Jev gate. If Jev judges it worth building, the delta goes to the builder's local agent, which commits onto the existing pull requests. Editing never locks during a rebuild.
Everything is behind
LIVE_BUILD.What changed
LiveSyncCoordinator. Debounces edits per document (45s), runs a check, and defers behind any build in flight. Edits made during a rebuild join the next delta, so one follow-up check runs when the build stops.live-gate.tsasks Jev whether the delta is worth rebuilding. An unchanged source is never rebuilt.rebuildbuild kind, queued withqueueRebuildagainst the existing pull requests. Rebuilds do not lock editing. Theread_rebuildandreport_rebuildtools let the agent read its delta and report its commits; the report advances the live snapshot.gh pr checkout, commit, and push onto each existing pull request.LIVE_BUILDends cleanly after its reports land and starts the living state.Flow
sequenceDiagram participant E as Editors participant L as LiveSyncCoordinator participant J as Jev gate participant S as Server builds participant C as Connector / local agent E->>L: edit L->>L: settle 45s (reset on each edit) L->>J: delta since built revision J-->>L: worth rebuilding L->>S: queueRebuild S->>C: rebuild build C->>C: gh pr checkout, commit, push C->>S: report_rebuild S->>S: live snapshot advanced opt edits arrived mid-rebuild S->>L: build stopped L->>J: follow-up check endBuild kinds and states
stateDiagram-v2 [*] --> FirstBuild FirstBuild: First build (locks editing) FirstBuild --> Live: completes, snapshot taken Live --> Rebuild: settled delta passes Jev gate Rebuild: Rebuild (queued, running; no lock) Rebuild --> Live: report_rebuild, snapshot advanced Rebuild --> Live: failed or cancelled, snapshot unchangedDeliberate prototype tradeoffs
LIVE_BUILD.Testing
Unit and integration tests added for the coordinator, Jev gate, rebuild lifecycle and routes, graph handling, connector run, and config.
On 10 Oct I ran this end to end on github.com/MaggieAppleton/margin with a Copilot coding agent (
copilot --acp --allow-all):Follow-up fixes from that run, now in this branch:
Verified end to end (second run, 10 Oct) with
copilot --acp --allow-allon github.com/MaggieAppleton/margin:Planner fixes (f49cbe3, 31fcf10):
edit_implementation_graphnow advertises the exact task schema (id, title, context, goal, acceptance[2-8], dependsOn) and refusals name the expected fields, so the Planner stops guessingdescription. Decision cards no longer stay on "Linking…" after a first build: once a living document's first build releases editing, the Planner is asked to re-link pending decisions (anchor_planalready works during rebuilds). Flag-off behaviour is unchanged.Stack
Merge after #450 and #451, rebase-only.
Review fixes (restack, 2026-10-12)
docs/implementation-lifecycle.mdunder "Living documents".stopped. A sweep, expiry, disconnect or failure needs Retry; there is a test.reportRebuildclones the lifecycle before changing it. A test shows that a failed commit leaves the graph, lifecycle, live record and builds unchanged.LiveRebuildwithoutconnectionId,checkoutorsession.report_rebuildafter the rebuild landed returns the same success, even after a newer rebuild has queued. A different report is still refused.target.revision. Pull request URLs compare case-insensitively, and commit SHAs accept uppercase and are stored lowercase.start_task,read_implementationorcomplete_task, and a build token cannot callreport_rebuild.🤖 Generated with Claude Code