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

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:
iven
2026-04-08 21:47:46 +08:00
parent 8eeb616f61
commit adcce0d70c
5 changed files with 112 additions and 21 deletions

View File

@@ -137,9 +137,18 @@ export const useAgentStore = create<AgentStore>((set, get) => ({
// Actions
loadClones: async () => {
const client = getClient();
let client = getClient();
// Retry up to 3 times with short delay if client isn't ready yet.
// This handles the race where connected fires before coordinator
// injects the client into the store.
for (let attempt = 0; attempt < 3 && !client; attempt++) {
await new Promise((r) => setTimeout(r, 300));
client = getClient();
}
if (!client) {
log.warn('[AgentStore] Client not initialized, skipping loadClones');
log.warn('[AgentStore] Client not initialized after retries, skipping loadClones');
return;
}

View File

@@ -325,11 +325,19 @@ export const useConversationStore = create<ConversationState>()(
upsertActiveConversation: (currentMessages: ChatMessage[]) => {
const state = get();
const currentId = state.currentConversationId || null;
const conversations = upsertActiveConversation(
[...state.conversations], currentMessages, state.sessionKey,
state.currentConversationId, state.currentAgent,
);
set({ conversations });
// If this was a new conversation (no prior currentConversationId),
// persist the generated ID so subsequent upserts update in-place
// instead of creating duplicate entries.
if (!currentId && conversations.length > 0) {
set({ conversations, currentConversationId: conversations[0].id });
} else {
set({ conversations });
}
return conversations;
},