Skip to content

fix: ground Bearings in measured liveness and live PR state - #1735

Closed
coreldh wants to merge 13 commits into
kunchenguid:mainfrom
coreldh:fm/c0804r2-fm-bear-r7
Closed

fix: ground Bearings in measured liveness and live PR state#1735
coreldh wants to merge 13 commits into
kunchenguid:mainfrom
coreldh:fm/c0804r2-fm-bear-r7

Conversation

@coreldh

@coreldh coreldh commented Aug 5, 2026

Copy link
Copy Markdown

Intent

Close the one candidate-only Bearings round 6 regression by updating the decision-hold lifecycle baseline to the correct guarded property: a completed-but-unreclaimed in-flight task with verified-absent endpoint and worker must surface as a measured-liveness gate. Prove that property goes RED when the measured-liveness selector is neutralized. Preserve production semantics and preserve the pre-existing held/queued captain-decision gate; a held row must not receive a measured-liveness gate, while a genuinely active worker must not gate. Restore and execute all nine decision-hold lifecycle functions. Publish this validated change as a PR against kunchenguid/firstmate. The PR body must state honestly that six full-suite assertion failures fail identically on main and are inherited, not introduced; do not imply a clean full suite. Do not merge and do not contact the external maintainer. Stop when CI first goes green rather than monitoring the approval queue. Any ask-user finding requires captain escalation and must not be answered automatically.

What Changed

  • Add bounded process/output-based fleet liveness snapshots and use them in session-start and Bearings views, gating completed unreclaimed tasks with verified-absent endpoints and workers while exempting held decisions and genuinely active runs.
  • Live-verify every PR named by Bearings, classify Recently Landed only from verified merged forge state, normalize trailing-slash URLs, and bound PR discovery and remote evidence collection.
  • Expand liveness and decision-hold regression coverage, including all nine lifecycle functions and a selector-neutralization RED check; six full-suite assertion failures reproduce identically on main and are inherited, not introduced.

Risk Assessment

✅ Low: Captain, the focused correction safely normalizes the supported trailing-slash URL form while retaining live MERGED-only classification and the required liveness invariants.

Testing

No outer baseline output was supplied. Local targeted execution passed all nine restored lifecycle functions; direct CLI JSON evidence demonstrates the guarded, held, active-worker, active-run, and neutralized outcomes, while an isolated production-selector mutation made the focused regression fail as required. This is a CLI/JSON change, so screenshots were not applicable. Transient worktree artifacts were removed.

