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(bitbucket): retain pending checks when a PR watch starts - #44217
Bitbucket reads build statuses but omits their aggregate state from PR details. Watch registration consequently loses pending CI, and a check that passes before the first reactor sweep can be silently baselined without waking the thread.
Change
Return checksState using the existing rollupCheckStatuses helper and the checks already fetched. Distinguish an unavailable check read from a successfully read empty list: retain the existing checks: [] fallback, but omit the aggregate state when the read failed.
The patch changes two files and adds no API requests, authentication methods, settings, or changes to transient-failure recovery.
This fixes the missing Bitbucket watch seed on current main. Related summary optimization #27596 will also need to preserve fresh check state for watch registration.
Verification
vp run check:changed --concurrency 1: format, lint, both knip passes, typechecks for 11 affected packages, and 23 tests across 3 files passed on base 9268aa9b27b3ef1d6be77c2563240bfc21b469ab.
The Bitbucket provider's 20 tests pass. The new pending-state regression fails against the original provider (undefined instead of pending). Existing optional-read tests now assert that both response and body-read failures leave checksState absent; those assertions caught and prevented clearing a previously known state.
A temporary runtime proof exercised the real Bitbucket provider, summary conversion, watch registration, orchestrator, in-memory persistence, reactor and effect worker, with synthetic external API responses. The unmodified provider produced no notification. The final provider retained pending state and produced one completion notification; a repeated sweep did not repeat it:
Before: registration {"watching":true}
first sweep []
After: registration {"watching":true,"checksState":"pending"}
first sweep ["#1: checks passed"]
repeated sweep ["#1: checks passed"]
The runtime fixture was removed from the submitted diff after verification. Non-loopback network access was blocked. This is not a newly captured live Bitbucket timing reproduction; repository-wide tests and builds remain for CI.
Two independent reviews covered standards and the requested behavior. The unavailable-read finding was fixed and rechecked.
Implemented with GPT-6.1 Sol in the Codex harness through T3 Code. Independently reviewed with GPT-6.2 Sol in Codex.
Return the aggregate state of checks already read by the provider so watch registration retains pending CI. Keep the state absent after an unavailable check read, preserving existing optional-read behavior.
Fixes: pingdotgg#44202
No actionable comments were generated in the recent review.
Walkthrough
The Bitbucket provider now preserves whether check data is available and returns an aggregate checksState when it is. Tests cover pending checks and verify that unavailable check data does not produce checksState.
Changes: Bitbucket check status reporting
Layer / File(s)
Summary
Return aggregate check status packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts, packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.test.ts
getChangeRequest uses null to represent unavailable check data, returns checks as an array, and adds checksState when check data is available. Tests cover a pending check and the absence of checksState in the rate-limit case.
Issue 32276 concerns repeated checks-passed notifications after a pending read. This change preserves pending status at registration, but does not change the shared watch evaluation behavior identified in that issue.
Merge Risk: Minimal · up to a32b7
Merge Risk:⚪ Minimal · up to a32b7
Bitbucket PR watches now keep pending CI state at registration, so a later passing result produces one completion notification. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the Bitbucket provider and the core fix, retaining pending checks when a PR watch starts. The change adds checksState derived from the existing checks via rollupCheckStatuses, so pendi…
Description check
The description covers Problem, Change, Scope, and Verification, and it links issue #44202 as the bug. It gives concrete verification: check run results, a regression test that fails on the original p…
Linked Issues check
[#44202] requires Bitbucket PR details to carry the aggregate check state so that watch registration seeds pending CI. At head, BitbucketPullRequestProvider.getChangeRequest computes checksState with …
Out of Scope Changes check
The whole-PR diff (merge base 9268aa9 to head 779b1b3) changes two files, as the PR description states. BitbucketPullRequestProvider.ts adds the rollupCheckStatuses import, the PullRequestCheck type…
Full details: Title check
Explanation
The title names the Bitbucket provider and the core fix, retaining pending checks when a PR watch starts. The change adds checksState derived from the existing checks via rollupCheckStatuses, so pending CI survives watch registration. The title follows the conventional commit format and is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description covers Problem, Change, Scope, and Verification, and it links issue #44202 as the bug. It gives concrete verification: check run results, a regression test that fails on the original provider, and a runtime proof. It also states what was not checked, which the template asks for. Two gaps remain. The Verification section reports a repeated-sweep result that contradicts the claim in the same bullet, since the displayed output shows the notification repeated. The description also does not say whether the agent model line follows the template's requirement. Both are minor, so the description is mostly complete.
Full details: Linked Issues check
Explanation
[#44202] requires Bitbucket PR details to carry the aggregate check state so that watch registration seeds pending CI. At head, BitbucketPullRequestProvider.getChangeRequest computes checksState with rollupCheckStatuses(checks.map(c => c.status)) from the checks already read by listChecks. A pending build check therefore yields checksState 'pending', which PullRequestWatchService.setWatching uses to seed checksPending. The change adds no API calls. The @t3tools/source-control-core dependency already exists in package.json, and the helper is exported from packages/source-control-core/src/server/pullRequestChecks.ts. When listChecks fails, checks falls back to [] and checksState is omitted, as the issue requires. The regression test and the runtime proof in the PR description support the pending-to-success path. I did not re-run the tests. The repeated-sweep no-duplicate behavior depends on existing evaluator code that this PR does not change; the PR objectives flag an ambiguous repeated-sweep output, but this does not change the coding result for the seed requirement.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff (merge base 9268aa9 to head 779b1b3) changes two files, as the PR description states. BitbucketPullRequestProvider.ts adds the rollupCheckStatuses import, the PullRequestCheck type import, the null-sentinel for failed listChecks reads, and the conditional checksState. BitbucketPullRequestProvider.test.ts adds tests for the pending state and for the omitted state on failed reads. Each change supports the [#44202] objective. No unrelated API, auth, setting, or transient-failure recovery changes were found in the reviewed hunks.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
The automated pipeline stopped on this pull request and will not merge it:
the fix is written and reviewed, but proving it needs something no worker has:
Permanent blocker: a valid Bitbucket account and accessible repository with a controllable PR build are required but unavailable in this worker's configured accounts.
Pending-state retention, one wake after successful completion before the first sweep, suppression of repeated notifications, and absent aggregate state after failed status reads were not demonstrated.
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
size:S10-29 changed lines (additions + deletions).takeover:blockedTakeover blocked; reason in the PR bodyvouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
3 participants
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
Bitbucket reads build statuses but omits their aggregate state from PR details. Watch registration consequently loses pending CI, and a check that passes before the first reactor sweep can be silently baselined without waking the thread.
Change
Return
checksStateusing the existingrollupCheckStatuseshelper and the checks already fetched. Distinguish an unavailable check read from a successfully read empty list: retain the existingchecks: []fallback, but omit the aggregate state when the read failed.The patch changes two files and adds no API requests, authentication methods, settings, or changes to transient-failure recovery.
Scope
Fixes #44202.
This fixes the missing Bitbucket watch seed on current main. Related summary optimization #27596 will also need to preserve fresh check state for watch registration.
Verification
vp run check:changed --concurrency 1: format, lint, both knip passes, typechecks for 11 affected packages, and 23 tests across 3 files passed on base9268aa9b27b3ef1d6be77c2563240bfc21b469ab.undefinedinstead ofpending). Existing optional-read tests now assert that both response and body-read failures leavechecksStateabsent; those assertions caught and prevented clearing a previously known state.The runtime fixture was removed from the submitted diff after verification. Non-loopback network access was blocked. This is not a newly captured live Bitbucket timing reproduction; repository-wide tests and builds remain for CI.
Two independent reviews covered standards and the requested behavior. The unavailable-read finding was fixed and rechecked.
Implemented with GPT-6.1 Sol in the Codex harness through T3 Code. Independently reviewed with GPT-6.2 Sol in Codex.