Repository navigation
Restore #7028 and #7030, which #7011 reverted - #7052
Merged
Merged
Conversation
## Human comments ## What was wrong bb showed PR #7000 as "failing (22 passed, 4 failed)" while GitHub's commit rollup was `SUCCESS` and the PR was `CLEAN`. Every workflow had run twice on the head commit, both from `pull_request` events about a second apart. Concurrency cancelled CI run #20437, and its replacement, #20438, passed. GitHub's rollup only counts the newest run. bb rebuilt the check state from individual check runs and merged duplicates by name only. Four cancelled matrix jobs from the old run never expanded their names (for example `Tests (${{ matrix.shard }}, ubuntu-latest, Node 22.x)`), so no check in the new run shared their names, and bb counted them as failures. `gh pr checks` merges by name too and shows the same four failures. A second path had the same problem. When bb can't resolve the GitHub repository from git remotes, it found the PR with `gh pr view`. For drafts, closed PRs and failed GraphQL reads, it then used `gh`'s own `statusCheckRollup`, which has no workflow-run data. ## What changed `plugins/github-pr-status/host/git-host.ts`: - The GraphQL check query now fetches each check run's `checkSuite.workflowRun` (run number, event, workflow ID). After all check pages are merged, bb drops checks from any run superseded by a newer run of the same workflow and event. Runs for different events, such as `push` and `pull_request`, are both kept, so a real failure is not hidden. Status contexts and non-Actions check runs are unchanged. - The `gh pr view` discovery path now asks only for `--json url`, then reads the PR through the same GraphQL URL read every refresh uses. This now includes drafts and closed PRs. If that read fails, bb reports the PR as unavailable, which keeps any previous snapshot, instead of returning a partial PR. The `gh pr view` field list, its parser, and the `gh`-only parsing branches (array `reviewRequests`, `workflowName` fallback) are removed. This is host-local to the plugin. The host/server contract and `HOST_DAEMON_PROTOCOL_VERSION` are unchanged. ## How you verified - Added tests: - batch tests for a superseded run on one check page and for a newer run on a later page; - a discovery-path test for a draft with a superseded run; - a GraphQL-shaped normalization test; - unavailable cases for invalid or failed GraphQL responses. The superseded-run tests failed against the first draft of the fix, because the zod parse clones the check objects and dropped the run tags, so they do catch the bug. - `pnpm exec turbo run test typecheck lint --filter=bb-plugin-bb--github-pr-status`: 174 tests pass, plus typecheck and lint. - Read live #7000 with the patched host code: `passing`, 22/22, `ready_to_merge`. - Ran `pnpm start:worktree` with a checkout of #7000's branch as a project. `bb pull-request show` reports checks passing 22/22, `CLEAN`/`MERGEABLE`, `ready_to_merge`. Production bb on the same PR reports `failing (22 passed, 4 failed, 26 total)`, `checks_failed`. - Not exercised live: the discovery path for unresolvable remotes. It is covered by unit tests only. > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit b0e91c3)
…rns (#7028) Two separate causes produced noisy child → parent completion notices. 1. **Notices piled up while the parent was blocked.** A child's turn-end notice only coalesced into a queued row that was still inside its 2 s scheduled window ([`getPendingCoalescedQueuedThreadMessage`](https://github.com/get-bb/bb/blob/4f973b851a/packages/db/src/data/queued-thread-messages.ts#L885-L906) required `state = 'scheduled'` and `send_at > now`). Once that row moved to `waiting` (pending question, starting turn, offline host), every later outcome created another row. On 2026-11-03 a parent blocked on an AskUserQuestion from 22:23 to 04:31 received ten separate "completed" notices from one child, all steered in within two seconds of the answer. The same pile-up existed before #6728 (pairs from one child appear in the event log since September); this is the first time a parent stayed blocked long enough for it to reach ten. 2. **`/compact` turns were reported as completions.** A `/compact` on a child runs as its own turn whose only root item is the context compaction. Its turn end notified the parent with "No final output was recorded." just before the queued message behind it started the real work. All 7 "No final output" child notices since #6821 were these turns. Before #6821 the same turn re-sent the previous turn's output. | Area | Change | |---|---| | `packages/db` `getPendingCoalescedQueuedThreadMessage` / `updateCoalescedQueuedThreadMessageInTransaction` | Match any undelivered coalesced row (`queued`, `scheduled`, `waiting`). Only a row still inside its time window has `send_at` pushed back; a waiting row keeps its wait. | | `apps/server` `postCoalescedSystemNotice`, child notifications | Return the row as stored; arm the dispatch timer only for a scheduled row. | | `packages/db` `isStoredTurnContextCompactionOnly` | New: true when a turn's completed root items are all `contextCompaction`. | | `apps/server/src/internal/events.ts` | A completed child turn that only compacted context does not notify the parent. A turn that compacts and then answers still does. | | `bb guide threads` | `--parent-notifications` text says compaction-only turns are not reported. | No daemon wire change, so `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. No schema change. - `apps/server/test/threads/system-notice-dispatch.test.ts`: "merge later outcomes into a row still waiting on the parent" (parent on a pending question, two outcomes from one child plus one from another → one waiting row, latest status per child). Fails on main, passes here. It replaces "start a new row once the earlier window has expired", which pinned the pile-up. - `apps/server/test/threads/child-completion-turn-output.test.ts`: "does not notify the parent for a turn that only compacted context" (compaction-only turn → no notice; compaction + answer → notice with the answer). Fails without the `events.ts` change. The existing turn-scoping test now records the parent's latest notice per child turn, because its harness parent never accepts a turn and the old assertion counted the pile-up. - `pnpm exec turbo run typecheck lint --filter=@bb/server --filter=@bb/db` passes. - `pnpm exec turbo run test --filter=@bb/server --filter=@bb/db`: 3857 passed / 1 skipped, and 653 passed. One run hit a 40 s timeout in `builtin-plugins.test.ts` under load ~14; that file passes on its own (27/27). - Live QA against a `pnpm start:worktree` server: to follow in a comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Opus 5.5 <[email protected]> (cherry picked from commit 920804a)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Human comments
What was wrong
#7011 (updateWhenIdle settings) reverted two PRs that had merged about 30 minutes before its commit was created: #7028 (merge child notices while the parent is blocked, skip
/compactturns) and #7030 (count only the latest workflow run in GitHub PR check status). Its body mentions neither, so it looks accidental.6b17f1bc04, whose parent is Merge child notices while the parent is blocked, and skip /compact turns #7028's merge commit920804af63. Even so, the commit's own diff rewrites 11 files to their earlier content:packages/db/src/data/index.ts.plugins/github-pr-status/host/went back to their pre-Count only the latest workflow run in GitHub PR check status #7030 content.What users got back after #7011:
/compactturns on a child send the parent "No final output was recorded."What changed
b0e91c38f8(Count only the latest workflow run in GitHub PR check status #7030) and920804af63(Merge child notices while the parent is blocked, and skip /compact turns #7028) onto current main with-x. Count only the latest workflow run in GitHub PR check status #7030 applies unchanged.coalesced-system-notices.ts, because Batch parent ownership notices and show bb notices usefully in the queue drawer #7029 (merged after Let users turn on automatic bb updates that install once threads finish (updateWhenIdle) #7011) added withdrawing a pending notice there. The result is Merge child notices while the parent is blocked, and skip /compact turns #7028's version with Batch parent ownership notices and show bb notices usefully in the queue drawer #7029's withdraw path kept: the pending lookup has nonowand a merge writeswindowEndsAt. This is the combination Batch parent ownership notices and show bb notices usefully in the queue drawer #7029 was tested with before Let users turn on automatic bb updates that install once threads finish (updateWhenIdle) #7011 landed.child-thread-notifications.tsresolved to main's existing version, which already guards on a scheduled row.internal/events.tsanddb/data/events.tsmerged cleanly with the later Keep a new message's thread running when its turn start times out #7031 and Remove the fixed per-push cost of building the latest timeline window #7033 changes.check-plugin-sdk-versionreports the surface unchanged.How you verified
thread-ownership-notices: "withdraw a move undone after its window but before delivery"system-notice-dispatch: "merge later outcomes into a row still waiting on the parent"child-completion-turn-output: "does not notify the parent for a turn that only compacted context"github-pr-statusgit-host/batch: superseded workflow runs, including on a later checks page and for drafts found throughgh pr viewturbo run testfor the GitHub PR Status plugin,@bb/dband@bb/templatespasses (10/10 tasks).turbo run typecheckfor server, db, app and the plugin passes (10/10 tasks).🤖 Generated with Claude Code