session-runner has no host affinity: a ready-for-session ticket whose standing is host-specific is claimed by every host that cannot do it (#743 burned both attempts) #746

Closed
opened 2026-08-24 13:48:12 +00:00 by matou-build-agent · 2 comments

The session queue has no host affinity, and #743 is what that costs.

.sandcastle/session-runner.sh picks from ?labels=ready-for-session and filters on
no-triage / deferred / agent-blocked / agent-working / open dependencies — and
nothing else. Whichever host ticks first claims the ticket. But ready-for-session
exists (ADR 0174 §5) precisely for work that needs a particular session's standing:
host credentials, live droplet doors, a host's own evidence directories. The label
records that a host is needed; it cannot record which.

What it cost

#743 asks for eyes on two rented drives whose evidence lives on elitebook-03. Per
docs/agents/worker-classes.json, session-runner's hosts is [matou-workstation] —
elitebook-03 runs Forgejo Actions but no session-runner at all. So #743 was unclaimable
by the only host that could do it, and claimable by every host that could not
:

  • attempt 1 (2026-08-24 04:26Z) — matou-workstation: no test-results/drive-rented, no route to elitebook-03;
  • attempt 2 (2026-08-24 ~13:30Z) — matou-dev-server-01: a DigitalOcean droplet whose netbird mesh holds only its sibling dev servers.

Two attempts is the runner's escalation cap, so a correctly-labelled ticket walks itself
to ready-for-human without a human ever being the actual blocker.

Shape of a fix (not ruled — this ticket is the ask)

The cheapest thing that would have worked: an opt-in host tag the picker honours.
A host:<name> label (or a <!-- session-host: elitebook-03 --> body marker, the shape
<!-- rehearsal-target/confirm --> already uses on the drive issues) that the jq filter
skips unless it matches this host, with no tag meaning "any host" so every existing
ticket is unaffected. Guard it the way scripts/tests/rehearsal-queue-test.sh guards the
drive queue.

Worth considering alongside: the runner's fail-<n> counter cannot tell "this host can't
do it" from "this work is hard". A skip-for-wrong-host must not burn an attempt.

Why this is not urgent

#743's own need is now covered a different way — .forgejo/workflows/rented-cert-evidence.yml
(18bda3e9) is a dispatch-only read-only door that runs on elitebook-03 and posts the drive's
cert evidence to the tracker, so that evidence no longer needs a session on that host. This
ticket is the general gap that door works around, and the next host-specific
ready-for-session ticket will pay the same two attempts unless it is closed.

Filed by an agent session under ADR 0174 while working #743 (rule 1: file follow-ups, do not
widen the ticket).

The session queue has **no host affinity**, and #743 is what that costs. `.sandcastle/session-runner.sh` picks from `?labels=ready-for-session` and filters on `no-triage` / `deferred` / `agent-blocked` / `agent-working` / open dependencies — and nothing else. Whichever host ticks first claims the ticket. But `ready-for-session` exists (ADR 0174 §5) precisely for work that needs **a particular session's standing**: host credentials, live droplet doors, a host's own evidence directories. The label records *that* a host is needed; it cannot record *which*. ## What it cost #743 asks for eyes on two rented drives whose evidence lives on **elitebook-03**. Per `docs/agents/worker-classes.json`, session-runner's `hosts` is `[matou-workstation]` — elitebook-03 runs Forgejo Actions but no session-runner at all. So #743 was **unclaimable by the only host that could do it, and claimable by every host that could not**: - attempt 1 (2026-08-24 04:26Z) — `matou-workstation`: no `test-results/drive-rented`, no route to elitebook-03; - attempt 2 (2026-08-24 ~13:30Z) — `matou-dev-server-01`: a DigitalOcean droplet whose netbird mesh holds only its sibling dev servers. Two attempts is the runner's escalation cap, so a correctly-labelled ticket walks itself to `ready-for-human` without a human ever being the actual blocker. ## Shape of a fix (not ruled — this ticket is the ask) The cheapest thing that would have worked: an **opt-in host tag the picker honours**. A `host:<name>` label (or a `<!-- session-host: elitebook-03 -->` body marker, the shape `<!-- rehearsal-target/confirm -->` already uses on the drive issues) that the jq filter skips unless it matches this host, with no tag meaning "any host" so every existing ticket is unaffected. Guard it the way `scripts/tests/rehearsal-queue-test.sh` guards the drive queue. Worth considering alongside: the runner's `fail-<n>` counter cannot tell "this host can't do it" from "this work is hard". A skip-for-wrong-host must **not** burn an attempt. ## Why this is not urgent #743's own need is now covered a different way — `.forgejo/workflows/rented-cert-evidence.yml` (18bda3e9) is a dispatch-only read-only door that runs on elitebook-03 and posts the drive's cert evidence to the tracker, so that evidence no longer needs a session on that host. This ticket is the general gap that door works around, and the next host-specific `ready-for-session` ticket will pay the same two attempts unless it is closed. Filed by an agent session under ADR 0174 while working #743 (rule 1: file follow-ups, do not widen the ticket).
Author
Member