Evidence: Guarded versus neutralized Bearings comparison
{
  "guarded_property": {
    "gates": [
      {
        "id": "sample-route-review",
        "reason": "measured liveness: absent; endpoint=verified_absent; worker=verified_absent"
      },
      {
        "id": "sample-held-review",
        "reason": "captain route choice pending"
      }
    ],
    "in_flight": [
      {
        "id": "sample-measured-review",
        "state": "active",
        "doing": "backend output changed across samples"
      },
      {
        "id": "sample-run-review",
        "state": "working",
        "doing": "ci running"
      }
    ]
  },
  "selector_neutralized": {
    "gates": [
      {
        "id": "sample-held-review",
        "reason": "captain route choice pending"
      }
    ],
    "in_flight": [
      {
        "id": "sample-measured-review",
        "state": "active",
        "doing": "backend output changed across samples"
      },
      {
        "id": "sample-route-review",
        "state": "active",
        "doing": "cumulative CPU delta 0 ms (0 ms/min, codex baseline)"
      },
      {
        "id": "sample-run-review",
        "state": "working",
        "doing": "ci running"
      }
    ]
  },
  "observed_delta": {
    "removed_gate": [
      {
        "id": "sample-route-review",
        "title": "Investigate sample routing",
        "blocked_by": "-",
        "reason": "measured liveness: absent; endpoint=verified_absent; worker=verified_absent",
        "owner": "(main)"
      }
    ],
    "became_in_flight": [
      {
        "id": "sample-route-review",
        "state": "active",
        "doing": "cumulative CPU delta 0 ms (0 ms/min, codex baseline)"
      }
    ]
  }
}
Evidence: Guarded Bearings response
{
  "schema": "fm-bearings.v1",
  "home": "fm-decision-hold.RvBVca/omitted-decision",
  "generated": "2026-07-14T12:00:00Z",
  "prs": "checked (0 named; all verified live)",
  "in_flight": [
    {
      "id": "sample-measured-review",
      "kind": "scout",
      "state": "active",
      "doing": "backend output changed across samples"
    },
    {
      "id": "sample-run-review",
      "kind": "ship",
      "state": "working",
      "doing": "ci running"
    }
  ],
  "secondmates": [],
  "decisions_open": [],
  "landed": [],
  "gates": [
    {
      "id": "sample-route-review",
      "title": "Investigate sample routing",
      "blocked_by": "-",
      "reason": "measured liveness: absent; endpoint=verified_absent; worker=verified_absent",
      "owner": "(main)"
    },
    {
      "id": "sample-held-review",
      "title": "Hold sample routing",
      "blocked_by": "-",
      "reason": "captain route choice pending",
      "owner": "(main)"
    }
  ],
  "reports": [
    {
      "id": "sample-route-review",
      "path": "/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T//fm-decision-hold.RvBVca/omitted-decision/data/sample-route-review/report.md"
    }
  ],
  "recorded_prs": [],
  "unhealthy_endpoints": [
    {
      "id": "sample-held-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-held-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "absent"
    },
    {
      "id": "sample-measured-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-measured-review",
      "endpoint": "verified_absent",
      "worker": "verified_present",
      "activity": "active"
    },
    {
      "id": "sample-route-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-route-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "absent"
    }
  ],
  "candidate_prs": [],
  "omitted": [
    {
      "surface": "backlog item bodies",
      "reveal": "--fields bodies"
    },
    {
      "surface": "task paths",
      "reveal": "--fields paths"
    },
    {
      "surface": "watch/steer actions",
      "reveal": "--fields actions"
    },
    {
      "surface": "healthy endpoint detail",
      "reveal": "--fields endpoints"
    },
    {
      "surface": "full scout-report inventory",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "superseded queued items",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "additional live open-PR discovery",
      "reveal": "--include-prs"
    }
  ]
}
Evidence: Selector-neutralized Bearings response
{
  "schema": "fm-bearings.v1",
  "home": "fm-decision-hold.RvBVca/omitted-decision",
  "generated": "2026-07-14T12:00:00Z",
  "prs": "checked (0 named; all verified live)",
  "in_flight": [
    {
      "id": "sample-measured-review",
      "kind": "scout",
      "state": "active",
      "doing": "backend output changed across samples"
    },
    {
      "id": "sample-route-review",
      "kind": "scout",
      "state": "active",
      "doing": "cumulative CPU delta 0 ms (0 ms/min, codex baseline)"
    },
    {
      "id": "sample-run-review",
      "kind": "ship",
      "state": "working",
      "doing": "ci running"
    }
  ],
  "secondmates": [],
  "decisions_open": [],
  "landed": [],
  "gates": [
    {
      "id": "sample-held-review",
      "title": "Hold sample routing",
      "blocked_by": "-",
      "reason": "captain route choice pending",
      "owner": "(main)"
    }
  ],
  "reports": [
    {
      "id": "sample-route-review",
      "path": "/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T//fm-decision-hold.RvBVca/omitted-decision/data/sample-route-review/report.md"
    }
  ],
  "recorded_prs": [],
  "unhealthy_endpoints": [
    {
      "id": "sample-held-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-held-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "absent"
    },
    {
      "id": "sample-measured-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-measured-review",
      "endpoint": "verified_absent",
      "worker": "verified_present",
      "activity": "active"
    },
    {
      "id": "sample-route-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-route-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "active"
    }
  ],
  "candidate_prs": [],
  "omitted": [
    {
      "surface": "backlog item bodies",
      "reveal": "--fields bodies"
    },
    {
      "surface": "task paths",
      "reveal": "--fields paths"
    },
    {
      "surface": "watch/steer actions",
      "reveal": "--fields actions"
    },
    {
      "surface": "healthy endpoint detail",
      "reveal": "--fields endpoints"
    },
    {
      "surface": "full scout-report inventory",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "superseded queued items",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "additional live open-PR discovery",
      "reveal": "--include-prs"
    }
  ]
}
Evidence: Selector-neutralization mutation failure
not ok - liveness directions did not distinguish phantom, held, measured-active, and active-run lanes: {
  "schema": "fm-bearings.v1",
  "home": "fm-decision-hold.mRMo6P/omitted-decision",
  "generated": "2026-07-14T12:00:00Z",
  "prs": "checked (0 named; all verified live)",
  "in_flight": [
    {
      "id": "sample-measured-review",
      "kind": "scout",
      "state": "active",
      "doing": "backend output changed across samples"
    },
    {
      "id": "sample-run-review",
      "kind": "ship",
      "state": "working",
      "doing": "ci running"
    }
  ],
  "secondmates": [],
  "decisions_open": [],
  "landed": [],
  "gates": [
    {
      "id": "sample-held-review",
      "title": "Hold sample routing",
      "blocked_by": "-",
      "reason": "captain route choice pending",
      "owner": "(main)"
    }
  ],
  "reports": [
    {
      "id": "sample-route-review",
      "path": "/var/folders/cq/xf4qcb9j0qzc2dbh173mflbm0000gn/T//fm-decision-hold.mRMo6P/omitted-decision/data/sample-route-review/report.md"
    }
  ],
  "recorded_prs": [],
  "unhealthy_endpoints": [
    {
      "id": "sample-held-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-held-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "absent"
    },
    {
      "id": "sample-measured-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-measured-review",
      "endpoint": "verified_absent",
      "worker": "verified_present",
      "activity": "active"
    },
    {
      "id": "sample-route-review",
      "backend": "tmux",
      "target": "firstmate:fm-sample-route-review",
      "endpoint": "verified_absent",
      "worker": "verified_absent",
      "activity": "absent"
    }
  ],
  "candidate_prs": [],
  "omitted": [
    {
      "surface": "backlog item bodies",
      "reveal": "--fields bodies"
    },
    {
      "surface": "task paths",
      "reveal": "--fields paths"
    },
    {
      "surface": "watch/steer actions",
      "reveal": "--fields actions"
    },
    {
      "surface": "healthy endpoint detail",
      "reveal": "--fields endpoints"
    },
    {
      "surface": "full scout-report inventory",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "superseded queued items",
      "reveal": "not included in bounded core"
    },
    {
      "surface": "additional live open-PR discovery",
      "reveal": "--include-prs"
    }
  ]
}
Evidence: Nine-function targeted test run
FM_TEST_BEGIN 2026-08-05T06:37:12Z tests/fm-decision-hold-lifecycle.test.sh family=pure-contract-unit expected_gate_skip=none
ok - phantom and held lanes gate while measured-active and active-run lanes do not, selector neutralization goes RED, and completion refuses before report loss
ok - non-forced scout teardown always requires durable inventory verification
ok - captain holds are idempotent, distinct, teardown-safe, Bearings-visible, and durably routed before close
ok - completion and verification validate origins before constructing paths
ok - ended visual review follows the same decision-hold completion owner
ok - resolved findings and decision-like prose do not create false holds
ok - terminal single-owner stale status decisions do not block empty inventory
ok - main-home and secondmate-home captain holds remain correctly routed
ok - resolve matches first/middle/last in quoted blocked_by and rejects a genuinely absent id
FM_TEST_END 2026-08-05T06:38:45Z tests/fm-decision-hold-lifecycle.test.sh exit=0 duration_ms=93013 gate_skip=false
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=93098
FM_TEST_SUMMARY_FAMILY family=pure-contract-unit count=1 duration_ms=93013 failed=0
FM_TEST_SLOWEST rank=1 script=tests/fm-decision-hold-lifecycle.test.sh duration_ms=93013

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-crew-state.sh - merge conflict rebasing onto origin/main
  • ⚠️ docs/architecture.md - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

