fix: checkpoint diffs never resolve (shared PubSub subscription) #595
main fromrefs/pull/595/head·merged by juliusmarminge View on GitHubSummary#
Fixes #585
Stream.fromPubSub()stored as a property meant all consumers shared one subscription queue. Only the first reader got events; CheckpointReactor received nothing and never captured git checkpoints.- Changed
streamDomainEventsandstreamEventsto getters so each consumer gets its own subscription. - Added a domain event handler that replaces placeholder checkpoints (status
"missing") with real git captures. - Extracted shared CWD resolution and capture+diff+dispatch logic to reduce duplication in CheckpointReactor.
Files changed#
OrchestrationEngine.ts:streamDomainEventsproperty → getterProviderService.ts:streamEventsproperty → getterCheckpointReactor.ts: placeholder handler, dedup fix, shared helpers extracted
Test plan#
-
bun lintpasses -
bun typecheckpasses - Manual: create thread, prompt file change, verify diff panel shows actual file diffs
Note
Fix checkpoint diffs never resolving due to shared PubSub subscriptions#
- Changes
streamDomainEventsin OrchestrationEngine.ts andstreamEventsin ProviderService.ts from pre-created Stream fields to getters, so each consumer gets an independent subscription. - Adds a
captureCheckpointFromPlaceholderhandler in CheckpointReactor.ts that replaces placeholder (status: 'missing') checkpoints with real git-ref checkpoints whenthread.turn-diff-completedevents are received, even if noturn.completedruntime event arrived. - Fixes
captureCheckpointFromTurnCompletionto proceed when only a placeholder checkpoint exists for a turn, reusing itscheckpointTurnCountrather than incrementing past it. - Guards the
thread.turn.diff.completeprojector in projector.ts so placeholder checkpoints cannot overwrite an already-captured real checkpoint. - Fixes placeholder dispatch in ProviderRuntimeIngestion.ts to skip if a real checkpoint already exists and to compute
checkpointTurnCountfrom the existing max rather than array length.
before (took like ~2-3 minutes to load checkpoint diff and return error):
after fix:
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
Highly appreciated, thanks for fixing that bug!
Ready for review! Just resolving merge conflicts with latest main. @juliusmarminge
turn diffs still broken (i can see the full thread diff, but not the individual turn diffs and i don't see the tree of changed files in the thread activities), you up to debug or should I?
On it, will debug and follow up!
Found and fixed the individual turn diff issue. Two problems:
ProviderRuntimeIngestion fires multiple
turn.diff.updatedper turn. Each dispatched a new placeholder that the projector replaced by turnId, overwriting CheckpointReactor's real git capture. Fixed: skip placeholder dispatch if a checkpoint already exists for that turnId.checkpointTurnCount was computed as
thread.checkpoints.length + 1which produces unstable values after dedup. Fixed: usemax(checkpointTurnCount) + 1instead.
Also added a guard in the projector so a "missing" placeholder can never overwrite a "ready" checkpoint.
Tested locally, both "All turns" and individual turn diffs now work correctly on fresh threads.
@juliusmarminge
create a new thread the old thread has stale placeholder checkpoints from before, should work 100%
juliusmarminge approved these changes
juliusmarminge merged thise8b0126
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
d953e99a-fa11-4ad1-b7a0-d8ee41541375You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share