Skip to content

[Bug]: Bitbucket PR watcher stops with read failures while bkt can read completed AI reviews #31883

Closed

Description

@pnupu

Before submitting

  • I searched existing issues. Related reports are linked below.
  • I included observed events, a reproduction procedure, and a working workaround.

Area

apps/server

Steps to reproduce

  1. Open a Bitbucket Cloud PR with commit build statuses. In our case, an external review service posts ai-review/claude and ai-review/codex.
  2. Have the owning T3 thread call watch_pull_request while those statuses are in progress, then end the agent turn.
  3. Let the reviews finish without further PR comments or user prompts.
  4. Check whether the thread wakes for the review results. When T3 stops the watch, compare its result with bkt pr view <id> --workspace <workspace> --repo <repo> --json and bkt pr checks <id> --workspace <workspace> --repo <repo> --json on the same machine.

Expected behavior

T3 reads the Bitbucket PR and its latest-head statuses and wakes the owning agent when reviews finish. If host access is unavailable, surface the underlying provider/authentication error promptly so the agent can choose another supported wait mechanism.

Actual behavior

The thread waited for the review results until T3 emitted:

#<pr>: stopped watching, could not read it

A direct bkt read 16 seconds later succeeded: the PR was OPEN on the same head and both review statuses were SUCCESSFUL. The watcher did not deliver the expected successful-review wake. Another Bitbucket PR thread had the same stopped-watching notification.

Impact

Major degradation or frequent failure. Assigned tasks remain waiting after AI reviews finish, requiring later manual/nightly recovery.

Version or commit

The server currently reports t3 v0.1.2. The exact version when the original watch was registered is unknown. This report does not claim a fresh reproduction on upstream main.

Environment

Ubuntu Server 24.04 x86_64, headless T3 server, Codex thread, private Bitbucket Cloud repository. bkt is authenticated separately and can read the PR/statuses. Private repository names, account identifiers and local thread links are omitted.

Evidence

Sanitized historical thread activity:

  • 2026-11-04 16:40:13 UTC: bkt pr checks showed both ai-review-claude and ai-review-codex as INPROGRESS on head 3c6ce255f61f; the owner ended its turn waiting for bot results.
  • 2026-11-06 06:24:30 UTC: T3 notification: #<pr>: stopped watching, could not read it.
  • 2026-11-06 06:24:45 UTC: bkt pr view showed OPEN, same head; bkt pr checks returned both expected reviewer statuses as SUCCESSFUL and their review-comment links.
  • A second Bitbucket PR thread also contains the same notification.

Underlying cause is unverified: working CLI access does not prove T3's separately configured host credentials are valid. We did not recover a provider error for the failed reads from retained trace logs, so this report does not assert an authentication, rate-limit, or decoding cause.

Related issues

Workaround

Use one bounded background bkt poll pinned to the PR head. Require both expected reviewer keys; empty/missing statuses remain pending. In T3 Claude Code, register the actual Bash background-command task ID with t3_background_wait. We verified a historical thread in which that registration matched, woke on completion, and returned both SUCCESSFUL review results. For Codex, follow the command session to completion because t3_background_wait is Claude-only. Reread the current head, comments and merge gate after the wait. No T3 runtime patch was applied.

Report prepared by Codex (gpt-6.1-sol), at the user's request.

Activity

  1. juliusmarminge commented on Nov 6, 2026

    @juliusmarminge
    Member

    Thanks for the detailed timeline. This is fixed on main by cc59f99 (#29450), which first shipped in v0.1.7. Your server reports v0.1.2.

    Up to v0.1.6, a PR watch stopped after any 8 failed reads in a row, at the 2-minute sweep interval. That covers network errors and Bitbucket 5xx responses. So a host or network outage of about 16 minutes produced #<pr>: stopped watching, could not read it, even though the PR could be read again moments later. Both of your Bitbucket watches ending together fits that pattern. Since cc59f99, the watch stays active through those failures and wakes the thread once the checks finish.

    What I ran:

    • The watch-reactor scenario from that fix ("handles repeated host read failures: failed"): 15 sweeps of failed reads, then the checks pass. On cc59f99's parent it fails with the watch removed. On current main (2756da4) it passes: the watch is kept and the thread gets #8: checks passed.
    • On main, I fed the Bitbucket provider's detail read each error type. A network error, HTTP 500/502/503/403 and invalid JSON all classify as failed, so the watch keeps going. Only HTTP 401 (unauthenticated), HTTP 404 (not-found) and an unreadable saved credential still end it.

    Closing as fixed. If it happens again on v0.1.7 or later, please reopen with the server log warning pull request watch check failed for that PR. Its cause names the failing request and status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions