session-runner: a SIGKILLed session leaks its agent-working claim forever — no stale-claim sweep, the ticket goes invisible to every tick #63

Closed
opened 2026-08-24 18:33:22 +00:00 by ben · 3 comments
Owner

Symptom

#61 was claimed (agent-working) by the session-runner on matou-dev-server-01 and its session died without the EXIT trap running (SIGKILL/OOM/reboot class). The claim label stayed on; the picker excludes agent-working, so the ticket became invisible to EVERY future tick — silently, forever (found by eye ~1 h later; released by hand). #56 was picked and completed around the stale claim, proving the runner itself was healthy.

Fix

  • A stale-claim sweep at the top of each tick, before the pick: for every ready-for-session issue carrying agent-working, if THIS host owns the repo's session slot (registry) and no session is live under the repo-scoped lock, and the ticket's attempt-$n marker is older than SESSION_RUNNER_TIMEOUT+slack → DELETE the label, bump fail-$n (it WAS a failed attempt), log one line. The existing two-failure escalation then still fires on genuine repeat deaths.
  • The sweep must never touch another repo's/host's claims (registry says who owns the slot) nor a claim younger than the timeout (a live session on a slow ticket).
  • tests/session-runner-test.sh: stale-claim released + fail counter bumped; fresh claim untouched; foreign-slot claim untouched.

Acceptance

  • Shimmed: a tick against a queue whose only ticket carries a stale agent-working releases it, counts the failure, and picks it (or escalates on the second); full suite green.
## Symptom #61 was claimed (`agent-working`) by the session-runner on matou-dev-server-01 and its session died without the EXIT trap running (SIGKILL/OOM/reboot class). The claim label stayed on; the picker excludes `agent-working`, so the ticket became invisible to EVERY future tick — silently, forever (found by eye ~1 h later; released by hand). #56 was picked and completed around the stale claim, proving the runner itself was healthy. ## Fix - A stale-claim sweep at the top of each tick, before the pick: for every `ready-for-session` issue carrying `agent-working`, if THIS host owns the repo's session slot (registry) and no session is live under the repo-scoped lock, and the ticket's `attempt-$n` marker is older than `SESSION_RUNNER_TIMEOUT`+slack → DELETE the label, bump `fail-$n` (it WAS a failed attempt), log one line. The existing two-failure escalation then still fires on genuine repeat deaths. - The sweep must never touch another repo's/host's claims (registry says who owns the slot) nor a claim younger than the timeout (a live session on a slow ticket). - `tests/session-runner-test.sh`: stale-claim released + fail counter bumped; fresh claim untouched; foreign-slot claim untouched. ## Acceptance - Shimmed: a tick against a queue whose only ticket carries a stale `agent-working` releases it, counts the failure, and picks it (or escalates on the second); full suite green.

swarm-claim host=matou-dev-server-01 run=721
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=721 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #63 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit b9e036c5e8 is not reachable from origin/main (not landed)
  • changed_files: 'session-runner.sh' is not in the diff of the claimed commits
  • changed_files: 'tests/session-runner-test.sh' is not in the diff of the claimed commits
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
  • changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits
envelope
{
  "issue": 63,
  "status": "success",
  "commits": [
    "b9e036c5e8e3ad87fab413af74dc4a69594e7d13"
  ],
  "changed_files": [
    "session-runner.sh",
    "tests/session-runner-test.sh",
    "STATUS.md",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Stale-claim sweep at the top of each tick, before the pick, releasing agent-working": "session-runner.sh sweep block before the pick; iterates ready-for-session issues carrying agent-working and DELETEs the label",
    "Only this host's slot (registry), no live session under repo-scoped lock, marker older than SESSION_RUNNER_TIMEOUT+slack": "ownership proven by the LOCAL repo-scoped+host-local attempt-$n marker; flock held above; age gated on SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK (300s)",
    "Bump fail-$n (it was a failed attempt), log one line": "sweep bumps fail-$sn and echoes one 'stale agent-working claim ... releasing and counting the failed attempt (#63)' line",
    "Two-failure escalation still fires on genuine repeat deaths": "shared session_runner_escalate() called from the sweep when fail>=2; refactored the outcome path to reuse it; test 16c",
    "Never touch another repo's/host's claim nor a claim younger than the timeout": "test 16a: #10 (no local marker) and #41 (fresh marker) both left untouched",
    "tests: stale-claim released + fail bumped; fresh untouched; foreign-slot untouched": "tests/session-runner-test.sh group 16a",
    "Acceptance: shimmed tick releases, counts, and picks it (or escalates on the second); full suite green": "test 16b (released then picked in one tick) + 16c (escalates on second); full offline suite green"
  },
  "summary": "session-runner.sh now sweeps stale agent-working claims a dead session left behind, before the pick, releasing+counting only this host's own timed-out attempts.",
  "blockers": []
}
**close-report** for #63 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit b9e036c5e8e3ad87fab413af74dc4a69594e7d13 is not reachable from origin/main (not landed) - changed_files: 'session-runner.sh' is not in the diff of the claimed commits - changed_files: 'tests/session-runner-test.sh' is not in the diff of the claimed commits - changed_files: 'STATUS.md' is not in the diff of the claimed commits - changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 63, "status": "success", "commits": [ "b9e036c5e8e3ad87fab413af74dc4a69594e7d13" ], "changed_files": [ "session-runner.sh", "tests/session-runner-test.sh", "STATUS.md", "docs/GOTCHAS.md" ], "tests": [ { "command": "bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done", "exit_code": 0 } ], "criteria": { "Stale-claim sweep at the top of each tick, before the pick, releasing agent-working": "session-runner.sh sweep block before the pick; iterates ready-for-session issues carrying agent-working and DELETEs the label", "Only this host's slot (registry), no live session under repo-scoped lock, marker older than SESSION_RUNNER_TIMEOUT+slack": "ownership proven by the LOCAL repo-scoped+host-local attempt-$n marker; flock held above; age gated on SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK (300s)", "Bump fail-$n (it was a failed attempt), log one line": "sweep bumps fail-$sn and echoes one 'stale agent-working claim ... releasing and counting the failed attempt (#63)' line", "Two-failure escalation still fires on genuine repeat deaths": "shared session_runner_escalate() called from the sweep when fail>=2; refactored the outcome path to reuse it; test 16c", "Never touch another repo's/host's claim nor a claim younger than the timeout": "test 16a: #10 (no local marker) and #41 (fresh marker) both left untouched", "tests: stale-claim released + fail bumped; fresh untouched; foreign-slot untouched": "tests/session-runner-test.sh group 16a", "Acceptance: shimmed tick releases, counts, and picks it (or escalates on the second); full suite green": "test 16b (released then picked in one tick) + 16c (escalates on second); full offline suite green" }, "summary": "session-runner.sh now sweeps stale agent-working claims a dead session left behind, before the pick, releasing+counting only this host's own timed-out attempts.", "blockers": [] } ``` </details>

