GCWing / GCWing/OpenBitFun

[Feature]: SessionMessage urgent mid-turn-correction delivery

オープン
#2,452 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
2.2k
フォーク
229
平均マージ
2時間 46分
マージ済み PR(30日)
577

説明

## Overview

This issue proposes supporting **urgent mid-turn-correction delivery** for the `SessionMessage` agent tool. When the `urgent` flag is set, a message can be steered into a session's **running turn** (instead of starting a new turn), reusing the native turn-steering channel.

## Motivation

The current `SessionMessage` tool always submits to a new turn. In scenarios where a maintenance/operator message must correct an in-progress turn (e.g., inject a remark into the turn currently being processed), starting a new turn is the wrong behavior. This feature adds an `urgent` parameter that re-targets the message to the running turn when one exists, falling back to a normal submission otherwise — so the message is never dropped.

## Proposed implementation

A single functional change split into three stacked commits:

1. **Type layer** — `feat(session-message): add urgent delivery type layer`. Adds `SessionMessageInput.urgent: bool` (`#[serde(default)]`, backward compatible), the `UrgentDelivery` enum, the `resolve_urgent_delivery` / `should_attempt_steering` pure functions, plus `input_schema` / `description` updates and 8 parse/pure test contracts.
2. **State layer** — `feat(scheduler): expose current processing turn id`. Adds a thin read-only `DialogScheduler::current_processing_turn_id(session_id)` query over the native `SessionState::Processing { current_turn_id }`.
3. **Behavior layer** — `feat(session-message): steer urgent messages into running turns`. Integrates into dispatch: steer into the running turn via the native `steer_dialog_turn` channel (reusing the native `AgentDialogSteerRequest`, sender reminder baked into `content`), falls back to `submit_dialog_turn` on idle/reject, and adds the honest fallback note, the three-state result text (steered / created / accepted), and a machine-readable `delivery` field ("steered" / "submitted").

## Alignment with reference behavior

This reimplements the reference behavior while reusing the native dialog-turn structs and the native `UserSteering` injection channel (no custom substitutes).

## Explicitly out of scope

- **Batch per-item `urgent`** (G9) — the base does not yet have the batch framework; out of scope for this change.
- **Reply suppression** (N1 / async reply suppression) — tracked as a separate change.
- **No UI changes** (Rust tool parameters only), so no before/after screenshots apply.

## Testing status

**已测**. Each stacked commit was validated with the real tool-layer feature flag:

- `cargo check -p bitfun-core --features agent-runtime` → 0 errors, 0 new warnings (pre-existing `fork_session_for_plugin` only).
- C1: 8 tests passed (`urgent`).
- C2: 1 test passed (`current_processing_turn_id`).
- C3: full lib regression 1430 passed, 0 failed.
- `cargo clippy -p bitfun-core --features agent-runtime --all-targets` → 0 new warnings; `cargo fmt -p bitfun-core` → clean.

## AI assistance

This change is AI-assisted. Testing status is **已测** (see above).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start at the SessionMessageInput type and its input_schema and description, then trace dispatch into DialogScheduler and the native steer_dialog_turn and submit_dialog_turn paths. Run the listed agent-runtime checks and tests, including the urgent contracts and current_processing_turn_id test. Done means urgent messages steer a running turn, fall back to submission when needed, and report the stated delivery result.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust
領域
api, backend
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。