This was generated by AI during triage.

Routing: ready-for-session, not ready-for-agent. The fix lands in .sandcastle/session-runner.sh, a protected .sandcastle/ path (#445) — per docs/agents/triage-labels.md's ready-for-session role, that routes to an interactive session, never the swarm queue, regardless of how well-specified the work is.

Verified against the current script: the picker filters only on no-triage / deferred / agent-blocked / open dependencies and the two-attempt escalation counter — no host tag or host-matching logic exists anywhere in the claim path. The gap is real.

Agent Brief

Category: bug
Summary: The ready-for-session ticket picker has no host affinity, so a ticket needing a specific host's standing (credentials, mesh routes, local evidence) is claimable — and burned — by every host that cannot do the work.

Current behavior:
The picker selects from open ready-for-session issues (priority first, then oldest), skipping no-triage / deferred / agent-blocked and issues with open dependencies. It has no concept of which host a ticket needs. A ticket whose work is only possible on one host (e.g. it depends on that host's local evidence directory, netbird mesh membership, or credentials) is claimed by whichever host's session-runner ticks first. Two unadvanced attempts by wrong hosts exhausts the escalation cap and walks the ticket to ready-for-human, even though the correct host was never tried.

Desired behavior:
A ticket can optionally declare the host(s) it needs. The picker skips a ticket for a host that isn't in its declared set; a ticket with no declaration is claimable by any host (existing behavior, unaffected). A skip-for-wrong-host must not consume one of the ticket's two escalation attempts — only a genuine failed attempt by an eligible host should count against the cap.

Key interfaces:

  • The ticket-selection query/filter the runner applies before claiming (currently label- and dependency-based only) needs an additional host-match predicate.
  • Some declaration mechanism readable by the picker without a network round-trip per candidate — a label (e.g. host:<name>) is the cheapest shape (mirrors the <!-- rehearsal-target/confirm --> body-marker precedent already used elsewhere for machine-readable ticket metadata), but a body marker is also acceptable. No declaration = any host (unaffected default).
  • The attempt-counter / escalation logic must distinguish "this host can't do it" (not an attempt) from "this host tried and failed" (an attempt).

Acceptance criteria:

  • A ready-for-session ticket declaring a specific host is not claimed, and does not have an attempt burned, by a session-runner on a different host.
  • A ready-for-session ticket with no host declaration is claimed exactly as today (regression guard).
  • The correct host still claims and attempts the ticket normally.
  • A test in the style of scripts/tests/rehearsal-queue-test.sh covers: wrong-host skip (no attempt burned), right-host claim, and undeclared-ticket claim by any host.

Out of scope:

  • Changing the two-attempt escalation cap itself.
  • Any change to the ready-for-agent swarm queue (.sandcastle/list-ready-tasks.sh) — this is ready-for-session only.
  • Retroactively fixing #743 (already worked around via .forgejo/workflows/rented-cert-evidence.yml).
> *This was generated by AI during triage.* **Routing: `ready-for-session`, not `ready-for-agent`.** The fix lands in `.sandcastle/session-runner.sh`, a protected `.sandcastle/` path (#445) — per `docs/agents/triage-labels.md`'s `ready-for-session` role, that routes to an interactive session, never the swarm queue, regardless of how well-specified the work is. Verified against the current script: the picker filters only on `no-triage` / `deferred` / `agent-blocked` / open dependencies and the two-attempt escalation counter — no host tag or host-matching logic exists anywhere in the claim path. The gap is real. ## Agent Brief **Category:** bug **Summary:** The `ready-for-session` ticket picker has no host affinity, so a ticket needing a specific host's standing (credentials, mesh routes, local evidence) is claimable — and burned — by every host that cannot do the work. **Current behavior:** The picker selects from open `ready-for-session` issues (priority first, then oldest), skipping `no-triage` / `deferred` / `agent-blocked` and issues with open dependencies. It has no concept of *which* host a ticket needs. A ticket whose work is only possible on one host (e.g. it depends on that host's local evidence directory, netbird mesh membership, or credentials) is claimed by whichever host's session-runner ticks first. Two unadvanced attempts by wrong hosts exhausts the escalation cap and walks the ticket to `ready-for-human`, even though the correct host was never tried. **Desired behavior:** A ticket can optionally declare the host(s) it needs. The picker skips a ticket for a host that isn't in its declared set; a ticket with no declaration is claimable by any host (existing behavior, unaffected). A skip-for-wrong-host must not consume one of the ticket's two escalation attempts — only a genuine failed *attempt* by an eligible host should count against the cap. **Key interfaces:** - The ticket-selection query/filter the runner applies before claiming (currently label- and dependency-based only) needs an additional host-match predicate. - Some declaration mechanism readable by the picker without a network round-trip per candidate — a label (e.g. `host:<name>`) is the cheapest shape (mirrors the `<!-- rehearsal-target/confirm -->` body-marker precedent already used elsewhere for machine-readable ticket metadata), but a body marker is also acceptable. No declaration = any host (unaffected default). - The attempt-counter / escalation logic must distinguish "this host can't do it" (not an attempt) from "this host tried and failed" (an attempt). **Acceptance criteria:** - [ ] A `ready-for-session` ticket declaring a specific host is not claimed, and does not have an attempt burned, by a session-runner on a different host. - [ ] A `ready-for-session` ticket with no host declaration is claimed exactly as today (regression guard). - [ ] The correct host still claims and attempts the ticket normally. - [ ] A test in the style of `scripts/tests/rehearsal-queue-test.sh` covers: wrong-host skip (no attempt burned), right-host claim, and undeclared-ticket claim by any host. **Out of scope:** - Changing the two-attempt escalation cap itself. - Any change to the `ready-for-agent` swarm queue (`.sandcastle/list-ready-tasks.sh`) — this is `ready-for-session` only. - Retroactively fixing #743 (already worked around via `.forgejo/workflows/rented-cert-evidence.yml`).
Author
Member

Close report — the session queue now has host affinity

Landed as 44dc585b (idss) on top of Matou/dev-factory@29c2c94.

The ruling this needed first

The ticket asked for a change to .sandcastle/session-runner.sh. That file is a
FACTORY_MANIFEST entry, vendored byte-identical from Matou/dev-factory at
FACTORY_REF (ADR 0180) — editing it here is the ownership inversion that ADR retired, it
reds check-harness-drift.sh immediately, and it would be overwritten at the next pin bump.
The #664/#666 precedent is explicit about this. So the fix landed upstream and idss
re-vendored:

  • Matou/dev-factory#89 filed, worked, closed with its own close-report (29c2c94);
  • idss FACTORY_REF 343d26f → 29c2c94.

Ruled by agent under ADR 0174 — veto anytime. Two-way door on both sides: a commit in each
repo, revertible by reverting it; proved by an offline suite that was red before it and green
after.

What landed

New pure lib .sandcastle/session-host-lib.sh:

  • session_host_marker — the opt-in body marker, in the same HTML-comment shape the drive
    issues already use for <!-- rehearsal-target: … -->, exactly as this ticket proposed;
  • session_host_match — comma/space list, case-insensitive, tolerant of an FQDN on our side
    (elitebook-03 matches elitebook-03.lan, never elitebook-030);
  • session_host_self — SESSION_RUNNER_HOST → SWARM_HOST → hostname, the order the rest
    of the factory already resolves a host name in.

session-runner.sh honours it first in the pick loop:

<!-- session-host: elitebook-03 -->                    # only this host may pick it
<!-- session-host: elitebook-03, matou-workstation --> # either of these two
  • No marker means any host — every existing ticket is unaffected, which is what made this
    safe to land on a live queue.
  • Zero extra API calls. The queue read already carries .body (verified against the real
    tracker before writing a line), so the filter is served from the JSON in hand. Only the
    SESSION_RUNNER_PICK rollout path, which skips the queue read, pays a fetch. A body that
    cannot be read is empty — "any host", today's behaviour — never a hard fail.
  • A wrong-host skip burns no attempt. This ticket's "worth considering alongside" is
    implemented, not deferred: the check sits above the cooldown, fail-cap and dependency
    checks and long before the claim, the attempt marker and fail-<n>. A ticket pinned to
    another host is not this host's failed attempt; it is not this host's ticket at all.

Known cost, recorded rather than engineered around: a marker naming a host that never ticks
(a typo, a decommissioned box) sits in the queue indefinitely, visible only as a skip line in
every other host's runner log. Escape hatch: SESSION_RUNNER_HOST=<name> on the host that
should take it.

Proof

  • .sandcastle/tests/session-host-lib-test.sh — 7 checks over the pure core (extraction, the
    no-marker default, lists, case/FQDN matching, resolution order).
  • .sandcastle/tests/session-runner-test.sh group 19 — the wiring. 19a asserts the wrong
    host neither claims, nor starts a session, nor stamps an attempt marker, nor writes
    fail-<n>, nor records a swarm.db run row; 19b the named host works it to completion;
    19c an unmarked ticket is picked straight past a foreign pinned one (no queue blocking);
    19d a host list matches any member, the rule holds on the PICK path, and
    SESSION_RUNNER_HOST overrides.
  • Red before green: without the wiring, 19a fails with the wrong host picking and closing
    the pinned ticket — this ticket's bug, reproduced in the suite.
  • 19 groups green from inside .sandcastle/, check-harness-drift.sh OK at the new pin.

Two things this turned up

  1. session-runner-test.sh could not run here at all. It died silently after group 1 on a
    doubled prompt path (.sandcastle/.sandcastle/session-runner-prompt.md) — a
    consumer-layout bug already fixed upstream as dev-factory#87, which idss's stale pin had
    not picked up. The bump carries that fix, which is why this ticket's own regression is
    runnable here.
  2. docs/agents/worker-classes.json was wrong about this very question. session-runner's
    row has claimed a single host (matou-workstation) since 2026-08-20, but
    matou-dev-server-01 has been draining the same queue — proven by #743's attempt 2 and by
    this session, which ran on it. Corrected in the same commit, along with a stale lock
    description (pre repo-scoping, pre owner-lock) and the top-level host list.

docs/agents/triage-labels.md documents the marker under the ready-for-session role
(dev-factory's docs/** is factory-only by ruling, so a consumer keeps its own copy).

Filed, not widened (rule 1)

Matou/dev-factory#90 — heal-test.sh and claude-call-guards-test.sh red on a busy host:
their run helpers inherit the host's live rehearsal-drive reservation instead of pinning
HOST_CAPACITY_DRIVE_WANTED. Red on a clean tree at both pins, so unrelated to this change;
diagnosed to the exact line and filed rather than fixed here.

Not touched: #743's own fail counters on the two hosts that burned them, and #743 itself
(already covered by .forgejo/workflows/rented-cert-evidence.yml, as this ticket notes).

## Close report — the session queue now has host affinity Landed as `44dc585b` (idss) on top of `Matou/dev-factory@29c2c94`. ### The ruling this needed first The ticket asked for a change to `.sandcastle/session-runner.sh`. That file is a `FACTORY_MANIFEST` entry, vendored **byte-identical** from `Matou/dev-factory` at `FACTORY_REF` (ADR 0180) — editing it here is the ownership inversion that ADR retired, it reds `check-harness-drift.sh` immediately, and it would be overwritten at the next pin bump. The #664/#666 precedent is explicit about this. So the fix landed **upstream** and idss re-vendored: - `Matou/dev-factory#89` filed, worked, closed with its own close-report (`29c2c94`); - idss `FACTORY_REF` `343d26f` → `29c2c94`. Ruled by agent under ADR 0174 — veto anytime. Two-way door on both sides: a commit in each repo, revertible by reverting it; proved by an offline suite that was red before it and green after. ### What landed New pure lib `.sandcastle/session-host-lib.sh`: - `session_host_marker` — the opt-in body marker, in the same HTML-comment shape the drive issues already use for `<!-- rehearsal-target: … -->`, exactly as this ticket proposed; - `session_host_match` — comma/space list, case-insensitive, tolerant of an FQDN on our side (`elitebook-03` matches `elitebook-03.lan`, never `elitebook-030`); - `session_host_self` — `SESSION_RUNNER_HOST` → `SWARM_HOST` → `hostname`, the order the rest of the factory already resolves a host name in. `session-runner.sh` honours it **first** in the pick loop: ``` <!-- session-host: elitebook-03 --> # only this host may pick it <!-- session-host: elitebook-03, matou-workstation --> # either of these two ``` - **No marker means any host** — every existing ticket is unaffected, which is what made this safe to land on a live queue. - **Zero extra API calls.** The queue read already carries `.body` (verified against the real tracker before writing a line), so the filter is served from the JSON in hand. Only the `SESSION_RUNNER_PICK` rollout path, which skips the queue read, pays a fetch. A body that cannot be read is empty — "any host", today's behaviour — never a hard fail. - **A wrong-host skip burns no attempt.** This ticket's "worth considering alongside" is implemented, not deferred: the check sits above the cooldown, fail-cap and dependency checks and long before the claim, the attempt marker and `fail-<n>`. A ticket pinned to another host is not this host's failed attempt; it is not this host's ticket at all. Known cost, recorded rather than engineered around: a marker naming a host that never ticks (a typo, a decommissioned box) sits in the queue indefinitely, visible only as a skip line in every other host's runner log. Escape hatch: `SESSION_RUNNER_HOST=<name>` on the host that should take it. ### Proof - `.sandcastle/tests/session-host-lib-test.sh` — 7 checks over the pure core (extraction, the no-marker default, lists, case/FQDN matching, resolution order). - `.sandcastle/tests/session-runner-test.sh` group 19 — the wiring. **19a** asserts the wrong host neither claims, nor starts a session, nor stamps an attempt marker, nor writes `fail-<n>`, nor records a swarm.db run row; **19b** the named host works it to completion; **19c** an unmarked ticket is picked straight past a foreign pinned one (no queue blocking); **19d** a host list matches any member, the rule holds on the `PICK` path, and `SESSION_RUNNER_HOST` overrides. - Red before green: without the wiring, 19a fails with the wrong host picking **and closing** the pinned ticket — this ticket's bug, reproduced in the suite. - 19 groups green from inside `.sandcastle/`, `check-harness-drift.sh` OK at the new pin. ### Two things this turned up 1. **`session-runner-test.sh` could not run here at all.** It died silently after group 1 on a doubled prompt path (`.sandcastle/.sandcastle/session-runner-prompt.md`) — a consumer-layout bug already fixed upstream as `dev-factory#87`, which idss's stale pin had not picked up. The bump carries that fix, which is why this ticket's own regression is runnable here. 2. **`docs/agents/worker-classes.json` was wrong about this very question.** session-runner's row has claimed a single host (`matou-workstation`) since 2026-08-20, but `matou-dev-server-01` has been draining the same queue — proven by #743's attempt 2 and by this session, which ran on it. Corrected in the same commit, along with a stale lock description (pre repo-scoping, pre owner-lock) and the top-level host list. `docs/agents/triage-labels.md` documents the marker under the `ready-for-session` role (dev-factory's `docs/**` is factory-only by ruling, so a consumer keeps its own copy). ### Filed, not widened (rule 1) `Matou/dev-factory#90` — `heal-test.sh` and `claude-call-guards-test.sh` red on a busy host: their run helpers inherit the host's live rehearsal-drive reservation instead of pinning `HOST_CAPACITY_DRIVE_WANTED`. Red on a clean tree at both pins, so unrelated to this change; diagnosed to the exact line and filed rather than fixed here. Not touched: #743's own fail counters on the two hosts that burned them, and #743 itself (already covered by `.forgejo/workflows/rented-cert-evidence.yml`, as this ticket notes).
matou-build-agent 2026-08-26 02:00:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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/idss#746
No description provided.