Harness calls into the consumer-owned identity file with no contract check — #19 broke every session-runner tick silently (swarm_git_identity: command not found) #31

Closed
opened 2026-08-23 12:33:30 +00:00 by ben · 2 comments
Owner

Symptom

After the self-pin bump to 12401a9, dev-factory's session-runner cron (matou-workstation) picked a ticket every tick and died: session-runner.sh: line 175: swarm_git_identity: command not found — ~15 consecutive ticks, no claim, no escalation, nothing posted anywhere. Found only by reading the host log.

Cause

#19 made vendored harness scripts (session-runner.sh, heal.sh, run-swarm.sh) call swarm_git_identity, a function defined in the consumer-owned swarm-identity.sh (vendor-exclude). The generator (onboard.sh identity) was updated, but existing consumers' copies were not — and nothing detects that a harness pin now requires a newer identity-layer contract. idss and matou-app will hit this at their next pin bump; dev-factory was fixed by regenerating its copy (see the commit referencing this ticket).

Fix

  • Contract check at the seam: swarm-identity.sh's generator stamps SWARM_IDENTITY_CONTRACT=<n>; a tiny identity-lib.sh (vendored) exposes identity_require <n> that every harness entry point calls right after sourcing the identity file — exit 2 with identity: swarm-identity.sh is contract <have>, this harness needs <need> — re-run: onboard.sh identity <slug> .sandcastle/swarm-identity.sh. Bump the constant whenever the harness adds a required identity symbol.
  • Hard-fail fallback for this symbol: until consumers regenerate, session-runner.sh/heal.sh/run-swarm.sh guard with command -v swarm_git_identity >/dev/null || { echo "...re-run onboard.sh identity..." >&2; exit 2; } so the failure names the fix instead of bash's command not found.
  • Vendor advisory: onboard.sh vendor (and check-harness-drift.sh's advisory line) compares the target's SWARM_IDENTITY_CONTRACT with the pinned ref's required contract and prints WARNING: identity layer behind — run onboard.sh identity.
  • Loud, not silent: a session-runner tick that dies before claiming must post ONE Mattermost line (rate-limited per signature like the healer) — a drainer that fails every tick for hours without a trace is the hazard here. GOTCHAS entry.
  • Tests: tests/swarm-identity-test.sh contract-mismatch case; tests/session-runner-test.sh missing-function case names the fix; vendor-test advisory case.

Acceptance

  • An identity file without swarm_git_identity makes session-runner.sh exit 2 with the regenerate instruction (shimmed test), and onboard.sh vendor prints the WARNING; idss/matou-app get the regenerate step in their next pin-bump instructions.
## Symptom After the self-pin bump to `12401a9`, dev-factory's session-runner cron (matou-workstation) picked a ticket every tick and died: `session-runner.sh: line 175: swarm_git_identity: command not found` — ~15 consecutive ticks, no claim, no escalation, nothing posted anywhere. Found only by reading the host log. ## Cause #19 made vendored harness scripts (`session-runner.sh`, `heal.sh`, `run-swarm.sh`) call `swarm_git_identity`, a function defined in the **consumer-owned** `swarm-identity.sh` (vendor-exclude). The generator (`onboard.sh identity`) was updated, but existing consumers' copies were not — and nothing detects that a harness pin now requires a newer identity-layer contract. idss and matou-app will hit this at their next pin bump; dev-factory was fixed by regenerating its copy (see the commit referencing this ticket). ## Fix - **Contract check at the seam:** `swarm-identity.sh`'s generator stamps `SWARM_IDENTITY_CONTRACT=<n>`; a tiny `identity-lib.sh` (vendored) exposes `identity_require <n>` that every harness entry point calls right after sourcing the identity file — exit 2 with `identity: swarm-identity.sh is contract <have>, this harness needs <need> — re-run: onboard.sh identity <slug> .sandcastle/swarm-identity.sh`. Bump the constant whenever the harness adds a required identity symbol. - **Hard-fail fallback for this symbol:** until consumers regenerate, `session-runner.sh`/`heal.sh`/`run-swarm.sh` guard with `command -v swarm_git_identity >/dev/null || { echo "...re-run onboard.sh identity..." >&2; exit 2; }` so the failure names the fix instead of bash's `command not found`. - **Vendor advisory:** `onboard.sh vendor` (and `check-harness-drift.sh`'s advisory line) compares the target's `SWARM_IDENTITY_CONTRACT` with the pinned ref's required contract and prints `WARNING: identity layer behind — run onboard.sh identity`. - **Loud, not silent:** a session-runner tick that dies before claiming must post ONE Mattermost line (rate-limited per signature like the healer) — a drainer that fails every tick for hours without a trace is the hazard here. GOTCHAS entry. - Tests: `tests/swarm-identity-test.sh` contract-mismatch case; `tests/session-runner-test.sh` missing-function case names the fix; vendor-test advisory case. ## Acceptance - An identity file without `swarm_git_identity` makes `session-runner.sh` exit 2 with the regenerate instruction (shimmed test), and `onboard.sh vendor` prints the WARNING; idss/matou-app get the regenerate step in their next pin-bump instructions.

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

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

close-report for #31 — status success

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

envelope
{
  "issue": 31,
  "status": "success",
  "commits": [
    "b4e865af84f4a9d0233a0d4d183be963d4d7c6d3"
  ],
  "changed_files": [
    "STATUS.md",
    "check-harness-drift.sh",
    "docs/GOTCHAS.md",
    "heal.sh",
    "identity-lib.sh",
    "onboarding/onboard-lib.sh",
    "onboarding/tests/onboard-lib-test.sh",
    "onboarding/vendor-manifest",
    "run-swarm.sh",
    "session-runner.sh",
    "swarm-identity.sh",
    "tests/check-harness-drift-test.sh",
    "tests/identity-lib-test.sh",
    "tests/session-runner-test.sh",
    "tests/swarm-identity-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/identity-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/swarm-identity-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/check-harness-drift-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/onboard-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/vendor-manifest-coverage-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": {
    "Contract check at the seam: identity_require <n> called after sourcing the identity file, exit 2 with the exact regenerate message": "New vendored identity-lib.sh declares IDENTITY_CONTRACT=1 and identity_require [need]; an absent/older SWARM_IDENTITY_CONTRACT stamp (folded to 0) returns 2 naming 'identity: swarm-identity.sh is contract <have>, this harness needs <need> — re-run: onboard.sh identity <slug> .sandcastle/swarm-identity.sh'. Sourced + called in session-runner.sh, heal.sh, run-swarm.sh. Proven by tests/identity-lib-test.sh (8 groups) and tests/swarm-identity-test.sh case 7.",
    "Hard-fail fallback for swarm_git_identity: command -v guard in session-runner.sh/heal.sh/run-swarm.sh naming the fix": "Each of the three scripts carries 'command -v swarm_git_identity >/dev/null || { echo \"...re-run: onboard.sh identity...\"; exit 2; }' right before its swarm_git_identity call (session-runner.sh, heal.sh, run-swarm.sh).",
    "swarm-identity.sh generator stamps SWARM_IDENTITY_CONTRACT=<n>": "swarm-identity.sh and onboard_gen_identity (onboarding/onboard-lib.sh) both stamp SWARM_IDENTITY_CONTRACT=1; asserted by tests/swarm-identity-test.sh case 7 and onboard-lib-test gen_identity cases.",
    "Vendor advisory: onboard.sh vendor and check-harness-drift.sh compare contracts and print WARNING: identity layer behind": "onboard_vendor and check-harness-drift.sh compare the pinned harness's IDENTITY_CONTRACT with the target's SWARM_IDENTITY_CONTRACT stamp and print 'WARNING: identity layer behind ...' (advisory, exit 0). Proven by onboard-lib-test vendor-advisory cases and check-harness-drift-test T6.",
    "Loud, not silent: a session-runner tick that dies before claiming posts ONE Mattermost line, rate-limited per signature": "session_runner_alarm() posts one rate-limited (SESSION_RUNNER_ALARM_COOLDOWN, per cksum signature) Mattermost line; the identity seam is its first caller. Proven by tests/session-runner-test.sh case 12 (exits 2 before any API call, names the fix, second tick within cooldown does not repost).",
    "GOTCHAS entry": "docs/GOTCHAS.md #12 records the silent command-not-found hazard, cause, and rule.",
    "Acceptance: an identity file without swarm_git_identity makes session-runner.sh exit 2 with the regenerate instruction (shimmed test)": "tests/session-runner-test.sh case 12: a pre-#19 fixture identity file (no stamp, no function) via SWARM_IDENTITY_FILE makes session-runner.sh exit 2 with 'is contract 0, this harness needs 1' + the onboard.sh identity command, before any curl/claude call.",
    "Acceptance: onboard.sh vendor prints the WARNING": "onboarding/tests/onboard-lib-test.sh identity-advisory case: a target stamped behind the pin's required contract yields 'WARNING: identity layer behind' with exit 0.",
    "Acceptance: idss/matou-app get the regenerate step in their next pin bump": "The vendor + drift-check advisory WARNING is exactly what surfaces at their next pin bump; recorded in STATUS.md and GOTCHAS 12."
  },
  "summary": "The harness↔identity-file seam is now a loud, versioned contract (identity-lib.sh identity_require + SWARM_IDENTITY_CONTRACT stamp + vendor/drift advisory + a rate-limited dead-tick alarm) so #19's silent swarm_git_identity command-not-found cannot recur.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #31 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 31, "status": "success", "commits": [ "b4e865af84f4a9d0233a0d4d183be963d4d7c6d3" ], "changed_files": [ "STATUS.md", "check-harness-drift.sh", "docs/GOTCHAS.md", "heal.sh", "identity-lib.sh", "onboarding/onboard-lib.sh", "onboarding/tests/onboard-lib-test.sh", "onboarding/vendor-manifest", "run-swarm.sh", "session-runner.sh", "swarm-identity.sh", "tests/check-harness-drift-test.sh", "tests/identity-lib-test.sh", "tests/session-runner-test.sh", "tests/swarm-identity-test.sh" ], "tests": [ { "command": "bash tests/identity-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/swarm-identity-test.sh", "exit_code": 0 }, { "command": "bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "bash tests/check-harness-drift-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/onboard-lib-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/vendor-manifest-coverage-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": { "Contract check at the seam: identity_require <n> called after sourcing the identity file, exit 2 with the exact regenerate message": "New vendored identity-lib.sh declares IDENTITY_CONTRACT=1 and identity_require [need]; an absent/older SWARM_IDENTITY_CONTRACT stamp (folded to 0) returns 2 naming 'identity: swarm-identity.sh is contract <have>, this harness needs <need> — re-run: onboard.sh identity <slug> .sandcastle/swarm-identity.sh'. Sourced + called in session-runner.sh, heal.sh, run-swarm.sh. Proven by tests/identity-lib-test.sh (8 groups) and tests/swarm-identity-test.sh case 7.", "Hard-fail fallback for swarm_git_identity: command -v guard in session-runner.sh/heal.sh/run-swarm.sh naming the fix": "Each of the three scripts carries 'command -v swarm_git_identity >/dev/null || { echo \"...re-run: onboard.sh identity...\"; exit 2; }' right before its swarm_git_identity call (session-runner.sh, heal.sh, run-swarm.sh).", "swarm-identity.sh generator stamps SWARM_IDENTITY_CONTRACT=<n>": "swarm-identity.sh and onboard_gen_identity (onboarding/onboard-lib.sh) both stamp SWARM_IDENTITY_CONTRACT=1; asserted by tests/swarm-identity-test.sh case 7 and onboard-lib-test gen_identity cases.", "Vendor advisory: onboard.sh vendor and check-harness-drift.sh compare contracts and print WARNING: identity layer behind": "onboard_vendor and check-harness-drift.sh compare the pinned harness's IDENTITY_CONTRACT with the target's SWARM_IDENTITY_CONTRACT stamp and print 'WARNING: identity layer behind ...' (advisory, exit 0). Proven by onboard-lib-test vendor-advisory cases and check-harness-drift-test T6.", "Loud, not silent: a session-runner tick that dies before claiming posts ONE Mattermost line, rate-limited per signature": "session_runner_alarm() posts one rate-limited (SESSION_RUNNER_ALARM_COOLDOWN, per cksum signature) Mattermost line; the identity seam is its first caller. Proven by tests/session-runner-test.sh case 12 (exits 2 before any API call, names the fix, second tick within cooldown does not repost).", "GOTCHAS entry": "docs/GOTCHAS.md #12 records the silent command-not-found hazard, cause, and rule.", "Acceptance: an identity file without swarm_git_identity makes session-runner.sh exit 2 with the regenerate instruction (shimmed test)": "tests/session-runner-test.sh case 12: a pre-#19 fixture identity file (no stamp, no function) via SWARM_IDENTITY_FILE makes session-runner.sh exit 2 with 'is contract 0, this harness needs 1' + the onboard.sh identity command, before any curl/claude call.", "Acceptance: onboard.sh vendor prints the WARNING": "onboarding/tests/onboard-lib-test.sh identity-advisory case: a target stamped behind the pin's required contract yields 'WARNING: identity layer behind' with exit 0.", "Acceptance: idss/matou-app get the regenerate step in their next pin bump": "The vendor + drift-check advisory WARNING is exactly what surfaces at their next pin bump; recorded in STATUS.md and GOTCHAS 12." }, "summary": "The harness↔identity-file seam is now a loud, versioned contract (identity-lib.sh identity_require + SWARM_IDENTITY_CONTRACT stamp + vendor/drift advisory + a rate-limited dead-tick alarm) so #19's silent swarm_git_identity command-not-found cannot recur.", "reason": "", "blockers": [], "no_code_change": "" } ``` </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#31
No description provided.