close-report for #63 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 63,
  "status": "success",
  "commits": [
    "b9e036c5e8e3ad87fab413af74dc4a69594e7d13"
  ],
  "changed_files": [
    "session-runner.sh",
    "tests/session-runner-test.sh",
    "STATUS.md",
    "docs/GOTCHAS.md"
  ],
  "tests": [
    {
      "command": "bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Stale-claim sweep at the top of each tick, before the pick, releasing agent-working": "session-runner.sh sweep block before the pick; iterates ready-for-session issues carrying agent-working and DELETEs the label",
    "Only this host's slot (registry), no live session under repo-scoped lock, marker older than SESSION_RUNNER_TIMEOUT+slack": "ownership proven by the LOCAL repo-scoped+host-local attempt-$n marker; flock held above; age gated on SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK (300s)",
    "Bump fail-$n (it was a failed attempt), log one line": "sweep bumps fail-$sn and echoes one 'stale agent-working claim ... releasing and counting the failed attempt (#63)' line",
    "Two-failure escalation still fires on genuine repeat deaths": "shared session_runner_escalate() called from the sweep when fail>=2; refactored the outcome path to reuse it; test 16c",
    "Never touch another repo's/host's claim nor a claim younger than the timeout": "test 16a: #10 (no local marker) and #41 (fresh marker) both left untouched",
    "tests: stale-claim released + fail bumped; fresh untouched; foreign-slot untouched": "tests/session-runner-test.sh group 16a",
    "Acceptance: shimmed tick releases, counts, and picks it (or escalates on the second); full suite green": "test 16b (released then picked in one tick) + 16c (escalates on second); full offline suite green"
  },
  "summary": "session-runner.sh now sweeps stale agent-working claims a dead session left behind, before the pick, releasing+counting only this host's own timed-out attempts.",
  "blockers": []
}
**close-report** for #63 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 63, "status": "success", "commits": [ "b9e036c5e8e3ad87fab413af74dc4a69594e7d13" ], "changed_files": [ "session-runner.sh", "tests/session-runner-test.sh", "STATUS.md", "docs/GOTCHAS.md" ], "tests": [ { "command": "bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\"; done", "exit_code": 0 } ], "criteria": { "Stale-claim sweep at the top of each tick, before the pick, releasing agent-working": "session-runner.sh sweep block before the pick; iterates ready-for-session issues carrying agent-working and DELETEs the label", "Only this host's slot (registry), no live session under repo-scoped lock, marker older than SESSION_RUNNER_TIMEOUT+slack": "ownership proven by the LOCAL repo-scoped+host-local attempt-$n marker; flock held above; age gated on SESSION_RUNNER_TIMEOUT + SESSION_RUNNER_STALE_SLACK (300s)", "Bump fail-$n (it was a failed attempt), log one line": "sweep bumps fail-$sn and echoes one 'stale agent-working claim ... releasing and counting the failed attempt (#63)' line", "Two-failure escalation still fires on genuine repeat deaths": "shared session_runner_escalate() called from the sweep when fail>=2; refactored the outcome path to reuse it; test 16c", "Never touch another repo's/host's claim nor a claim younger than the timeout": "test 16a: #10 (no local marker) and #41 (fresh marker) both left untouched", "tests: stale-claim released + fail bumped; fresh untouched; foreign-slot untouched": "tests/session-runner-test.sh group 16a", "Acceptance: shimmed tick releases, counts, and picks it (or escalates on the second); full suite green": "test 16b (released then picked in one tick) + 16c (escalates on second); full offline suite green" }, "summary": "session-runner.sh now sweeps stale agent-working claims a dead session left behind, before the pick, releasing+counting only this host's own timed-out attempts.", "blockers": [] } ``` </details>
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#63
No description provided.