fix: 4 pre-release bug fixes — identity override, model config, agent sync, auto-identity
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
P1: identity.rs get_identity() returns empty soul/instructions for agents without explicit identity files. This prevents the default ZCLAW personality from overriding agent_config.system_prompt. New get_identity_or_default() method added for the DEFAULT agent. P2: messaging.rs now uses agent_config.model.model when available, falling back to global Kernel config. This allows per-agent model selection. P2: agentStore.ts loadClones retries up to 3 times (300ms interval) when getClient() returns null, handling the coordinator initialization race. P2: agent_create Tauri command auto-populates identity files (soul + instructions) from creation parameters, ensuring build_system_prompt() has content for new agents. Also fixes conversationStore upsertActiveConversation to persist generated conversation IDs, preventing duplicate entries on new conversations.
This commit is contained in:
@@ -7,6 +7,7 @@ use zclaw_types::{AgentConfig, AgentId, AgentInfo};
|
||||
|
||||
use super::{validate_agent_id, KernelState};
|
||||
use crate::intelligence::validation::validate_string_length;
|
||||
use crate::intelligence::identity::IdentityManagerState;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Request / Response types
|
||||
@@ -71,6 +72,7 @@ pub struct AgentUpdateRequest {
|
||||
#[tauri::command]
|
||||
pub async fn agent_create(
|
||||
state: State<'_, KernelState>,
|
||||
identity_state: State<'_, IdentityManagerState>,
|
||||
request: CreateAgentRequest,
|
||||
) -> Result<CreateAgentResponse, String> {
|
||||
// Input validation
|
||||
@@ -90,6 +92,10 @@ pub async fn agent_create(
|
||||
let kernel = kernel_lock.as_ref()
|
||||
.ok_or_else(|| "Kernel not initialized. Call kernel_init first.".to_string())?;
|
||||
|
||||
// Capture identity-relevant fields before moving request
|
||||
let soul_content = request.soul.clone();
|
||||
let system_prompt_content = request.system_prompt.clone();
|
||||
|
||||
let mut config = AgentConfig::new(&request.name)
|
||||
.with_description(request.description.unwrap_or_default())
|
||||
.with_system_prompt(request.system_prompt.unwrap_or_default())
|
||||
@@ -114,8 +120,30 @@ pub async fn agent_create(
|
||||
.await
|
||||
.map_err(|e| format!("Failed to create agent: {}", e))?;
|
||||
|
||||
let agent_id_str = id.to_string();
|
||||
|
||||
// Auto-populate identity files from creation parameters.
|
||||
// This ensures the identity system has content for `build_system_prompt()`.
|
||||
{
|
||||
let mut identity_mgr = identity_state.lock().await;
|
||||
if let Some(soul) = soul_content {
|
||||
if !soul.is_empty() {
|
||||
if let Err(e) = identity_mgr.update_file(&agent_id_str, "soul", &soul) {
|
||||
tracing::warn!("[agent_create] Failed to write soul to identity: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(prompt) = system_prompt_content {
|
||||
if !prompt.is_empty() {
|
||||
if let Err(e) = identity_mgr.update_file(&agent_id_str, "instructions", &prompt) {
|
||||
tracing::warn!("[agent_create] Failed to write instructions to identity: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(CreateAgentResponse {
|
||||
id: id.to_string(),
|
||||
id: agent_id_str,
|
||||
name: request.name,
|
||||
state: "running".to_string(),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user