You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent): retain webhook completion across incremental polls - #20697
Polling a completed webhook run with its returned next_since_ts skips the stored finished event and reports finished: false. It can also return events recorded after that terminal event.
Determine completion from the stored event independently of cursor filtering. Repeated polls remain finished, preserve the cursor, and return no replayed or post-terminal events. Tests cover successful and unsuccessful outcomes, active runs, and the HTTP polling flow.
This follows #20619's handling of expired webhook traces.
Validation
Standalone Go polling tests passed with the race detector; the new completion regressions fail against the previous implementation.
All seven existing frontend webhook status tests passed.
git diff --check passed.
Package-scoped bash build.sh --test ./internal/handler/... -run 'TestPollWebhookTrace|TestGetAgentWebhookLogs' -count=1 is blocked by the unsupported macOS native DeepDoc build. The HTTP handler tests remain unverified locally.
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 3d0dcd1c-efcb-497c-a642-9c1dd66f162b
📥 Commits
Reviewing files that changed from the base of the PR and between eeb2960 and 997f17f.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: daccdaf2-d634-492d-8b0b-1b383726bfcc
📥 Commits
Reviewing files that changed from the base of the PR and between 67cbeca and 689b30c.
📒 Files selected for processing (3)
internal/handler/agent_webhook_trace.go
internal/handler/agent_webhook_trace_poll_test.go
internal/handler/agent_webhook_trace_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
📝 Walkthrough
Walkthrough
Webhook trace polling now marks a run finished when it encounters a finished event, even if that event is at or before the polling cursor. It appends only newer events and advances the cursor only for those events. Tests cover repeated polls after completion and active runs with no new events.
Changes
Webhook trace polling
Layer / File(s)
Summary
Cursor filtering and terminal-state polling internal/handler/agent_webhook_trace.go, internal/handler/agent_webhook_trace_poll_test.go, internal/handler/agent_webhook_trace_test.go
The collector detects finished events independently of the cursor and appends only newer events. Tests check successful and failed terminal outcomes, repeated polls, cursor preservation, and active runs with no new events.
No actionable merge-blocking issue is established. The HTTP handler tests remain unverified locally because the package-scoped build was blocked.
Pre-merge checks | 5
✅ Passed checks (5 passed)
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: preserving webhook completion across incremental polls.
Description check
The description includes the required Summary section, explains the problem and solution, provides relevant test coverage, and records validation results and limitations.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
I’m a rabbit, hopping past the trace, A finished event keeps its place. New events follow the cursor’s cue, Old ones do not replay anew. Active runs wait for more to show, Then off through the logs I go.
Comment @coderabbitai help to get the list of available commands.
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
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
Polling a completed webhook run with its returned
next_since_tsskips the storedfinishedevent and reportsfinished: false. It can also return events recorded after that terminal event.Determine completion from the stored event independently of cursor filtering. Repeated polls remain finished, preserve the cursor, and return no replayed or post-terminal events. Tests cover successful and unsuccessful outcomes, active runs, and the HTTP polling flow.
This follows #20619's handling of expired webhook traces.
Validation
git diff --checkpassed.bash build.sh --test ./internal/handler/... -run 'TestPollWebhookTrace|TestGetAgentWebhookLogs' -count=1is blocked by the unsupported macOS native DeepDoc build. The HTTP handler tests remain unverified locally.Thank you for reviewing.