Tasks: closing a work item ends its harness session
Phase 3 of 3 (requirements → design → tasks). DAG — a task starts once its dependencies are checked.
- [x] T1 — provider contract.
poller/base.py:Closuredataclass andPollProvider.owns/closure/closure_eventwith opt-in defaults. (AC1.7) — depends on nothing. - [x] T2 — GitHub closure.
poller/github.py:GhClient.fetch_item_state(gh api repos/{o}/{r}/issues/{n}, merged viapull_request.merged_at) and the provider'sowns/closure/closure_event. (AC1.2, AC1.6, AC1.7) — depends on T1. - [x] T3 — poller reconciliation.
poller/poller.py:open_refsfrom the successful listing,_reconcile_closures,PollSummary.closures,PollState.forget. (AC1.1–AC1.6) — depends on T1. - [x] T4 — close is close.
webhook/dispatcher.py:_is_close_event/_close_reasonreplacing_is_pr_close,reasononsession.autoclosed;webhook/router.py: lifecycle exemption widened toissues/closed. (AC2.1–AC2.4) — depends on nothing. - [x] T5 — terminate the harness.
runner.py:TmuxRunner.live_pane_pids+terminate_harness(session, grace, timeout, sleeper, killer);dispatcher._close_tmuxcalling it when retaining. (AC3.1–AC3.7) — depends on T4 (same close path) + T6 (config). - [x] T6 — config mirror.
TmuxConfig.kill_harness_on_close/harness_kill_grace_secondsfromkillHarnessOnClose/harnessKillGraceSeconds, hot-reloading withRoutingConfig. (AC5.1) — depends on nothing. - [x] T7 — CLI parity.
sessions closeterminates the harness on the retain path;sessions attachforces-rfor a closed session. (AC3.1, AC4.1, AC4.2) — depends on T5. - [x] T8 — observability.
poll.closure_detectedandsession.harness_terminatedregistered ineventlog.EVENT_TYPES;reasondocumented onsession.autoclosed; cycle log/poll.cyclecarryclosures. (AC5.2) — depends on T3, T4, T5. - [x] T9 — config schema + examples.
killHarnessOnClose/harnessKillGraceSecondsunderrouting.tmuxin.the-loop/cli-config.schema.json, the dogfood.the-loop/cli-config.yamland the packagedskills/the-loop/templates/cli-config.yaml;make validategreen. (AC5.1) — depends on T6. - [x] T10 — unit tests. Provider closure mapping +
owns,PollState.forget,TmuxConfigparsing,_is_close_event/_close_reason,terminate_harness(SIGTERM happy path, SIGKILL escalation, dead pane, missing session,ProcessLookupError). — depends on T1–T7. - [x] T11 — integration tests. Poll-cycle closure scenarios (issue closed, PR merged, listing error, closure error, still-open item, reopen re-spawns), the webhook
issues/closedscenario, and stub-tmux close scenarios (terminate + retain, opt-out, kill-tmux). — depends on T3, T4, T5. - [x] T12 — docs.
cli/README.mdconfig rows + prose;docs/capabilities/interactive-sessions.mdanddocs/capabilities/webhook-triggers.mdbehaviour bullets + history rows; the webhook event prompt template's parenthetical. (AC5.3) — depends on T1–T9. - [x] T14 — reviewer request (PR #96): the event filter can see a close.
commands/gh_webhook.py:DEFAULT_EVENTS+resolve_events(omitted/empty → the routable set) andwarn_on_missing_lifecycle_events, wired into both the initial build and the hot-reloadapply; schemadefault+ description, the packaged template comment,cli/README.mdrow, and four unit tests. (AC2.5, AC2.6) — depends on T4. - [x] T13 — gates.
make checkfully green; evidence inexecution-log.md; PR + reviewer briefing. — depends on T1–T12.