Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix(skills/agents): clear-chat must also drop core-agent session jsonl

aiservice29834fbb5a05
diff --git a/src/main/features/agents.ts b/src/main/features/agents.ts
index a9d98dc4..c53de50c 100644
--- a/src/main/features/agents.ts
+++ b/src/main/features/agents.ts
@@ -956,6 +956,18 @@ export async function clearAgentChat(userId: string, agentId: string): Promise<b
}
invalidateLineCount(agentChatMsgsPath(userId, agentId));
search.dropAgentChat(userId, agentId);
+ // Also evict + drop the core-agent persistent session jsonl. Without this
+ // the LLM retains its full prior context even though the UI history is
+ // empty — same bug pattern as clearSkillChat (paths from before a
+ // promote-to-builtin survive in the LLM's memory).
+ const sessionId = defaultAgentEditSessionId(userId, agentId);
+ try { evictSession(sessionId); } catch { /* not in cache */ }
+ try { await fsp.unlink(userSessionFile(userId, sessionId)); }
+ catch (err) {
+ if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
+ log.warn(`session unlink user=${userId} agent=${agentId}: ${(err as Error).message}`);
+ }
+ }
log.info(`cleared user=${userId} agent=${agentId}`);
return true;
}
diff --git a/src/main/features/skills.ts b/src/main/features/skills.ts
index 5a5d4564..e06bd115 100644
--- a/src/main/features/skills.ts
+++ b/src/main/features/skills.ts
@@ -1001,6 +1001,19 @@ export async function clearSkillChat(userId: string, skillId: string): Promise<b
}
invalidateLineCount(skillChatMsgsPath(userId, skillId));
search.dropSkillChat(userId, skillId);
+ // Also evict + drop the core-agent persistent session jsonl. Without this
+ // the LLM retains its full prior context (tool calls, paths, file contents)
+ // even though the UI history is empty — visible as the LLM "remembering"
+ // pre-clear state, e.g. trying to read paths that no longer exist after a
+ // promote-to-builtin. Session id is id-keyed so it survives source changes.
+ const sessionId = defaultSkillSessionId(userId, skillId);
+ try { evictSession(sessionId); } catch { /* not in cache */ }
+ try { await fsp.unlink(userSessionFile(userId, sessionId)); }
+ catch (err) {
+ if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {
+ log.warn(`session unlink user=${userId} skill=${skillId}: ${(err as Error).message}`);
+ }
+ }
log.info(`cleared user=${userId} skill=${skillId}`);
return true;
}
diff --git a/src/renderer/modules/skills.js b/src/renderer/modules/skills.js
index e30541d9..84a9f088 100644
--- a/src/renderer/modules/skills.js
+++ b/src/renderer/modules/skills.js
@@ -981,7 +981,10 @@ async function clearSkillChat() {
async function _refreshSkillView() {
if (!_skillEditSkillId) return;
const sid = _skillEditSkillId;
- const source = 'custom';
+ // Source must come from the active selection, not be hardcoded — dev-mode
+ // built-in editing reuses this same path and was previously bailing here
+ // because of a 'custom'-only equality check.
+ const source = _selectedSkill?.source || 'custom';
// Refresh the skill list cache (in case name/description in SKILL.md changed)
_skillsCache = null;