healer: early-fail incidents (no verdict) collapse onto the bare workflow-name signature, defeating per-fault ledger tracking #639
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#639
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
The swarm/triage healer's incident ledger keys every failure that happens
before
run-swarm.sh/run-triage.shproduces a verdict onto onedegraded, workflow-name-only signature (
096ffba7729cfor idss). Thiscollapses genuinely distinct early-fail causes — a dead Claude auth session
(the
7d836350repair), a per-repo-workdir git race (#638), a preflightfixture failure, etc. — into a single bucket the ledger cannot distinguish.
Why this matters
.sandcastle/.state/healer/096ffba7729c'srepaired=1after the auth-sessionfix made #638's unrelated git-race recurrence look like "the same fault
recurred after repair" — a false equivalence purely because the signature
degrades to the workflow name whenever no worker log / run verdict exists to
derive a sharper key from. This defeats the ledger's per-fault tracking and
risks a real repair being judged ineffective (or a new fault being silently
folded into an old repair's accounting) whenever the failure happens early.
Proposed direction (not a ruling — needs scoping)
Key early-fail incidents (no verdict, no worker log) on a coarse stage
tag derived from whatever IS available even without a verdict — e.g. which
step failed (git-setup vs. preflight vs. claim), exit code, or a grep over
the raw job log for a known-early marker — instead of collapsing to the bare
workflow name. Needs a design pass over
.sandcastle/heal.sh/heal-lib.sh'ssignature derivation before implementation; out of scope for #638, which only
fixes the workdir race itself.
Origin
Filed as the "Secondary" note on #638 (harness: swarm/triage matrix jobs race
on the shared per-repo git workdir), split out because it touches the
healer's classification logic rather than the locking model #638 fixes.
Ruled by agent under ADR 0174 — veto anytime
Ruling: scope the "coarse stage tag" this ticket asks for as: derive it from
evidence
gather_evidencealready collects (the worker-log tail, theforgejo-runnerjournal slice, the workdir git status) via a small, fixedtable of known early-fail markers — e.g. a git ref/
index.lockcontentionmessage (#638's class), a Claude auth/usage-limit refusal marker (the
7d836350class), a preflight-fixture failure marker. Try this lookup insidethe no-fresh-verdict branch of the signature's raw-material step, before
degrading to the bare workflow name; fall through to today's degraded
behavior (bare name + the honesty marker on every post) only when no known
marker matches. No new evidence sources (e.g. querying a job-log API) are
needed for the two motivating cases in this ticket's body.
Why this is a two-way door: it's a pure function change over already-
gathered, already-offline-testable evidence (the same shape as
compute_signature/seam_verdict_signal, both already unit-tested withouta live run). It's revertible with a single commit and changes no
credentials, no security posture, no member-facing surface, and destroys no
data — none of the ADR 0174 one-way-door classes apply.
What proves it: the offline
heal-lib-test.shharness, extended withcases for each known marker plus a no-match case — the two motivating
incidents in this ticket (#638's git-workdir race and the auth-refusal
repair) must key onto distinct signatures from each other and from the bare
workflow-name signature when replayed through representative evidence, while
an unrecognized early fail still degrades exactly as it does today.
Agent Brief
Category: bug
Summary: Early-fail healer incidents (no run verdict) collapse onto the
bare workflow-name signature; key them on a coarse stage tag derived from
already-gathered evidence instead.
Why
ready-for-session, notready-for-agent: the fix lives entirelyinside the healer's own signature-derivation logic, which is a protected
path under #445 — swarm workers cannot edit it. This mirrors sibling ticket
#638's routing.
Current behavior:
When the triggering workflow is one that's expected to drop a run-verdict
artifact (e.g.
swarm/triage/ci) but no fresh verdict exists yet — thejob failed before the run produced one — the signature's raw-material step
gives up immediately: it leaves an honesty marker noting the signature is
"degraded" and contributes nothing beyond the bare workflow name. Every
early failure for that workflow, regardless of actual cause, hashes to the
same incident signature. This lets an unrelated new fault get treated as
"the same fault recurred after a repair" purely because both happened to
fail early.
Desired behavior:
Before giving up, the no-fresh-verdict path checks the evidence already
gathered for this run (worker-log tail, runner journal slice, workdir git
status) against a small fixed table of known early-fail marker patterns and,
on a match, folds a short stage tag for that marker into the signature's
raw material. The existing "signature degraded" honesty marker is only
emitted when no known marker matches (true unknown-cause case) — a
matched, tagged signature does not need it, since the ledger now really can
distinguish this cause from others. When no marker matches, current
behavior (bare workflow name, full degraded warning) is unchanged.
Key interfaces:
verdict artifact's own stage/error line, (b) on no fresh verdict, degrades
to empty (workflow name only) and records that the signature is degraded,
(c) for workflows with no verdict artifact at all, falls back to grepping
recent worker-log lines for generic error markers. The new stage-tag
lookup slots into (b), between "no fresh verdict" and "give up."
pattern → short stage-tag string), not a general classifier — mirror the
existing style of fixed-pattern helpers in this file (e.g. the normalizer's
fixed substitution rules).
step already writes to disk for this run.
Acceptance criteria:
index.lockcontention message (#638's class) produces a signature distinct from
the bare-workflow-name signature, and distinct from the auth-refusal
case below
limit refusal marker (the
7d836350class) produces a signature distinctfrom both the git-race case and the bare-workflow-name signature
reproduces exactly today's behavior: signature degrades to the bare
workflow name, and the "signature degraded" honesty marker is still
set
marker (the ledger has real information now)
heal-lib-test.shassertions for workflows that DO have afresh verdict artifact are unaffected
Out of scope:
ci/swarm/triagewith a validverdict artifact keep their current, sharper signature derivation
untouched)
to a job-log API) — stay scoped to what's already on disk for the run
Ruled by agent under ADR 0174 — veto anytime.
Ruling: two-way door — a revertible commit to
.forgejo/workflows/{swarm,triage}.yml(CI config) plus a new, non-vendored.sandcastle/git-setup.sh, proven offline by.sandcastle/tests/git-setup-test.sh(no network, no live droplet, no credential/security-posture change). Landing directly, per rule 1.Design chosen over the ticket's proposed "grep the runner journal for known-early markers" direction: the git-setup block is executed by the SAME per-repo checkout
verdict-lib.shalready lives in (post the #638 workdir-lock fix, nothing else mutates it concurrently at that point), so the fix reuses the existing, testedverdict_begin/verdict_stage/verdict_write+seam_verdict_signal/compute_signaturepipeline (#235) verbatim instead of inventing a new heuristic..sandcastle/git-setup.shnow runs the clone/fetch/checkout/reset block and, on failure, drops astage=git-setup (…)verdict at the SAME$SWARM_VERDICT_PATH/$TRIAGE_VERDICT_PATHheal.sh already reads — zero changes toheal.sh/heal-lib.shthemselves (both are factory-vendored byte-identical fromMatou/dev-factory; hand-editing them would driftcheck-harness-drift.sh, so a heal-lib.sh-side heuristic was the wrong home regardless).Proof:
.sandcastle/tests/git-setup-test.sh(4 offline scenarios, no network) — a clean run leaves no verdict; a nonexistent-remote failure and a missing-branch failure produce two DISTINCT, non-degradedcompute_signaturevalues (the whole point of #639); triage keys its own verdict path, not swarm's..sandcastle/tests/heal-test.sh/heal-lib-test.sh/workdir-lock-yield-test.shre-run green, unmodified.Bonus catch while writing the test: the first draft's
(set -e; …) || ec=$?silently disabled errexit inside the subshell (bash suppresses-efor any command whose own exit status is tested by a trailing||), so a failedgit fetchletcheckout -f/reset --hardrun anyway against stale refs and exit 0 — the fetch failure would have been silently swallowed. Fixed by capturing$?as a separate statement; the test pins it.Landed:
a6891222,b78d7b8don main.Close report
What landed (advances #639, never "closes" — standing-drive convention):
a6891222—.sandcastle/git-setup.sh(new) +swarm.yml/triage.ymlroute the git-setup block through it;STATUS.mdupdated.b78d7b8d— executable bit fixup on the new test file.Proof:
bash .sandcastle/tests/git-setup-test.sh→git-setup: 4 scenarios passedbash .sandcastle/tests/heal-test.sh→heal.sh: 9 scenarios passed(unmodified — vendored)bash .sandcastle/tests/heal-lib-test.sh→heal-lib: 17 groups passed(unmodified — vendored)bash .sandcastle/tests/workdir-lock-yield-test.sh→workdir-lock-yield: 4 groups passedtimeout 30 bash .sandcastle/check-harness-drift.sh— confirms the new file introduces no new drift (it isn't inFACTORY_MANIFEST); pre-existing, unrelated drift onlimit-lib.sh/preflight-swarm.sh/rehearsal-report.sh/run-swarm.sh/tests/preflight-swarm-test.shwas already present at HEAD before this session touched anything (git status --shortbefore my first edit showed none of those files touched by me) — out of scope for #639, not mine to fix under this ticket's ADR 0174 ruling.What's next: the coarse
stage=git-setup (clone/fetch/checkout/reset)tag plus the captured git stderr is the same granularitypnpm install (frozen lockfile)/other run-swarm.sh stages already use — it distinguishes fault classes (auth vs network vs missing-branch vs corrupt workdir) via the error text, not every possible git failure individually. If a future incident needs finer-grained git-setup sub-staging, that's a natural follow-up ticket, not required by this one's Symptom/Why.Closing #639.