🔧 **Review** - 5 issues found → auto-fixed (2) ✅
  • 🚨 tests/fm-decision-hold-lifecycle.test.sh:155 - Required criterion is absent: “Prove that property goes RED when the measured-liveness selector is neutralized.” This test only exercises the positive selector path; it never neutralizes the gate selector and verifies the phantom-gate assertion fails. Add a controlled neutralized run and require RED.
  • 🚨 bin/fm-liveness-snapshot.sh:428 - This contradicts “a genuinely active worker must not gate.” A missing endpoint forcibly sets worker presence and activity to absent, even when both process samples prove a matching active worker. Bearings then emits a false measured-liveness gate. Derive worker presence independently from process evidence and do not let endpoint absence erase it.
  • 🚨 bin/fm-bearings-snapshot.sh:510 - A matching active no-mistakes run can report current_state=working while its retained harness is temporarily static/parked during CI; this selector ignores that authoritative run-step state and emits a measured-liveness gate. Use one effective-working predicate that accepts either authoritative active run-state or measured activity, while preserving the absent phantom case.
  • 🚨 bin/fm-bearings-snapshot.sh:588 - The live PR result is not applied to Recently Landed: every local Done row is emitted even when candidate_prs verifies its PR as OPEN or NOT_VERIFIABLE. This conflicts with the changed Bearings contract that Recently Landed contains merged PRs and local PR state must not replace forge evidence. Join selected PR artifacts to their live verification before classifying them as landed.
  • ⚠️ bin/fm-bearings-snapshot.sh:297 - Named PRs are verified sequentially with two separately bounded calls per URL. With default bounds, an outage can delay plain Bearings by up to roughly 17 minutes; --include-prs can grow much larger. Add a total verification budget or bounded concurrency and emit NOT_VERIFIABLE for rows left when that budget expires.

