{"slug": "why-a-coding-agent-completion-event-is-not-enough", "title": "Why a Coding-Agent Completion Event Is Not Enough", "summary": "A developer at Agent Island describes a state model for monitoring coding agents like Claude Code and Codex. The model uses a completion flag, turn key, and semantic timestamp to deduplicate events and handle revocations. It combines turn timestamps with local session activity to determine if a completed turn needs user attention, with a fallback to filesystem modification time.", "body_md": "A terminal monitor sees `task_complete`\n\n. It sends an alert. The user returns and finds that the event belongs to an old turn, a background worker, or a session they already resumed.\n\nThe parser found a real event. The product state was still wrong.\n\nOur local parser returns a completion flag, a turn key, and the event's semantic timestamp. The turn key deduplicates repeated observations. The timestamp lets later activity revoke the result.\n\n```\nTurnStatus {\n  isDone\n  turnKey\n  activityDate\n}\n```\n\nClaude and Codex need separate adapters. Claude stop reasons are not sufficient on their own because an API-error record can use a completion-shaped envelope. Codex uses event types such as `task_complete`\n\nand `turn/completed`\n\n.\n\nThe monitor combines the turn timestamp with newer local session activity. A fresh completed turn becomes `needsYou`\n\n. Newer user activity can move it back to working, while the freshness cap eventually returns it to idle.\n\nFilesystem modification time remains a fallback. It cannot be the main clock because bookkeeping writes do not carry the same meaning as user activity.\n\nA longer attention window preserves alerts for users who step away, but keeps old state around longer. Watchers improve latency, but a periodic scan is still needed for dropped events. Upstream record changes require parser fixtures that cover errors and later activity, not just the happy path.\n\nI help run Agent Island, where this state model is used for local Claude Code and Codex monitoring.", "url": "https://wpnews.pro/news/why-a-coding-agent-completion-event-is-not-enough", "canonical_source": "https://dev.to/agentis/why-a-coding-agent-completion-event-is-not-enough-lci", "published_at": "2026-07-15 17:31:34+00:00", "updated_at": "2026-07-15 17:40:10.847895+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-infrastructure"], "entities": ["Agent Island", "Claude Code", "Codex"], "alternates": {"html": "https://wpnews.pro/news/why-a-coding-agent-completion-event-is-not-enough", "markdown": "https://wpnews.pro/news/why-a-coding-agent-completion-event-is-not-enough.md", "text": "https://wpnews.pro/news/why-a-coding-agent-completion-event-is-not-enough.txt", "jsonld": "https://wpnews.pro/news/why-a-coding-agent-completion-event-is-not-enough.jsonld"}}