Repository navigation
Queue system notices during manual compaction - #6334
Merged
Merged
Conversation
The pre-delivery compaction check ran outside any lock, and the send guard does not serialize concurrent sends, so a compaction that started between the check and the steer could still be steered into. Check inside the same immediate transaction that appends the steer, and treat the resulting error as "stay queued" in queueParentSystemMessage and both queue drains. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mistakeknot
added a commit
to mistakeknot/aleph
that referenced
this pull request
Oct 27, 2026
Backport five upstream bb fixes (get-bb#6247, get-bb#6255, get-bb#6243, get-bb#6334, get-bb#6358)
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.
🚨 SLOP COP 🚨 ·
new-issue-autopilotHuman comments
What was wrong
Parent system notices (child completed, ownership changes, detached tool results) are delivered through their own path, not the ordinary message checkpoint. That path checked for pending interactions but not for manual compaction. Once the provider had accepted a
/compactturn, a notice was sent into that turn as an auto-targeted steer. Codex rejected it withcannot steer a compact turn, the parent ended inerror, and the notice was lost: it was never queued and never delivered.User messages are not affected, because the checkpoint already queues them during compaction (
dispatch-attempt.ts).Report: https://get-bb.github.io/reports/issues/6333.html
What changed
parent-system-messages.ts: the transaction that records the steer for a notice now checksisManualCompactionActivefirst. If a compaction is running, it throwsParentSystemMessageCompactionActiveError. Because the check runs in the same immediate transaction that appends the steer, a compaction that starts concurrently can't slip between the check and the write. The per-thread send guard can't prevent that, since it does not serialize concurrent sends.queueParentSystemMessage: treats that error the same way asThreadContextClearInProgressError. It writes a durablethread-busyqueue row with the notice's kind and subject, which is delivered as a new turn once compaction finishes.queued-messages.ts: both queue drains, auto and explicit send, treat the error as "leave it queued". A notice being drained when a compaction starts stays queued and isn't recorded as a failure.turn-startingand the drain's existing compaction guard holds them. That behaviour is unchanged.Scope: 174 changed lines (170 additions, 4 deletions) across 3 files: two server thread-dispatch files and one test. No dependency, generated file, stored-data, schema or protocol changes. No new UI, CLI or SDK surface.
How you verified
pnpm exec turbo run test --filter=@bb/server -- test/public/public-thread-compaction.test.ts test/threads/parent-system-message-dispatch.test.ts test/threads/thread-send-dispatch.test.ts: 54 passed.pnpm exec turbo run test --filter=@bb/servergave 3,681 passed and 2 failed, both inbuiltin-plugins.test.ts. That test waits on a fixed timer for a plugin file watcher. It passed in 3 of 3 reruns and doesn't touch thread code.pnpm exec turbo run typecheck --filter=@bb/serverpassed.pnpm start:worktreeserver. A child ransleep 20, and the parent's/compactwas fired so that the compaction overlapped the 2-second batch delay before the child-completed notice is sent:autosteer into the compact turn. Codex returnedclient/turn/rejectedwith "cannot steer a compact turn" and asystem/errorthread_command_failed. The parent's status becameerror, and the notice was never queued or delivered.child-completed, waiting onthread-busy).Fixes #6333