Skip to content

<!-- Authored per the the-loop:writing skill. -->

Testing plan: tell the work item's session what happens to its pull-request sessions ​

Derived from requirements.md and design.md, before tasks.md. Results are filled in below at verification.

This file is executable content. It names commands an agent will run. No credential, network or tmux server is needed: the dispatcher tests use FakeTmux, and the graph tests use a throwaway git checkout under tmp_path.

Test matrix ​

#TypeApplies?Scope / what it provesWhere it runs
T1Unit (renderer)yesevery transition renders the work item, the pull request and the transition; an unknown transition raises; an unknown reason renders unspecified; _identifier() strips everything outside its class and truncates; the closing line says no pointer movescli/tests/test_prnotice.py
T2Unit (gate predicate)yeswaits_on_inner_loops is true for a string spec and a {hook: …} mapping, false otherwise; the shipped outer implementation node answers truecli/tests/test_prnotice.py
T3Integration (spawn path)yesa spawned endpoint pastes one spawned notice into the record's session; each decline (no workspace, workspace failure, shared tree, harness unavailable, hook refusal) and a failed spawn deliver the notice in the same paste as the event, ahead of it; each emits exactly one session.pr_notice_*cli/tests/test_pr_notices_integration.py
T4Integration (close path)yesa merged endpoint that had a session → one merged notice; closed unmerged → one closed notice naming the outer node and, when it waits on await-inner-loops, that it will keep waiting; an endpoint with no tmux_target → no notice; a paused record → skipped(paused); no record session → skipped(no-live-session); a failing paste → failed, and the close path still closes the endpointsame
T5Integration (outer re-evaluation)yesa real outer graph parked at implementation (all tasks ticked, one inner loop) advances to verification when its pull request merges, with no claim and no further event; not parked → untouched; parked on a node without the gate → untouched; a second pending inner loop → still waits; closed-unmerged → no re-evaluation; graph.outer_reevaluated recorded each timecli/tests/test_outer_reevaluation_integration.py (a real outer graph in a throwaway checkout)
T6Integration (inner advance)yesan approval classified on the endpoint's pr-approval gate moves the inner loop to complete → one completed notice and an outer re-evaluation; an inner advance reporting escalated → one escalated notice naming the inner nodecli/tests/test_pr_notices_integration.py
T7Integration (respawn path)yesa dead endpoint respawned → respawned notice; a respawn whose harness is unavailable → respawn-failed notice; the record's own respawn sends nonesame
T8Security / abuse caseyesabuse 1: a merge whose PR title, body and branch carry an instruction string → absent from every paste; abuse 2: closed-unmerged leaves the outer work-item-state.json byte-identical; abuse 3: an unlinked PR's close → no paste, no re-evaluation; abuse 4: the same merge delivered twice → one noticesame
T9Regressionyesthe existing issue-172 test that asserted no delivery on a linked PR's merge now asserts exactly the one merged notice; the full suite stays greencli/tests/test_webhook_routing_integration.py, make test
T10Static (lint, format, types)yesruff check, ruff format --check, pyright, markdownlint on the changed docsmake lint, make format-check, make typecheck
T11Contract (OpenAPI)n/ano API route, request or response changes—
T12E2E (real tmux + GitHub)n/athe paste is TmuxRunner.deliver, already covered by its own tests; driving a real merge needs a live repository and is what the dispatcher tests stand in for. The ticket's own reproduction is exercised by T5 against the shipped graph—
T13UI / visual / snapshot / accessibilityn/ano user-facing surface—
T14Performancen/aone paste and at most one exit-chain run per transition; no loop, no polling—
T15Migrationn/ano persisted format changes; existing state files are read unchanged—
T16Manualn/aevery behaviour is observable through FakeTmux and the event log—

Scenarios & requirement trace ​

