clawdie-ai/docs/DEBUG_CHECKLIST.md

133 lines
4.2 KiB
Markdown
Raw Normal View History

2026-03-07 21:55:25 +01:00
# Clawdie Debug Checklist
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
## Known Issues (2026-02-08)
### 1. [FIXED] Resume branches from stale tree position
When agent teams spawns subagent CLI processes, they write to the same session JSONL. On subsequent `query()` resumes, the CLI reads the JSONL but may pick a stale branch tip (from before the subagent activity), causing the agent's response to land on a branch the host never receives a `result` for. **Fix**: pass `resumeSessionAt` with the last assistant message UUID to explicitly anchor each resume.
2026-03-07 21:55:25 +01:00
### 2. IDLE_TIMEOUT == JAIL_TIMEOUT (both 30 min)
Both timers fire at the same time, so jails always exit via hard SIGKILL (code 137) instead of graceful `_close` sentinel shutdown. The idle timeout should be shorter (e.g., 5 min) so jails wind down between messages, while jail timeout stays at 30 min as a safety net for stuck agents.
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
### 3. Cursor advanced before agent succeeds
2026-03-07 21:55:25 +01:00
`processGroupMessages` advances `lastAgentTimestamp` before the agent runs. If the jail times out, retries find no messages (cursor already past them). Messages are permanently lost on timeout.
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
## Quick Status Check
```bash
# 1. Is the service running?
2026-03-07 21:55:25 +01:00
if [ -f clawdie.pid ]; then kill -0 "$(cat clawdie.pid)" && echo running; else echo stopped; fi
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# 2. Any running jails?
jls -n | grep clawdie
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# 4. Recent errors in service log?
2026-03-07 21:55:25 +01:00
grep -E 'ERROR|WARN' logs/clawdie.log | tail -20
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# 5. Is Telegram configured and the process stable?
grep -E 'TELEGRAM_BOT_TOKEN is not set|Connected|connection.*close' logs/clawdie.log | tail -5
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# 6. Are groups loaded?
2026-03-07 21:55:25 +01:00
grep 'groupCount' logs/clawdie.log | tail -3
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```
## Session Transcript Branching
```bash
# Check for concurrent CLI processes in session debug logs
ls -la data/sessions/<group>/.agent/debug/
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Count unique SDK processes that handled messages
# Each .txt file = one CLI subprocess. Multiple = concurrent queries.
# Check parentUuid branching in transcript
python3 -c "
import json, sys
lines = open('data/sessions/<group>/.agent/projects/-workspace-group/<session>.jsonl').read().strip().split('\n')
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
for i, line in enumerate(lines):
try:
d = json.loads(line)
if d.get('type') == 'user' and d.get('message'):
parent = d.get('parentUuid', 'ROOT')[:8]
content = str(d['message'].get('content', ''))[:60]
print(f'L{i+1} parent={parent} {content}')
except: pass
"
```
2026-03-07 21:55:25 +01:00
## Jail Timeout Investigation
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```bash
# Check for recent timeouts
2026-03-07 22:53:36 +01:00
grep -E 'Jail timeout|timed out' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Check jail log files for the timed-out run
ls -lt groups/*/logs/jail-*.log | head -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Read the most recent jail log (replace path)
cat groups/<group>/logs/jail-<timestamp>.log
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Check if retries were scheduled and what happened
2026-03-07 21:55:25 +01:00
grep -E 'Scheduling retry|retry|Max retries' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```
## Agent Not Responding
```bash
# Check if messages are being received from the channel
2026-03-07 21:55:25 +01:00
grep 'New messages' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Check if messages are being processed (jail spawned)
grep -E 'Processing messages|Spawning jail' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 22:53:36 +01:00
# Check if messages are being piped to active jail
2026-03-07 21:55:25 +01:00
grep -E 'Piped messages|sendMessage' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Check the queue state — any active jails?
grep -E 'Starting jail|Jail active|concurrency limit' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Check lastAgentTimestamp vs latest message timestamp
sqlite3 store/messages.db "SELECT chat_jid, MAX(timestamp) as latest FROM messages GROUP BY chat_jid ORDER BY latest DESC LIMIT 5;"
```
2026-03-07 21:55:25 +01:00
## Jail Mount Issues
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```bash
2026-03-07 21:55:25 +01:00
# Check mount validation logs (shows on jail spawn)
grep -E 'Mount validated|Mount.*REJECTED|mount' logs/clawdie.log | tail -10
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Verify the mount allowlist is readable
2026-03-07 21:55:25 +01:00
cat ~/.config/clawdie-cp/mount-allowlist.json
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Check group's jail config in DB
2026-03-07 22:38:47 +01:00
sqlite3 store/messages.db "SELECT name, jail_config FROM registered_groups;"
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```
## Telegram Auth Issues
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```bash
# Verify token is set
grep '^TELEGRAM_BOT_TOKEN=' .env
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Re-run Telegram token verification
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
npm run auth
```
## Service Management
```bash
# Restart the service
2026-03-07 21:55:25 +01:00
./stop-clawdie.sh && ./start-clawdie.sh
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# View live logs
2026-03-07 21:55:25 +01:00
tail -f logs/clawdie.log
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
2026-03-07 21:55:25 +01:00
# Stop the service
./stop-clawdie.sh
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Start the service
2026-03-07 21:55:25 +01:00
./start-clawdie.sh
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
# Rebuild after code changes
2026-03-07 21:55:25 +01:00
npm run build && ./stop-clawdie.sh && ./start-clawdie.sh
Adds Agent Swarms * feat: streaming container mode, IPC messaging, agent teams support Major architectural shift from single-shot container runs to long-lived streaming containers with IPC-based message injection. - Agent runner: query loop with AsyncIterable prompt to keep stdin open for agent teams (fixes isSingleUserTurn premature shutdown) - New standalone stdio MCP server (ipc-mcp-stdio.ts) inheritable by subagents, with send_message and schedule_task tools - Streaming output: parse OUTPUT_START/END markers in real-time, send results to WhatsApp as they arrive - IPC file-based messaging: host writes to ipc/{group}/input/, agent polls for follow-up messages without respawning containers - Per-group settings.json with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - SDK bumped to 0.2.34 for TeamCreate tool support - Container idle timeout (30min) with _close sentinel for shutdown - Orphaned container cleanup on startup - alwaysRespond flag for groups that skip trigger pattern check - Uncaught exception/rejection handlers with timestamps in logger - Combined SDK documentation into single deep dive reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove unused ipc-mcp.ts (replaced by ipc-mcp-stdio.ts) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: clarify agent communication model in docs and tool descriptions - CLAUDE.md (main + global): split communication instructions into "responding to messages" vs "scheduled tasks" sections - send_message tool: note that scheduled task output is not sent to user - Remove structured output (outputFormat) — not needed with current flow - Regular output is sent to WhatsApp; scheduled task output is only logged Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: ignore dynamic group data while preserving base structure Only track groups/main/CLAUDE.md and groups/global/CLAUDE.md. All other group directories and files are ignored to prevent tracking user-specific session data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve critical bugs in streaming container mode Bug 1 (scheduled task hang): Task scheduler now passes onOutput callback with idle timer that writes _close sentinel after IDLE_TIMEOUT, so containers exit cleanly instead of blocking queue slots for 30 minutes. Scheduled tasks stay alive for interactive follow-up via IPC. Bug 2 (timeout disabled): Remove resetTimeout() from stderr handler. SDK writes debug logs continuously, resetting the timer on every line. Timeout now only resets on actual output markers in stdout. Bug 3 (trigger bypass): Piped messages in startMessageLoop now check trigger pattern for non-main groups. Non-trigger messages accumulate in DB and are pulled as context via getMessagesSince when a trigger arrives. Bug 7 (non-atomic IPC writes): GroupQueue.sendMessage uses temp file + rename for atomic writes, matching ipc-mcp-stdio.ts pattern. Also: flip isVerbose back to false (debug leftover), add isScheduledTask to host-side ContainerInput interface. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer not starting + scheduled task groupFolder missing Two bugs that prevented the scheduled task idle timeout fix from working: 1. onOutput was only called when parsed.result !== null, but session update markers have result: null. The idle timer never started for "silent" query completions, leaving containers parked at waitForIpcMessage until hard timeout. 2. Scheduler's onProcess callback didn't pass groupFolder to queue.registerProcess, so closeStdin no-oped (groupFolder was null). The _close sentinel was never written even when the idle timer fired. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: duplicate messages and timestamp rollback in piping path Two bugs introduced by the trigger context accumulation change: 1. processGroupMessages didn't advance lastAgentTimestamp until after the container finished. The piping path's getMessagesSince(lastAgent Timestamp) re-fetched messages already sent as the initial prompt, causing duplicates. 2. processGroupMessages overwrote lastAgentTimestamp with the original batch timestamp on completion, rolling back any advancement made by the piping path while the container was running. Fix: advance lastAgentTimestamp immediately after building the prompt, before starting the container. This matches the piping path behavior and eliminates both the overlap and the rollback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: container idles 30 extra minutes after _close during query When _close was detected during pollIpcDuringQuery, it was consumed (deleted) and stream.end() was called. But after runQuery returned, main() still emitted a session-update marker (resetting the host's idle timer) and called waitForIpcMessage (which polled forever since _close was already gone). The container had to wait for a second _close. Fix: runQuery now returns closedDuringQuery. When true, main() skips the session-update marker and waitForIpcMessage, exiting immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resume branching, internal tags, and output forwarding - Fix resume branching: pass resumeSessionAt with last assistant UUID to anchor each query loop resume to the correct conversation tree position. Prevents agent responses landing on invisible branches when agent teams subagents create parallel JSONL entries. - Add <internal> tag stripping: agent can wrap internal reasoning in <internal> tags which are logged but not sent to WhatsApp. Prevents duplicate messages and internal monologue reaching users. - Forward scheduled task output: scheduled tasks now send result text to WhatsApp (with <internal> stripping), matching regular message behavior. No more special-case instructions. - Update Communication guidance in CLAUDE.md: simplified to "your output is sent to the user or group" with soft guidance on <internal> tags and send_message usage. - Add messaging behavior docs to schedule_task tool: prompts the scheduling agent to include guidance on whether the task should always/conditionally/never message the user. - Mount security: containerPath now optional, defaults to basename of hostPath. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: cursor rollback on error, flush guard, verbose logging - Roll back lastAgentTimestamp on container error so retries can re-process the messages instead of silently losing them. - Add guard flag to flushOutgoingQueue to prevent duplicate sends from concurrent flushes during rapid WA reconnects. - Revert isVerbose from hardcoded false back to env-based check (LOG_LEVEL=debug|trace). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: orphan container cleanup was silently failing The startup cleanup used `container ls --format {{.Names}}` which is Docker Go-template syntax. Apple Container only supports `--format json` or `--format table`. The command errored with exit code 64, but the catch block silently swallowed it — orphan containers were never cleaned up on restart. Fixed to use `--format json` and parse `configuration.id` from the JSON output. Also filters by `status: running` and logs a warning on failure instead of silently catching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Discord badge and community section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: idle timer reset on null results and flush queue message loss - Only reset idle timer on actual results (non-null), not session-update markers. Prevents containers staying alive 30 extra minutes after the agent finishes work. - flushOutgoingQueue now uses shift() instead of splice(0) so unattempted messages stay in the queue if an unexpected error bails the loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add Agent Swarms to README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update Telegram skill for current architecture Rewrite integration instructions to match the per-group queue/SQLite architecture: remove onMessage callback pattern (store to DB, let message loop pick up), fix startSchedulerLoop signature, add TELEGRAM_ONLY service startup, SQLite registration, data/env/env sync, @mention-to-trigger translation, and BotFather group privacy docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Telegram skill message chunking, media placeholders, chat discovery - Split long messages at Telegram's 4096 char limit to prevent silent send failures - Store placeholder text for non-text messages (photos, voice, stickers, etc.) so the agent knows media was sent - Update getAvailableGroups filter to include tg: chats so the agent can discover and register Telegram chats via IPC - Fix removal step numbering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: update REQUIREMENTS.md and SPEC.md for SQLite architecture - Replace all registered_groups.json / sessions.json / router_state.json references with SQLite equivalents - Fix CONTAINER_TIMEOUT default (300000 → 1800000) - Add missing config exports (IDLE_TIMEOUT, MAX_CONCURRENT_CONTAINERS) - Update folder structure: add missing src files (logger, group-queue, mount-security), remove non-existent utils.ts, list all skills - Fix agent-runner entry (ipc-mcp.ts → ipc-mcp-stdio.ts) - Update startup sequence to reflect per-group queue architecture - Fix env mounting description (data/env/env, not extracted vars) - Update troubleshooting to use sqlite3 commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: fix README architecture description, revert SPEC.md env error - README: update architecture blurb to mention per-group queue, add group-queue.ts to key files, update file descriptions - SPEC.md: restore correct credential filtering description (only auth vars are extracted from .env, not the full file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 02:50:43 +02:00
```