session-runner: land PR-mode ready-for-session tickets through a PR instead of skipping them (#165 leaves pr-default repos with no session lane) #302

Closed
opened 2026-10-22 07:22:09 +00:00 by ben · 2 comments
Owner

Problem

The session-runner never works a ready-for-session ticket that lands by PR. Since #165 it skips every ticket whose landing_mode_for resolves to pr (a landing-pr label, or a pr-DEFAULT repo) "for an interactive session to open the PR by hand", because its prompt pushes straight to main and would bypass the PR rail.

That leaves whole repos with no unattended session lane at all. As of 2026-10-22, 13 open ready-for-session tickets were skipped on every drainer tick on all three hosts — nothing is wrong, nothing will ever pick them up:

Each drainer logs #N lands by PR … skipped for an interactive session to open the PR by hand (#165, not an attempt) then nothing workable in the session queue — quiet tick. The skip is invisible on the Floor/Board: the tickets just sit in the Session column.

Want

The session-runner lands a PR-mode ticket the way the swarm workers already do — on an agent/issue-<N> branch, opened as a PR through the existing PR rail (land-pr.sh / landing_push / review gate), never a push to main — so ready-for-session drains in pr-mode repos without a human opening each PR by hand.

Notes for the design

  • prompts/session-runner-prompt.md is a skeleton (high blast radius): its landing instruction must branch on landing mode, the way the worker prompt's LANDING_RULES do (#220), and the cutover-proof fixtures need re-proving.
  • Keep #165's fail-closed posture: an unresolvable landing mode is still skipped.
  • The runner's outcome check (still_session / closed) must count "PR opened, ticket handed to review" as advanced, not a failed attempt.
  • Until this lands, consider making the skip visible (a Floor/Board marker or a one-time ticket comment) so a skipped ticket doesn't look queued.
## Problem The session-runner never works a `ready-for-session` ticket that lands by PR. Since #165 it skips every ticket whose `landing_mode_for` resolves to `pr` (a `landing-pr` label, or a pr-DEFAULT repo) "for an interactive session to open the PR by hand", because its prompt pushes straight to `main` and would bypass the PR rail. That leaves whole repos with no unattended session lane at all. As of 2026-10-22, 13 open `ready-for-session` tickets were skipped on every drainer tick on all three hosts — nothing is wrong, nothing will ever pick them up: - coa (pr-default): #130, #131, #168, #169, #171 — oldest waiting since 2026-09-04 - matou-app (pr-default): #371, #372, #424, #425, #426 - pregnancy-navigator (pr-default): #137 - idss (`landing-pr` label): #2050, #2051 Each drainer logs `#N lands by PR … skipped for an interactive session to open the PR by hand (#165, not an attempt)` then `nothing workable in the session queue — quiet tick`. The skip is invisible on the Floor/Board: the tickets just sit in the Session column. ## Want The session-runner lands a PR-mode ticket the way the swarm workers already do — on an `agent/issue-<N>` branch, opened as a PR through the existing PR rail (`land-pr.sh` / `landing_push` / review gate), never a push to `main` — so `ready-for-session` drains in pr-mode repos without a human opening each PR by hand. ## Notes for the design - `prompts/session-runner-prompt.md` is a skeleton (high blast radius): its landing instruction must branch on landing mode, the way the worker prompt's LANDING_RULES do (#220), and the cutover-proof fixtures need re-proving. - Keep #165's fail-closed posture: an unresolvable landing mode is still skipped. - The runner's outcome check (`still_session` / closed) must count "PR opened, ticket handed to review" as advanced, not a failed attempt. - Until this lands, consider making the skip visible (a Floor/Board marker or a one-time ticket comment) so a skipped ticket doesn't look queued.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: ready-for-session (category enhancement, kept).

Why this is a two-way door, not human work. The request is a code + prompt-skeleton change, fully revertible by a later commit and provable by the repo's existing offline suite — the cutover-proof fixtures (onboarding/tests/onboard-lib-test.sh), the session-runner tests, and the prompt-render tests. It touches none of the one-way-door list (no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no non-routine spend). So an agent rules it; Ben's veto is asynchronous, never blocking.

Why ready-for-session and not ready-for-agent. The core of the change edits prompts/session-runner-prompt.md, a prompt skeleton — live text rendered into every future worker, the highest-blast-radius surface in the repo. By this repo's own rule (docs/agents/triage-labels.md), every skeleton edit is interactive-session work a swarm worker must not touch. There is no human residue (no Ben's-hands/eyes, no one-way door), so this is not ready-for-human.