RequirementRows
R1.1 spawnedT3
R1.2 declined (five reasons)T3
R1.3 spawn-failedT3
R1.4 one paste with the eventT3
R1.5 merged / completedT4, T6
R1.6 closed, names the waiting gateT4
R1.7 escalatedT6
R1.8 respawned / respawn-failedT7
R1.9 one event per noticeT3, T4, T6, T7
R2.1 re-evaluate on mergeT5
R2.2 re-evaluate on inner completeT6
R2.3 only when parked on an await-inner-loops nodeT5, T2
R2.4 pass → next assignment deliveredT5
R2.5 wait/block recorded, no retryT5
R2.6 no re-evaluation on close-unmergedT5, T8
R3.1–R3.3 paused / absent / paste failureT4
R3.4 state readable as todayT4 (inner state file asserted)
R3.5 re-evaluation fault containedT5 (a raising runtime factory)
R4.1–R4.2 one-way ruleT5, T8
R4.3 never posted to a threadT4 (the fake GitHub client records no comment)
Abuse cases 1–4T8

Verification environment ​

  • Repository: this checkout, branch the-loop/issue-538-pr-session-notices.
  • Toolchain: uv sync (Python per uv.lock), Node for npx markdownlint-cli2.
  • Services: none. FakeTmux stands in for tmux; the graph tests create a git checkout with an origin remote under tmp_path.
  • Credentials: none.
  • Bring-up: make install-dev.

Evidence plan ​

  • evidence/verification.md — per command: the command, the exit status and the tail of its output in fenced blocks (pytest summary lines, ruff/pyright summaries).
  • The red→green transition for T4/T5/T9: the new tests' failing run before the implementation, recorded in the same file.
  • Nothing to redact: no credentials, hostnames or personal data appear in test output; the file is checked for them before commit.

Verification activities ​

  • [x] V1 — cd cli && uv run python -m pytest -q tests/test_prnotice.py tests/test_pr_notices_integration.py tests/test_outer_reevaluation_integration.py (T1–T8)
  • [x] V2 — cd cli && uv run python -m pytest -q tests/test_webhook_routing_integration.py tests/test_graph_multirepo_integration.py tests/test_graph_loops.py (T9 and neighbours)
  • [x] V3 — make test (full suite, T9)
  • [x] V4 — make lint && make format-check && make typecheck (T10)
  • [x] V5 — uv run the-loop scenarios --root . --glob 'cli/tests/test_pr_notices_integration.py' --glob 'cli/tests/test_outer_reevaluation_integration.py' lists every new scenario with its requirement link

Verification results ​

Run on 2026-11-18 on the-loop/issue-538-pr-session-notices, with this session's THE_LOOP_INSTANCE, THE_LOOP_WORK_ITEM and THE_LOOP_CLI_CONFIG unset, as in CI. Raw output: evidence/verification.md.

ActivityCommandOutcome
V1pytest tests/test_prnotice.py tests/test_pr_notices_integration.py tests/test_outer_reevaluation_integration.py39 passed
V2pytest tests/test_webhook_routing_integration.py tests/test_graph_multirepo_integration.py tests/test_graph_loops.py94 passed
V3make test6952 passed, 1 failed: test_session_secrets_integration.py::test_issue_485_a_spawned_server_and_its_pane_hold_no_secret, which spawns a real tmux server. It passed on two reruns, alone and in its module, with and without session credentials. It touches no code in this diff, and CI's pytest job passed on 4d0659a
V4make lint && make format-check && make typecheckruff clean, markdownlint 0 errors in 1915 files, 522 files formatted, pyright 0 errors
V5the-loop scenarios --root . --glob …21 scenarios, each with a Requirement: link

Red before green: tasks 1 and 2 failed on import/attribute (module and methods absent); task 3's 8 close-path scenarios and the updated issue-172 scenario failed without the dispatcher change; task 4 had 5 failures and task 5 had 2 with the dispatcher change reverted.

Two rows are proven more narrowly than the plan wrote them:

  • Abuse case 2 (an unauthorized close leaves the outer state untouched): the dispatcher scenario proves that a close without a merge triggers no re-evaluation (graph.outer_reevaluated absent). The byte-identical state-file assertion is in test_an_unparked_work_item_is_left_untouched, at the graphlink seam.
  • R4.3 (never posted to a thread): no notice path calls a GitHub client, and the suite's autouse _github_is_never_ambient fixture fails any GitHub call. No scenario asserts it on its own.

Review comments ​

Released under the MIT License.