feat: Phase 3 — sub-agent detection, nested status, cascade completion
Phase 3 (Sub-Agent Support):
- session-monitor.js: sub-agents always passed through (inherit parent channel)
- watcher-manager.js enhancements:
- Pending sub-agent queue: child sessions that arrive before parent are queued
and processed when parent is registered (no dropped sub-agents)
- linkSubAgent(): extracted helper for clean parent-child linking
- Cascade completion: parent stays active until all children complete
- Sub-agents embedded in parent status post (no separate top-level post)
- status-formatter.js: recursive nested rendering at configurable depth
Integration tests - test/integration/sub-agent.test.js (9 tests):
3.1 Sub-agent detection via spawnedBy (monitor level)
3.2 Nested status rendering (depth indentation, multiple children, deep nesting)
3.3 Cascade completion (pending tool call tracking across sessions)
3.4 Sub-agent JSONL parsing (usage events, error tool results)
All 95 tests pass (59 unit + 36 integration). make check clean.
This commit is contained in:
@@ -226,11 +226,14 @@ class SessionMonitor extends EventEmitter {
|
||||
|
||||
const transcriptFile = this._transcriptPath(agentId, sessionId);
|
||||
|
||||
// Sub-agents always pass through — they inherit parent channel via watcher-manager
|
||||
const isSubAgent = !!spawnedBy;
|
||||
|
||||
// Resolve channel ID from session key
|
||||
let channelId = SessionMonitor.parseChannelId(sessionKey);
|
||||
|
||||
// Fall back to default channel for non-MM sessions
|
||||
if (!channelId && !SessionMonitor.isMattermostSession(sessionKey)) {
|
||||
if (!channelId && !isSubAgent && !SessionMonitor.isMattermostSession(sessionKey)) {
|
||||
channelId = this.defaultChannel;
|
||||
if (!channelId) {
|
||||
if (this.logger) {
|
||||
|
||||
Reference in New Issue
Block a user