Implements fixes 1-3 of plans/2026-07-11-task-completion-safety-net.md. Confirmed live that 50/50 production sessions never reached a terminal status because the model almost never calls complete_task, even for trivial single-tool Q&A turns SOUL.md explicitly calls out as needing it. - Inline safety net (agent.go): a session that never called set_goal never framed itself as a structured task, so its first plain-text turn-end IS the task ending — auto-complete it there instead of leaving status stuck at its creation default forever. - Idle sweep (continue.go, new completion_nudges column): goal-bearing sessions that stall get one nudge, then auto-close with outcome=partial if the nudge goes unanswered, mirroring the pattern resumeSession already uses for a different stuck-session failure mode. Fix 4 (backfill of the 50 already-stuck live sessions) is deliberately separate — deferred until this is deployed and verified live, per the plan's implementation order. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
11 lines
622 B
SQL
11 lines
622 B
SQL
-- 019_task_completion_nudges.up.sql
|
|
-- See plans/2026-07-11-task-completion-safety-net.md (fix 2+3): a
|
|
-- goal-bearing session (set_goal was called, so it's a real structured
|
|
-- task, not the trivial-Q&A case handled by the inline safety net) can
|
|
-- still stall without ever calling complete_task. completion_nudges tracks
|
|
-- how many times the idle sweep has already nudged a stalled session, so it
|
|
-- can tell "never nudged" (nudge it) from "nudged once already, still
|
|
-- stuck" (auto-close it) rather than nudging forever.
|
|
|
|
ALTER TABLE agent_sessions ADD COLUMN IF NOT EXISTS completion_nudges INT NOT NULL DEFAULT 0;
|