feat(session-message): support urgent mid-turn-correction delivery - #2453
Open
1688mengdie wants to merge 3 commits into
Open
feat(session-message): support urgent mid-turn-correction delivery#24531688mengdie wants to merge 3 commits into
1688mengdie wants to merge 3 commits into
Conversation
added 3 commits
August 24, 2026 17:06
Add the urgent mid-turn-correction type layer to the SessionMessage tool so a
message can target a session's running turn instead of starting a new turn:
- `SessionMessageInput.urgent: bool` (`#[serde(default)]`, backward compatible)
- `UrgentDelivery` enum (`Steer{ turn_id }` / `NormalSubmit`)
- `resolve_urgent_delivery` and `should_attempt_steering` pure functions
- `urgent` in `input_schema` + a "Urgent correction" usage line in `description`
- 8 pure/parse test contracts (the batch-item contract requires the batch
framework, which is a separate feature and out of scope for this base)
Test:
- cargo check -p bitfun-core --features agent-runtime --jobs 4
(0 errors, 0 new warnings; only pre-existing `fork_session_for_plugin`)
- cargo test -p bitfun-core --features agent-runtime --jobs 4 urgent (8 passed)
AI: 已测
Add `DialogScheduler::current_processing_turn_id(session_id)` — a thin read-only
query over the native `SessionState::Processing { current_turn_id }` state. This
is the precise turn that `steer_dialog_turn` can target; callers query it first
and fall back to a normal submission when the session is idle.
Test:
- cargo check -p bitfun-core --features agent-runtime --jobs 4
(0 errors, 0 new warnings; only pre-existing `fork_session_for_plugin`)
- cargo test -p bitfun-core --features agent-runtime --jobs 4 current_processing_turn_id
(1 passed)
AI: 已测
Integrate urgent delivery behavior into SessionMessage dispatch. When
`urgent: true` and the target session is processing a turn, the message is
steered into that running turn via the native `steer_dialog_turn` channel,
reusing the native `AgentDialogSteerRequest` struct (with the sender identity
reminder baked into `content`). When the target is idle, or steering is
rejected, the message falls back to the normal `submit_dialog_turn`
submission so it is never dropped.
Adds the honest fallback note to the result text, the three-state result
message (steered / created / accepted), and a machine-readable `delivery`
field ("steered" / "submitted"). Removes the transient `#[allow(dead_code)]`
suppressions now that the type layer is consumed.
Test:
- cargo check -p bitfun-core --features agent-runtime --jobs 4
(0 errors, 0 new warnings; only pre-existing `fork_session_for_plugin`)
- cargo test -p bitfun-core --features agent-runtime --jobs 4 --lib
(1430 passed, 0 failed)
- cargo clippy -p bitfun-core --features agent-runtime --all-targets (0 new warnings)
- cargo fmt -p bitfun-core (clean)
AI: 已测
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
Adds
urgentmid-turn-correction delivery to theSessionMessagetool. Whenurgent: trueand the target session is processing a turn, the message is steered into that running turn via the nativesteer_dialog_turnchannel; on idle or steering rejection it falls back to a normalsubmit_dialog_turnsubmission so the message is never dropped.Closes #2452
What changed
SessionMessageInput.urgent: bool(#[serde(default)], backward compatible)UrgentDeliveryenum (Steer { turn_id }/NormalSubmit)resolve_urgent_delivery/should_attempt_steeringpure functionsDialogScheduler::current_processing_turn_id(session_id)thin read-only query over nativeSessionState::Processing { current_turn_id }deliveryfield ("steered" / "submitted")#[allow(dead_code)]suppressions now that the type layer is consumedCommits
fb7d9935b—feat(session-message): add urgent delivery type layer(type layer:urgentfield +UrgentDelivery+ pure functions + schema + description + 8 tests)5934f5dfd—feat(scheduler): expose current processing turn id(thin read-only query over nativeSessionState::Processing { current_turn_id })4a89f2b0f—feat(session-message): steer urgent messages into running turns(dispatch integration via nativesteer_dialog_turn, reusing nativeAgentDialogSteerRequest)Out of scope
urgent(G9): the base does not yet have the batch framework.Testing
已测. Each commit validated with the real tool-layer feature flag:
cargo check -p bitfun-core --features agent-runtime→ 0 errors, 0 new warnings (pre-existingfork_session_for_pluginonly)urgent)current_processing_turn_id)cargo clippy -p bitfun-core --features agent-runtime --all-targets→ 0 new warningscargo fmt -p bitfun-core→ cleanNo skipped verification: this is a Rust tool-parameter change with no UI modifications, so no before/after screenshots apply.
AI assistance
AI-assisted. Testing status: 已测 (see above).