fix(agentic): preserve background subagent dialog turn ids - #1616
Merged
Conversation
Allocate the child turn ID before building background delivery metadata. Reuse it in the scheduler and direct execution paths without a subagent prefix. Add coverage for raw UUID generation and existing-ID reuse.
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.
Summary
Fixes a background subagent regression introduced by
5e48999f94daf119c1217ed6b71ba878d564f5dd(refactor(cli): route Peer Host through the assembled runtime).dialog_turn_idbefore composing background-result metadata.subagent-<uuid>.Fixes #
Type and Areas
Type: Regression fix
Areas: Rust core, agent coordination, subagent scheduling
Motivation / Impact
5e48999added exact parent/child turn lineage to background-result metadata for Peer Host routing and delivery control. It also readrequest.dialog_turn_idbefore the scheduler or direct execution path assigned it.The prepared hidden-subagent request intentionally has no turn ID at that stage, so every background subagent failed with:
prepared hidden subagent request is missing dialog_turn_idThe fix establishes the child turn ID at the background-launch boundary and preserves it through scheduling and execution. This keeps metadata, the scheduler queue, and the actual child DialogTurn aligned.
No migration is required. Existing persisted turns remain unchanged.
Verification
pnpm run fmt:rsgit diff --checkcargo check -p bitfun-core -j 1cargo test -p bitfun-core hidden_subagent_dialog_turn_id_reuses_existing_or_generates_raw_uuid -- --nocapturecargo test -p bitfun-core --lib hidden_subagent_dialog_turn_id_reuses_existing_or_generates_raw_uuid -j 1 -- --nocaptureReviewer Notes
The regression came from moving the requirement for a child turn ID ahead of its existing allocation point. The scheduler now reuses a preallocated ID, and the non-scheduler path already consumes a supplied ID, so both execution modes retain one stable identity for Peer Host lineage and background-result delivery.
Checklist