Premise verified against the code. Confirmed as filed: session-runner.sh skips every pr-mode ticket (the landing_mode_for == pr branch logs skipped for an interactive session to open the PR by hand (#165, not an attempt) and continues before the claim), and session-runner-prompt.md carries no landing-mode branch — its only landing instruction tells the session to git pull --rebase and push, i.e. straight to origin/main. The worker prompt, by contrast, renders a {{LANDING_RULES}} block per landing mode (#220, via prompt-render-lib.sh). So the gap is real and exactly as described.


Session Brief

Category: enhancement
Needs a session, not a swarm worker: the change edits the prompts/session-runner-prompt.md skeleton (high blast radius) and must re-prove the cutover-proof fixtures; swarm workers are barred from skeleton edits by construction.

Summary: Let the session-runner drain pr-mode ready-for-session tickets by opening a PR on the existing rail, instead of skipping them forever.

Current behavior:
When landing_mode_for resolves to pr (a landing-pr label, or a pr-DEFAULT repo), the session-runner skips the ticket before claiming it (#165), because its prompt pushes straight to main and would bypass the PR rail. Result: whole pr-default repos have no unattended session lane — 13 open ready-for-session tickets (listed in the issue) sit untouched on every tick across all hosts, invisibly (just a skip line in the runner log, "queued" on the Floor/Board).

Desired behavior:
A pr-mode ready-for-session ticket is worked the way swarm workers already land pr-mode work: on an agent/issue-<N> branch, opened as a PR through the existing PR rail (land-pr.sh / landing_push / review gate), never a push to main. ready-for-session then drains in pr-mode repos with no human opening each PR by hand. #165's fail-closed posture is preserved: an unresolvable landing mode is still skipped.

Key interfaces / contracts:

  • session-runner-prompt.md landing instruction must branch on landing mode the way the worker prompt's {{LANDING_RULES}} does (#220) — push-to-main for push mode, the agent/issue-<N> + PR rail for pr mode. Reuse the existing render seam (prompt_render_landing_rules in prompt-render-lib.sh) rather than minting a parallel one, if it fits the session prompt's shape.
  • session-runner.sh: the pr-mode arm of the landing_mode_for gate must stop unconditionally skipping. It should still skip on an unresolvable landing mode (keep the else fail-closed branch), and still skip for host-affinity / cooldown / escalation as today.
  • The runner's outcome check (still_session / closed accounting) must count "PR opened, ticket handed to review" as advanced, not a failed attempt — a pr-mode session that opens a PR and leaves the issue open+paged must not burn a fail-$N attempt or walk the ticket to agent-blocked.

Acceptance criteria:

  • A pr-mode ready-for-session ticket (via landing-pr label or pr-default repo) is picked and worked, not skipped.
  • Such a ticket lands on an agent/issue-<N> branch via the PR rail; the runner never pushes a pr-mode ticket to main.
  • An unresolvable landing mode is still skipped (fail-closed, #165 preserved).
  • "PR opened, handed to review" is recorded as advanced, not a failed attempt (no spurious fail-$N / agent-blocked).
  • session-runner-prompt.md renders correctly in both push and pr modes; the cutover-proof fixtures (onboarding/tests/onboard-lib-test.sh) are re-proven byte-identical or deliberately updated with the wording change explained.
  • The offline suite passes: for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done
  • A docs/journal/YYYY-MM-DD-302.md entry is added and the affected STATUS.md surface row updated in the same commit (project-state change).

Out of scope:

  • Changing #165's fail-closed posture for unresolvable landing modes.
  • The optional interim "make the skip visible on the Floor/Board" mitigation — fold it in only if cheap; the real fix (draining them) supersedes it.
  • Any change to how push-mode tickets land.
  • Re-triaging or re-labelling the 13 listed backlog tickets (they drain on their own once this lands).
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `ready-for-session` (category `enhancement`, kept). **Why this is a two-way door, not human work.** The request is a code + prompt-skeleton change, fully revertible by a later commit and provable by the repo's existing offline suite — the cutover-proof fixtures (`onboarding/tests/onboard-lib-test.sh`), the session-runner tests, and the prompt-render tests. It touches none of the one-way-door list (no personal credentials, no security-posture widening, no member-facing trust accept, no data destruction, no non-routine spend). So an agent rules it; Ben's veto is asynchronous, never blocking. **Why `ready-for-session` and not `ready-for-agent`.** The core of the change edits `prompts/session-runner-prompt.md`, a prompt skeleton — live text rendered into every future worker, the highest-blast-radius surface in the repo. By this repo's own rule (`docs/agents/triage-labels.md`), every skeleton edit is interactive-session work a swarm worker must not touch. There is **no** human residue (no Ben's-hands/eyes, no one-way door), so this is not `ready-for-human`. **Premise verified against the code.** Confirmed as filed: `session-runner.sh` skips every pr-mode ticket (the `landing_mode_for == pr` branch logs `skipped for an interactive session to open the PR by hand (#165, not an attempt)` and `continue`s before the claim), and `session-runner-prompt.md` carries no landing-mode branch — its only landing instruction tells the session to `git pull --rebase` and push, i.e. straight to `origin/main`. The worker prompt, by contrast, renders a `{{LANDING_RULES}}` block per landing mode (#220, via `prompt-render-lib.sh`). So the gap is real and exactly as described. --- ## Session Brief **Category:** enhancement **Needs a session, not a swarm worker:** the change edits the `prompts/session-runner-prompt.md` skeleton (high blast radius) and must re-prove the cutover-proof fixtures; swarm workers are barred from skeleton edits by construction. **Summary:** Let the session-runner drain pr-mode `ready-for-session` tickets by opening a PR on the existing rail, instead of skipping them forever. **Current behavior:** When `landing_mode_for` resolves to `pr` (a `landing-pr` label, or a pr-DEFAULT repo), the session-runner skips the ticket before claiming it (#165), because its prompt pushes straight to `main` and would bypass the PR rail. Result: whole pr-default repos have no unattended session lane — 13 open `ready-for-session` tickets (listed in the issue) sit untouched on every tick across all hosts, invisibly (just a skip line in the runner log, "queued" on the Floor/Board). **Desired behavior:** A pr-mode `ready-for-session` ticket is worked the way swarm workers already land pr-mode work: on an `agent/issue-<N>` branch, opened as a PR through the existing PR rail (`land-pr.sh` / `landing_push` / review gate), never a push to `main`. `ready-for-session` then drains in pr-mode repos with no human opening each PR by hand. #165's fail-closed posture is preserved: an **unresolvable** landing mode is still skipped. **Key interfaces / contracts:** - `session-runner-prompt.md` landing instruction must **branch on landing mode** the way the worker prompt's `{{LANDING_RULES}}` does (#220) — push-to-`main` for push mode, the `agent/issue-<N>` + PR rail for pr mode. Reuse the existing render seam (`prompt_render_landing_rules` in `prompt-render-lib.sh`) rather than minting a parallel one, if it fits the session prompt's shape. - `session-runner.sh`: the pr-mode arm of the `landing_mode_for` gate must stop unconditionally skipping. It should still skip on an **unresolvable** landing mode (keep the `else` fail-closed branch), and still skip for host-affinity / cooldown / escalation as today. - The runner's outcome check (`still_session` / closed accounting) must count **"PR opened, ticket handed to review"** as *advanced*, not a failed attempt — a pr-mode session that opens a PR and leaves the issue open+paged must not burn a fail-$N attempt or walk the ticket to `agent-blocked`. **Acceptance criteria:** - [ ] A pr-mode `ready-for-session` ticket (via `landing-pr` label or pr-default repo) is picked and worked, not skipped. - [ ] Such a ticket lands on an `agent/issue-<N>` branch via the PR rail; the runner never pushes a pr-mode ticket to `main`. - [ ] An **unresolvable** landing mode is still skipped (fail-closed, #165 preserved). - [ ] "PR opened, handed to review" is recorded as advanced, not a failed attempt (no spurious fail-$N / `agent-blocked`). - [ ] `session-runner-prompt.md` renders correctly in both push and pr modes; the cutover-proof fixtures (`onboarding/tests/onboard-lib-test.sh`) are re-proven byte-identical or deliberately updated with the wording change explained. - [ ] The offline suite passes: `for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done` - [ ] A `docs/journal/YYYY-MM-DD-302.md` entry is added and the affected `STATUS.md` surface row updated in the same commit (project-state change). **Out of scope:** - Changing #165's fail-closed posture for unresolvable landing modes. - The optional interim "make the skip visible on the Floor/Board" mitigation — fold it in only if cheap; the real fix (draining them) supersedes it. - Any change to how push-mode tickets land. - Re-triaging or re-labelling the 13 listed backlog tickets (they drain on their own once this lands).

Close-report — landed on main (push mode, session-runner standing session).

What landed (commit f41fd76, session-runner: land PR-mode ready-for-session tickets through a PR instead of skipping them (#302)):

The session-runner now drains PR-mode ready-for-session tickets instead of skipping them (#165's gap).

  • session-runner.sh — the pick loop no longer skips a pr-mode ticket. landing_mode_for still resolves push vs pr; only the UNRESOLVABLE case stays a skip (an unreadable ticket / an off-allowlist landing-* label — #165's fail-CLOSED posture kept). A pr-mode ticket that already carries an open agent/issue-<N> PR is recognised as handed to review, has ready-for-session dropped, and is stepped over (self-healing a session killed after opening its PR). The resolved mode is injected into the session prompt; the outcome path counts an open agent PR as advanced (handing the ticket to review) and drops ready-for-session, while a pr session that opened no PR stays not-advanced and keeps the ticket queued.
  • prompts/session-runner-prompt.md (skeleton, high blast radius) — a new ## Landing section branches on the injected mode, mirroring the worker prompt's {{LANDING_RULES}} pattern (#220) but written for the standing session's own push model: push lands main directly + close-report + close; pr opens a PR via .sandcastle/land-pr.sh (never main, no self-close, human merges). Defaults to push when the injected line is absent, so the re-rendered prompt stays safe under the OLD vendored runner until a pin bump. The cutover-proof fixtures were re-rendered byte-identical (the idss reference copy + the self-copy .sandcastle/session-runner-prompt.md).
  • tests/session-runner-test.sh group 25 rewritten: 25a worked-via-PR + advanced, 25b already-in-review self-heal, 25c pr-default worked, 25d off-allowlist still fail-closed, 25e no-PR not-advanced; a write_main_curl helper restores the full curl stub that group 24c swaps out.

No landing-lib.sh change — the existing landing_open_pr_for / land-pr.sh rail is reused.

Proof. The full offline suite is green: tests/session-runner-test.sh (25 groups), the cutover-proof fixtures onboarding/tests/onboard-lib-test.sh (byte-identical renders), tests/landing-lib-test.sh, tests/prompt-render-lib-test.sh, tests/judgement-call-prompts-test.sh, tests/docs-budget-test.sh, and every other tests/*.sh + onboarding/tests/*.sh (no FAIL).

Pull-only / blast radius. This is a harness change: it reaches the pr-default consumers (coa, matou-app, pregnancy-navigator) and idss's landing-pr tickets — and the running self-copy — only at their next .sandcastle/FACTORY_REF pin bump. .sandcastle/session-runner.sh here stays at 315e0da until a human re-vendors; the mode-line default keeps the newly-rendered prompt safe under the old runner meanwhile. The 13 skipped tickets named in this issue will drain once their repos pin the bump. Journal: docs/journal/2026-10-22-302-land.md.

Ruled by agent under ADR 0174 — veto anytime. Two-way door: revertible (one commit) and proven by the offline suite above.

**Close-report — landed on `main` (push mode, session-runner standing session).** **What landed** (commit `f41fd76`, `session-runner: land PR-mode ready-for-session tickets through a PR instead of skipping them (#302)`): The session-runner now drains PR-mode `ready-for-session` tickets instead of skipping them (#165's gap). - **`session-runner.sh`** — the pick loop no longer skips a pr-mode ticket. `landing_mode_for` still resolves push vs pr; only the UNRESOLVABLE case stays a skip (an unreadable ticket / an off-allowlist `landing-*` label — #165's fail-CLOSED posture kept). A pr-mode ticket that already carries an open `agent/issue-<N>` PR is recognised as handed to review, has `ready-for-session` dropped, and is stepped over (self-healing a session killed after opening its PR). The resolved mode is injected into the session prompt; the outcome path counts an open agent PR as **advanced** (handing the ticket to review) and drops `ready-for-session`, while a pr session that opened no PR stays not-advanced and keeps the ticket queued. - **`prompts/session-runner-prompt.md`** (skeleton, high blast radius) — a new `## Landing` section branches on the injected mode, mirroring the worker prompt's `{{LANDING_RULES}}` pattern (#220) but written for the standing session's own push model: push lands `main` directly + close-report + close; pr opens a PR via `.sandcastle/land-pr.sh` (never `main`, no self-close, human merges). Defaults to **push** when the injected line is absent, so the re-rendered prompt stays safe under the OLD vendored runner until a pin bump. The cutover-proof fixtures were re-rendered byte-identical (the idss reference copy + the self-copy `.sandcastle/session-runner-prompt.md`). - **`tests/session-runner-test.sh`** group 25 rewritten: 25a worked-via-PR + advanced, 25b already-in-review self-heal, 25c pr-default worked, 25d off-allowlist still fail-closed, 25e no-PR not-advanced; a `write_main_curl` helper restores the full curl stub that group 24c swaps out. No `landing-lib.sh` change — the existing `landing_open_pr_for` / `land-pr.sh` rail is reused. **Proof.** The full offline suite is green: `tests/session-runner-test.sh` (25 groups), the cutover-proof fixtures `onboarding/tests/onboard-lib-test.sh` (byte-identical renders), `tests/landing-lib-test.sh`, `tests/prompt-render-lib-test.sh`, `tests/judgement-call-prompts-test.sh`, `tests/docs-budget-test.sh`, and every other `tests/*.sh` + `onboarding/tests/*.sh` (no FAIL). **Pull-only / blast radius.** This is a harness change: it reaches the pr-default consumers (coa, matou-app, pregnancy-navigator) and idss's `landing-pr` tickets — and the running self-copy — only at their next `.sandcastle/FACTORY_REF` pin bump. `.sandcastle/session-runner.sh` here stays at `315e0da` until a human re-vendors; the mode-line default keeps the newly-rendered prompt safe under the old runner meanwhile. The 13 skipped tickets named in this issue will drain once their repos pin the bump. Journal: `docs/journal/2026-10-22-302-land.md`. Ruled by agent under ADR 0174 — veto anytime. Two-way door: revertible (one commit) and proven by the offline suite above.
matou-build-agent 2026-10-22 08:07:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#302
No description provided.