fix: checkpoint diffs never resolve due to shared PubSub subscriptions#864
fix: checkpoint diffs never resolve due to shared PubSub subscriptions#864jasonLaster wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the 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. Comment |
| ); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
🔴 Critical Layers/CheckpointReactor.ts:424
captureCheckpointFromPlaceholder references targetCheckpointRef, fromCheckpointRef, and nextTurnCount which are never declared in its scope, so it throws ReferenceError at runtime. The function also calls captureAndDispatchCheckpoint with missing arguments (no turnCount, status, etc.) and then duplicates that function's logic manually, which would emit duplicate events. This appears to be an incomplete refactor where code was copied from captureCheckpointFromTurnCompletion without the corresponding variable definitions.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/server/src/orchestration/Layers/CheckpointReactor.ts around line 424:
`captureCheckpointFromPlaceholder` references `targetCheckpointRef`, `fromCheckpointRef`, and `nextTurnCount` which are never declared in its scope, so it throws `ReferenceError` at runtime. The function also calls `captureAndDispatchCheckpoint` with missing arguments (no `turnCount`, `status`, etc.) and then duplicates that function's logic manually, which would emit duplicate events. This appears to be an incomplete refactor where code was copied from `captureCheckpointFromTurnCompletion` without the corresponding variable definitions.
Evidence trail:
apps/server/src/orchestration/Layers/CheckpointReactor.ts lines 387-520 (REVIEWED_COMMIT) - `captureCheckpointFromPlaceholder` function definition and body showing undeclared variables `targetCheckpointRef`, `fromCheckpointRef`, `nextTurnCount`
apps/server/src/orchestration/Layers/CheckpointReactor.ts lines 190-220 (REVIEWED_COMMIT) - `captureAndDispatchCheckpoint` function signature showing required parameters including `turnCount`, `status`, `assistantMessageId`, `createdAt`
apps/server/src/orchestration/Layers/CheckpointReactor.ts lines 314-378 (REVIEWED_COMMIT) - `captureCheckpointFromTurnCompletion` function showing correct pattern with proper variable declarations
0784b67 to
4153865
Compare
Stream.fromPubSub() creates a subscription eagerly. Storing the result as a property meant all consumers shared one queue, so only the first reader (wsServer/ProviderRuntimeIngestion) got events. CheckpointReactor received zero events and never captured git checkpoints. Fix: change streamDomainEvents and streamEvents to getters so each consumer gets its own subscription. Also add a domain event handler that replaces placeholder checkpoints with real git captures, and extract shared CWD resolution and capture logic to reduce duplication. Closes pingdotgg#585
4153865 to
661a179
Compare
Stream.fromPubSub() creates a subscription eagerly. Storing the result as a property meant all consumers shared one queue, so only the first reader (wsServer/ProviderRuntimeIngestion) got events. CheckpointReactor received zero events and never captured git checkpoints.
Fix: change streamDomainEvents and streamEvents to getters so each consumer gets its own subscription. Also add a domain event handler that replaces placeholder checkpoints with real git captures, and extract shared CWD resolution and capture logic to reduce duplication.
Closes #585
Closes #595
Note
Fix checkpoint diffs never resolving due to shared PubSub subscriptions
streamDomainEventsinOrchestrationEngineandstreamEventsinProviderServicefrom fixed stream exports to getters that callStream.fromPubSub()on each access, giving each consumer an independent subscription.captureCheckpointFromPlaceholderhandler inCheckpointReactorthat replaces placeholder (status"missing") checkpoints with a real git checkpoint when athread.turn-diff-completedevent is received.captureCheckpointFromTurnCompletionso placeholder checkpoints no longer block a real capture for the same turn, and centralizes cwd resolution and capture dispatch intoresolveCheckpointCwdandcaptureAndDispatchCheckpointhelpers.Macroscope summarized 661a179.