fix(tui): perbaiki roster workflow yang tidak pernah ter-reset karena substring "started" tidak pernah cocok

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
asepharyana
2026-07-14 10:55:05 +07:00
co-authored by Claude Sonnet 5
parent 5498088532
commit fdd62f8303
+12 -2
View File
@@ -385,7 +385,7 @@ pub fn apply_action(state: &mut AppStateRest, action: Action) {
state.misc.api_connected = message == "connected";
} else if kind == "pipeline" {
// Clear old workflow agents when a new pipeline starts.
if message.contains("started") {
if message == HIVE_MIND_KICKOFF_NOTE {
state.workflow_engine.agents.clear();
state.workflow_engine.findings.clear();
}
@@ -937,6 +937,16 @@ fn archive_message(db: Option<&std::sync::Arc<std::sync::Mutex<rusqlite::Connect
/// background subagents still fire at the end of the turn.
const MAX_AUTO_REVIEWS_PER_TURN: usize = 2;
/// Exact text of the "pipeline started" `SystemNote` pushed once per
/// hive-mind kickoff. Matched by exact equality (not a loose substring)
/// when deciding whether to reset the workflow panel's agent roster —
/// shared between the push site and the check site so they cannot drift
/// out of sync the way the previous `.contains("started")` check did
/// (no real pipeline message ever contained that word, so the roster
/// never cleared and agent cards accumulated across every hive-mind run
/// in a session).
const HIVE_MIND_KICKOFF_NOTE: &str = "Core Intelligence is compiling a cognitive cycle plan...";
/// Execute one full agent turn: stream the conversation to the LLM,
/// handle tool calls, and loop until the LLM produces a non-tool response
/// or runs out of unfinished todo items.
@@ -1028,7 +1038,7 @@ fn run_agent_turn(
if let Ok(mut q) = events_q.lock() {
q.push_back(TurnEvent::SystemNote {
kind: "pipeline".to_string(),
message: "Core Intelligence is compiling a cognitive cycle plan...".to_string(),
message: HIVE_MIND_KICKOFF_NOTE.to_string(),
});
}