Repository navigation
Reject queued inserts after a thread is archived or deleted - #8263
Merged
ymichael merged 2 commits intoNov 30, 2026
Merged
Conversation
alexburlis
added a commit
to alexburlis/omnyo
that referenced
this pull request
Nov 26, 2026
Record the upstream PRs, revisions, contributors, and Omnyo integration commits for merge d2a24ac in docs/upstream-credits.md. Original-PR: get-bb/bb#7663 Original-Commit: get-bb/bb@1737a03 Original-Author: rufi Original-PR: get-bb/bb#8055 Original-Commit: get-bb/bb@651ae20 Original-Author: Jake Lancaster Original-PR: get-bb/bb#8075 Original-Commit: get-bb/bb@511e1ed Original-Author: Jake Lancaster Original-Co-Author: Michael Yong Original-Co-Author: Claude Opus 5.5 Original-PR: get-bb/bb#8096 Original-Commit: get-bb/bb@775090b Original-Author: Michael Yong Original-Co-Author: Claude Opus 5.5 Original-PR: get-bb/bb#8145 Original-Commit: get-bb/bb@8de6711 Original-Commit: get-bb/bb@0d3db49 Original-Commit: get-bb/bb@92d3a76 Original-Commit: get-bb/bb@6705422 Original-Author: Michael Yong Original-Co-Author: Claude Opus 5.5 Original-PR: get-bb/bb#8171 Original-Commit: get-bb/bb@b56ed04 Original-Author: Jake Lancaster Original-PR: get-bb/bb#8238 Original-Commit: get-bb/bb@2a9a142 Original-Author: SawyerHood Original-PR: get-bb/bb#8247 Original-Commit: get-bb/bb@ba4ae22 Original-Author: Salem Original-Co-Author: Claude Opus 5.5 Original-PR: get-bb/bb#8259 Original-Commit: get-bb/bb@96f40a9 Original-Author: SawyerHood Original-PR: get-bb/bb#8263 Original-Commit: get-bb/bb@141e40a Original-Author: mk Original-PR: get-bb/bb#8266 Original-Commit: get-bb/bb@84e20e9 Original-Author: ILIA GOLUBEV
recordQueuedMessageWait now rereads the thread in its immediate transaction and rejects an archived or deleted thread with the existing thread_not_writable 409, which carries the details the app and SDK parse. The database fence stays as a backstop, so the generic error mapping and the queue-wait wrapper are removed, along with unrelated reformatting. Adds a server regression test for a scheduled send that loses the race to archive or delete during preparation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
) ## Human comments ## What was wrong The shared queue-insert boundary did not reread thread retirement state, so callers holding an earlier thread snapshot could persist queued work after archive or deletion. Adding a database refusal alone would also leave delayed API callers without a defined conflict response. See the linked issue. ## What changed Check lifecycle state in the same immediate transaction as the insert, before attachment ownership or notification. Translate the typed refusal into the existing 409 thread_not_writable API response, including delayed queue admission. Coalesced system notices return no row for retired threads; explicit queue admission and parent notices retain their existing transactional checks. Add database and HTTP error-handler regression cases. No protocol, schema, CLI or guide changes. ## How you verified Based on a8c3228. Focused database tests: 47 passed; the two new archived/deleted cases fail without the fence on plain base (45 existing cases pass). HTTP error-handler tests: 4 passed, including two conflict-mapping cases. Run from packages/db and apps/server respectively, with isolated HOME/TMPDIR and nice -n 10: ```sh pnpm exec vitest run test/data/queued-thread-messages.test.ts --maxWorkers=2 pnpm exec vitest run src/errors.test.ts --maxWorkers=2 ``` Package-only typechecks from the repository root both pass: ```sh pnpm exec turbo run typecheck --filter=@bb/db --only --concurrency=1 pnpm exec turbo run typecheck --filter=@bb/server --only --concurrency=1 ``` File-scoped formatting checks pass. The database paths require the same formatter config with its broad data/ ignore disabled; otherwise the check matches zero files. File-scoped lint exits 1 on existing no-comments violations: each flagged comment line is already present in the base source. No new lint diagnostic remains. The amended patch passes git apply --check against the recorded base. Fixes get-bb#8262 > AGENT GENERATED --------- Co-authored-by: Michael Yong <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
The shared queue-insert boundary did not reread thread retirement state, so callers holding an earlier thread snapshot could persist queued work after archive or deletion. Adding a database refusal alone would also leave delayed API callers without a defined conflict response. See the linked issue.
What changed
Check lifecycle state in the same immediate transaction as the insert, before attachment ownership or notification. Translate the typed refusal into the existing 409 thread_not_writable API response, including delayed queue admission. Coalesced system notices return no row for retired threads; explicit queue admission and parent notices retain their existing transactional checks. Add database and HTTP error-handler regression cases. No protocol, schema, CLI or guide changes.
How you verified
Based on b0ddaad. Focused database tests: 47 passed; the two new archived/deleted cases fail without the fence on plain base (45 existing cases pass). HTTP error-handler tests: 4 passed, including two conflict-mapping cases.
Run from packages/db and apps/server respectively, with isolated HOME/TMPDIR and nice -n 10:
Package-only typechecks from the repository root both pass:
File-scoped formatting checks pass. The database paths require the same formatter config with its broad data/ ignore disabled; otherwise the check matches zero files. File-scoped lint exits 1 on existing no-comments violations: each flagged comment line is already present in the base source. No new lint diagnostic remains. The amended patch passes git apply --check against the recorded base.
Fixes #8262