autofix: isolate orchestrator spawns from live sync#15
Merged
Conversation
`kai spawn --sync none` set the spawn registry's SyncMode to none but did NOT stop the autosync daemon: materializeFirst's `kai ws checkout` (step 6) calls runWsCheckout, which unconditionally runs startAutoSync. That subscribed the ephemeral spawn workspace to the repo's SHARED live-sync channel and pulled in edits from OTHER kai sessions (peers) mid-run. Impact: an autofix run for one issue had a *different* issue's fix synced into its spawn (e.g. issue-8's repl.go streaming change, 6095 sync ops, landing in an issue-12 banner spawn), so the PR carried unrelated/contaminating changes. Confirmed via the spawn's .kai/autosync.log: [kai-sync] applied 6095 op(s) to repl.go from kai-cli:<peer> Fix: when --sync none, write the autosync-off marker into the spawn's .kai right after `kai init`, before `ws checkout` can start the daemon. startAutoSync already honors this marker (the `kai live off` opt-out). --sync none now genuinely means no sync. Also adopts kai-engine v0.1.1 (delta-based absorb: applies only the agent's diff vs the spawn's pre-agent baseline, defense-in-depth against any spawn-vs-main drift / wholesale-delete). Validated: `kai autofix --issue 12` now lands a single-file banner-only diff (was 4 files incl. repl.go); all three gate signals green.
Fix #16: kai init should be idempotent
…c-isolation # Conflicts: # go.mod # go.sum
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.
Problem
kai autofixPRs were contaminated with unrelated changes from other issues — e.g. an issue-12 (banner) PR also reverting/adding issue-8'srepl.gostreaming code.Root cause (traced via lifecycle instrumentation)
Not the snapshot, the agent, or absorb — it's live sync.
kai spawn --sync noneset the registry SyncMode to none, butmaterializeFirst'skai ws checkout(step 6) →runWsCheckout→startAutoSyncunconditionally started the autosync daemon. That subscribed the ephemeral spawn to the repo's shared sync channel and pulled in edits from other kai sessions mid-run.Proof, from the spawn's own
.kai/autosync.log:Fix
When
--sync none, write theautosync-offmarker into the spawn's.kairight afterkai init(beforews checkoutcan start the daemon).startAutoSyncalready honors it (thekai live offopt-out).--sync nonenow genuinely means no sync.Also adopts kai-engine v0.1.1 (delta-based absorb — applies only the agent's diff vs the spawn's pre-agent baseline; defense-in-depth).
Validation
kai autofix --issue 12(kaicontext/kai-tui): 1-file banner-only diff (was 4 files incl.repl.go); deterministic ✓ / semantic judge match ✓ / code review approved ✓.Note:
kitis unaffected (no autosync feature).