Skip to content

fix(pr): report queued merges instead of printing "" (1.6.0) - #7

Merged
solrevdev merged 2 commits into
masterfrom
fix/async-merge
Nov 16, 2026
Merged

solrevdev merged 2 commits into
masterfrom
fix/async-merge

Conversation

@solrevdev

Copy link
Copy Markdown
Owner

bbx pr merge printed "" and exited 0 when Bitbucket queued a merge (HTTP 202), so the task ID was lost. Seen on 16 Nov 2026 during Bitbucket's API slowdown.

Changes

  • Merge sends ?async=true, reads the task from the 202 Location header (or links.self.href) and polls task-status every 3s up to --timeout (default 120).
  • Success prints the merged pull request, as a direct merge does. Still pending at the timeout prints "status": "queued" with task_id, task_status_url and a next command, and exits 75. A failed task exits 1. --no-wait returns the queued record with exit 0.
  • Poll timeouts, 5xx and 429 are retried. The merge POST gets 120s instead of 30s. The timeout is now per request in BitbucketClient.
  • merge-status gains --wait and --timeout, and --task-id takes the ID or the URL.
  • deployments changes (the other 202 write) now says "Queued".
  • Docs: llm-guide, api-coverage, README, CHANGELOG, AGENTS rule 36. Version 1.6.0.

Testing

  • 480 unit tests pass on net10.0 and net11.0. 23 are new. The 202 path is fully faked.
  • Live, on throwaway repos in the solrevdev workspace, each deleted with a 404 check afterwards: a real 202 came back with a task ID, the task stayed PENDING for 600s, and bbx exited 75 with the task in its JSON. Bitbucket never finished that task, so the SUCCESS path is covered by unit tests only. No foremost-group PR was merged.

🤖 Generated with Claude Code

https://claude.ai/code/session_014Mjr3Y5biNhSM8Bmg4xfaw

solrevdev and others added 2 commits November 16, 2026 12:04
Bitbucket answers POST pullrequests/{id}/merge with 202 when it queues the
merge, and names the task only in the Location header. PostAsync dropped
headers, so bbx 1.5.0 printed the empty body as "" and exited 0. On
16 Nov 2026 that hid three queued merges: two were dropped and one landed
40 minutes later, with no task ID to follow any of them.

pr merge now keeps the Location header, polls task-status (default 120s,
--timeout) and prints the merged pull request on success. A merge still
pending at the timeout prints "status": "queued" with the task ID, the
task-status URL and the follow-up command, and exits 75 (EX_TEMPFAIL) so
scripts can tell it from success and from failure. --no-wait returns the
queued record at once. merge-status gains --wait/--timeout and accepts
either the task ID or the URL that merge prints.

deployments changes, the only other 202 write, now says "Queued" rather
than "Updated".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Mjr3Y5biNhSM8Bmg4xfaw
Live checks on a throwaway repository during the 16 Nov 2026 slowdown found
two more ways to lose a queued merge:

- Without ?async=true the merge POST blocked past the 30s client timeout,
  exiting 1 with the outcome unknown. The handler now asks for async, gives
  the POST 120s, and says the merge may be queued if it still times out.
  The timeout moved from HttpClient.Timeout into BitbucketClient so one call
  can wait longer; it keeps the inner TimeoutException that Program uses to
  tell a timeout (exit 1) from Ctrl+C (exit 130).
- After two minutes of PENDING one task-status poll hung for 30s and the
  error ended the wait, losing the task ID. Timeouts, 5xx and 429 during a
  poll are now retried until --timeout; the last one is reported as
  last_poll_error. 4xx still ends the wait, since 400 is a failed task.

The final live run got a real 202, polled PENDING for 600s and exited 75
with the task ID in its JSON. The repository was deleted afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Mjr3Y5biNhSM8Bmg4xfaw
@solrevdev
solrevdev merged commit e3e0cc9 into master Nov 16, 2026
2 checks passed
@solrevdev
solrevdev deleted the fix/async-merge branch November 16, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant