Stream git hook progress events for stacked git actions#1214
Stream git hook progress events for stacked git actions#1214juliusmarminge wants to merge 6 commits intomainfrom
Conversation
- Add hook/output progress callbacks to git execution and commit flow - Emit ordered git action progress events (start, phases, hooks, finish/fail) - Publish progress over WebSocket only to the initiating client - Update shared contracts and tests for the new progress event channel
|
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)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
🟢 Low
t3code/apps/web/src/wsTransport.ts
Lines 191 to 195 in e84f5dc
When the WebSocket closes, pending requests are rejected and removed from this.pending, but this.outboundQueue is not cleared. On reconnect, flushQueue() sends queued messages with id values that no longer exist in this.pending. The server processes these requests and sends responses, but handleMessage() silently drops them because this.pending.get(message.id) returns undefined. For non-idempotent operations, this causes the caller to believe the request failed while the server actually executed it.
ws.addEventListener("close", () => {
if (this.ws === ws) {
this.ws = null;
}
+ this.outboundQueue.length = 0;
for (const [id, pending] of this.pending.entries()) {🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/wsTransport.ts around lines 191-195:
When the WebSocket closes, pending requests are rejected and removed from `this.pending`, but `this.outboundQueue` is not cleared. On reconnect, `flushQueue()` sends queued messages with `id` values that no longer exist in `this.pending`. The server processes these requests and sends responses, but `handleMessage()` silently drops them because `this.pending.get(message.id)` returns `undefined`. For non-idempotent operations, this causes the caller to believe the request failed while the server actually executed it.
Evidence trail:
apps/web/src/wsTransport.ts lines 173-187 (close handler clears pending but not outboundQueue), line 153 (only dispose() clears outboundQueue), line 166 (open handler calls flushQueue), lines 215-219 (handleMessage silently drops responses for unknown IDs), lines 243-258 (flushQueue sends queued messages)
- Add `actionId` to `GitRunStackedActionInput` and related API calls - Pass client-generated `actionId` from web UI through WS server to progress events - Update server/web/contracts tests to assert deterministic progress correlation
- Switch Git trace2 monitoring from polling to filesystem watch - Parse trace chunks with schema decoding and keep hook progress flowing - Update test expectations for hook output ordering
- Emit the commit phase_started event only when the hook needs to generate a message - Keep pre-resolved suggestions from triggering an unnecessary progress update
- Replace the ref indirection with `useEffectEvent` - Keep push and PR actions wired to the latest toast state
- Remove the extra checkout helper in GitActionsControl - Keep feature-branch flags with the action calls
Closes #1194
Summary
runStackedAction, includingaction_started, phase transitions, hook lifecycle, hook output, success, and failure eventsactionIdand publishgitActionProgressevents only to the initiating clientTesting
apps/server/src/git/Layers/GitManager.test.ts: added tests for ordered commit-hook progress events andaction_failedon hook rejectionapps/server/src/wsServer.test.ts: added test to verify git action progress is delivered only to the initiating websocketapps/web/src/wsNativeApi.test.tsandapps/web/src/wsTransport.test.ts: added progress-channel handling coveragepackages/contracts/src/ws.test.ts: added contract-level ws progress event checksbun fmtbun lintbun typecheckbun run testNote
Stream structured git hook progress events for stacked git actions to the UI
git.actionProgressWebSocket push channel that streams structured events (action_started,phase_started,hook_started,hook_output,hook_finished,action_failed,action_finished) back to the initiating client during stacked git actions.GitServiceto detect hook lifecycle events, and forwards incremental stdout/stderr lines to progress callbacks.GitManager.runStackedActionemits per-phase and per-hook progress events; commit steps have a 10-minute timeout.GitActionsControlUI component subscribes to progress events and updates the progress toast in real time with phase labels, hook names, and output.WsTransportgains support fortimeoutMs: nullon requests (used for long-running stacked actions) and now rejects pending requests on socket close.📊 Macroscope summarized e84f5dc. 17 files reviewed, 2 issues evaluated, 0 issues filtered, 2 comments posted
🗂️ Filtered Issues