workflow-violation: SWE skipped task_update_status + bro_atomic_close after consolidation commit (#45)

Violation

During v0.7.0-rc.3 L5+L6 consolidation refactor on branch refactor/l5-l6-consolidation, the SWE agent (or resume turn) completed the technical work — committed 33b626f with verification matrix green — but did NOT call:

  1. task_update_status(task_id=25, status='completed', commit_sha='33b626f')
  2. bro_atomic_close(task_id=25, ...) (or queue it for bro)

Bro had to manually fill in both calls before push could proceed.

Why this matters

Per doctrine: SWE's atomic_close discipline is what makes the L5/L6 close-gate enforcement meaningful. When SWE skips the close, downstream:

  • bro_atomic_close errors with "task status is pending, expected completed" — bro can't proceed
  • Audit trail loses the SWE-author signal — every close looks like bro-initiated
  • Eliminates the asymmetry the feedback_pr_reviewer_required_pre_push doctrine assumes (SWE = work + close; bro = orchestrate + invoke pr-reviewer)

Likely root cause

SWE's resume turn (after the prior turn hit token cap mid-iteration) saw its output as "commit landed, verification green, done" — but missed the close-flow step that the prior token-capped turn would have done. Process expectation: SWE's "done" must include task_update_status + bro_atomic_close, not just the commit.

Suggested fix

Two layers — structural (preferred) and prompt-only:

(a) Structural — SWE close-gate hook: add a PostToolUse hook that fires when SWE commits on a branch with an open task; checks whether task_update_status + bro_atomic_close were called in the same turn; if not, blocks the agent from terminating with a system-reminder pointing at the missing calls. Parallels the existing pr-reviewer-spawn-prompt-shape.sh hook.

(b) Prompt-only — strengthen agents/swe.md close-flow section: explicit checklist at end of SWE prompt: "✓ commit signed by emoji-prefix-Conventional-Commits / ✓ task_update_status to completed / ✓ bro_atomic_close called / ✓ verification matrix attached in close summary". This is weaker (LLMs miss checklists) but cheap. Per memory feedback_no_negative_prompt_rules — frame structurally not as "don't forget" reminders.

Recommend (a) — hook is the structural fix; SWE checklists are well-known to drift.

Acceptance criteria

  • A SWE turn that commits work on a task branch CANNOT terminate without also calling task_update_status + bro_atomic_close (hook blocks termination)
  • Hook is L3-tested (add to tests/hooks/ — fire it, simulate missing-close, assert blocked)
  • Doctrine in docs/agents/swe.md (or wherever) documents the close-flow as a single 3-call sequence (commit + status_update + atomic_close) not a 1-call sequence with optional follow-ups

Filed from

Bro session 2026-05-19 during v0.7.0-rc.3 close. Concrete instance: task #25 (closed) / issue #45 — see bro_atomic_close audit row for the verification_summary that explicitly notes the SWE gap.

Edited by Zax Shen