fix(hive-mind): gunakan flag SessionRuntime sebagai sinyal konvergensi otoritatif
Pesan sistem bertanda [Hive-Mind Consensus] hanya di-push ke variabel lokal
run_agent_turn dan diarsipkan ke SQLite, tidak pernah masuk ke
rt.messages lewat TurnEvent — sehingga hive_mind_already_ran selalu
memindai daftar pesan yang kosong dan gerbang "converge sekali per sesi"
tidak pernah aktif. Tambahkan SessionRuntime.hive_mind_converged yang
diset dari event TurnEvent::SystemNote { kind: "hive_mind_converged" }
setelah konvergensi selesai, disalurkan lewat TurnCtx, dan dijadikan
sinyal utama di run_agent_turn (pemindaian pesan lama tetap sebagai
fallback defensif).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3e6f9a6a5f
commit
28e763a695
@@ -46,6 +46,14 @@ pub struct SessionRuntime {
|
||||
pub review_count: u32,
|
||||
pub session_dir: PathBuf,
|
||||
pub usage: UsageStats,
|
||||
/// Whether a hive-mind convergence has completed at least once in this
|
||||
/// session. Set by the main-thread event loop when it receives a
|
||||
/// `TurnEvent::SystemNote { kind: "hive_mind_converged", .. }` — the
|
||||
/// only reliable way to detect this across turns, since system messages
|
||||
/// pushed mid-turn inside `run_agent_turn` are NOT persisted into
|
||||
/// `rt.messages` (they stay local to that turn's background thread and
|
||||
/// are only archived to `SQLite`).
|
||||
pub hive_mind_converged: bool,
|
||||
}
|
||||
|
||||
/// Record of one completed tool invocation, kept for transcript/history.
|
||||
@@ -139,6 +147,7 @@ impl SessionRuntime {
|
||||
review_count: 0,
|
||||
session_dir,
|
||||
usage: UsageStats::default(),
|
||||
hive_mind_converged: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user