mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-03 22:19:42 +02:00
fix: subagent title extraction race condition
- Add 100ms debounce for new file detection to allow content to be written - Add subagent:updated event for retroactive description updates - Extract description in processEntry when first user message is processed - Add extractDescriptionFromFile helper with retry in file change handler - Update SubagentTranscriptEntry.content type to support string | array - Add test coverage for subagent:updated event Fixes 43% failure rate where subagents displayed raw IDs instead of descriptions due to race condition when files were discovered before first line was written. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1308,6 +1308,23 @@ class ClaudemanApp {
|
||||
}
|
||||
});
|
||||
|
||||
this.eventSource.addEventListener('subagent:updated', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
const existing = this.subagents.get(data.agentId);
|
||||
if (existing) {
|
||||
// Merge updated fields (especially description)
|
||||
Object.assign(existing, data);
|
||||
this.subagents.set(data.agentId, existing);
|
||||
} else {
|
||||
this.subagents.set(data.agentId, data);
|
||||
}
|
||||
this.renderSubagentPanel();
|
||||
// Update floating window if open
|
||||
if (this.subagentWindows.has(data.agentId)) {
|
||||
this.renderSubagentWindowContent(data.agentId);
|
||||
}
|
||||
});
|
||||
|
||||
this.eventSource.addEventListener('subagent:tool_call', (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
const activity = this.subagentActivity.get(data.agentId) || [];
|
||||
|
||||
@@ -303,6 +303,10 @@ export class WebServer extends EventEmitter {
|
||||
this.broadcast('subagent:discovered', info);
|
||||
});
|
||||
|
||||
subagentWatcher.on('subagent:updated', (info: SubagentInfo) => {
|
||||
this.broadcast('subagent:updated', info);
|
||||
});
|
||||
|
||||
subagentWatcher.on('subagent:tool_call', (data: SubagentToolCall) => {
|
||||
this.broadcast('subagent:tool_call', data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user