🔧 Fix: Fix Bearings liveness and landed PR classification
1 warning still open:

  • ⚠️ bin/fm-bearings-snapshot.sh:429 - The verifier accepts PR URLs with a trailing slash, but stores GitHub's canonical URL without it; this exact-string join then treats a verified merged .../pull/7/ as missing and excludes it from Recently Landed. Normalize the source URL before joining or retain the requested URL as the join key.

🔧 Fix: Normalize trailing-slash PR joins for landed classification
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bin/fm-test-run.sh tests/fm-decision-hold-lifecycle.test.sh executed all nine lifecycle functions
  • REPO_ROOT="$PWD" EVIDENCE_DIR=… bash …/capture-bearings-liveness-fixture.sh captured real fm-bearings-snapshot.sh --json responses
  • jq -n --slurpfile guarded … --slurpfile neutralized … produced and asserted the lane comparison
  • Isolated mutation changed the production measured-liveness selector to false; bash .no-mistakes-test-mutation/tests/fm-decision-hold-lifecycle.test.sh exited 1 at the intended four-lane assertion
  • Verified 9 definitions, 9 invocations, the expected mutation failure, comparison invariants, transient-fixture removal, and a clean worktree
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coreldh

coreldh commented Aug 9, 2026

Copy link
Copy Markdown
Author

Superseded by #1985, which republishes this change cleanly from current main through the repository's own pipeline and is now green at 13/13 checks.

This PR was measured as mergeable: false, mergeable_state: dirty, 30 files, +3609/-787, based on 30b18b91, and had never run a check. Rather than rebase a long-stale branch, the intended change was rebuilt on current main and scoped down. Closing per the repository owner's instruction; no work is lost.

@coreldh coreldh closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant