Skip to content

fix: keep unsupported contribution URLs unmeasured - #7233

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
mikaelz:fm/fm-contributions-unmeasured
Oct 14, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
mikaelz:fm/fm-contributions-unmeasured

Conversation

@mikaelz

@mikaelz mikaelz commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Intent

file a small Firstmate fix so GitLab links show as "not tracked" instead of raising an alert

The main-workstation handoff reports that contribution polling tries observing every owned URL, including GitLab merge requests now accepted by tasks-axi. Non-GitHub URLs return observation failure, causing an observation-unavailable alert and an error record even though the tool promises unsupported forges remain unmeasured. Ship the normal Firstmate PR; merge remains a separate approval. Unsupported owned URLs must cause no forge call, no unavailable output/wake, and no recorded error, and must count in the existing unmeasured coverage. Previously stamped unsupported-forge errors must stop counting as failures on the next poll. Genuine GitHub read failures must retain their once-per-episode alert. Include colocated regression tests for GitLab ownership and GitHub failure. Implementing GitLab observation via glab is out of scope.

What Changed

  • Restrict contribution observation to canonical github.com PR and issue URLs; skip unsupported owned URLs without forge calls, unavailable output, wakes, or new errors.
  • Clear legacy unsupported-URL errors while preserving ownership and observation evidence, and clarify unsupported coverage guidance.
  • Add regression coverage for GitLab and lookalike hosts, mixed saved ownership, and genuine GitHub failures retaining once-per-episode alerts.

Risk Assessment

✅ Low: The bounded fix separates observation eligibility from durable ownership compatibility, preserves unsupported evidence, and leaves genuine GitHub failure reporting intact.

Testing

Targeted regressions passed after correcting fixture placement. Live CLI and watcher checks passed against isolated data and a disposable HTTPS forge, with product snapshots, records and notifications retained as evidence. No UI rendering changed.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Poll fresh GitLab and lookalike-host links without forge reads or alerts ✅ pass live live-contributions-results.json: fresh unsupported links and Bearings coverage
Clear legacy unsupported errors after backlog links disappear ✅ pass live live-contributions-results.json: retained unsupported ownership
Read and update mixed saved records without losing unsupported ownership ✅ pass live live-contributions-results.json: mixed retained file and recovery
Alert once per genuine GitHub failure episode ✅ pass live live-contributions-results.json: GitHub failure, repetition, recovery and subsequent failure
Keep unsupported links out of authenticated watcher notifications ✅ pass live live-contributions-results.json: authenticated watcher
Preserve existing Forgejo pull ownership boundary ✅ pass live live-contributions-results.json: Forgejo ownership boundary
Evidence: Live product snapshots, persisted records, HTTP requests and watcher notifications

Source: Live product snapshots, persisted records, HTTP requests and watcher notifications

{
  "product": "unmodified bin/fm-contributions.sh, fleet snapshot, Bearings; installed gh CLI",
  "isolation": "Disposable FM_HOME; real gh HTTPS reads to disposable local forge dataset; no production credentials or CLI mocks",
  "steps": [
    {
      "step": "Fresh unsupported and held lookalike links: silent poll, no HTTP calls, no error records or wakes",
      "product_output": {
        "stdout": "",
        "stderr": "",
        "forge_requests": [],
        "snapshot": {
          "known": 4,
          "checked": 0,
          "counts": {
            "captain": 0,
            "fleet": 0,
            "maintainer": 0,
            "nobody": 0
          },
          "unmeasured": 4,
          "complete": false,
          "proven_clear": false,
          "stale_verdicts": 0,
          "missing_verdicts": 0,
          "unreadable_records": 0,
          "valid_until": 900,
          "captain": [],
          "captain_omitted": 0,
          "rows": [
            {
              "task": "u1",
              "url": "https://git.example.org/group/subgroup/r/-/merge_requests/3",
              "kind": "pr",
              "checked_at": null,
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "unmeasured",
              "reason": "unsupported forge; coverage is unmeasured",
              "tasks": [
                "u1"
              ]
            },
            {
              "task": "u2",
              "url": "https://github-com/o/r/pull/8",
              "kind": "pr",
              "checked_at": null,
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "unmeasured",
              "reason": "unsupported forge; coverage is unmeasured",
              "tasks": [
                "u2"
              ]
            },
            {
              "task": "u3",
              "url": "https://githubXcom/o/r/issues/9",
              "kind": "issue",
              "checked_at": null,
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "unmeasured",
              "reason": "unsupported forge; coverage is unmeasured",
              "tasks": [
                "u3"
              ]
            },
            {
              "task": "u0",
              "url": "https://gitlab.com/o/r/-/merge_requests/2",
              "kind": "pr",
              "checked_at": null,
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "unmeasured",
              "reason": "unsupported forge; coverage is unmeasured",
              "tasks": [
                "u0"
              ]
            }
          ]
        }
      }
    },
    {
      "step": "Existing Forgejo pull ownership boundary unchanged",
      "product_output": {
        "known": 4,
        "checked": 0,
        "counts": {
          "captain": 0,
          "fleet": 0,
          "maintainer": 0,
          "nobody": 0
        },
        "unmeasured": 4,
        "complete": false,
        "proven_clear": false,
        "stale_verdicts": 0,
        "missing_verdicts": 0,
        "unreadable_records": 0,
        "valid_until": 900,
        "captain": [],
        "captain_omitted": 0,
        "rows": [
          {
            "task": "u1",
            "url": "https://git.example.org/group/subgroup/r/-/merge_requests/3",
            "kind": "pr",
            "checked_at": null,
            "checked": false,
            "final": false,
            "head": null,
            "verdict": null,
            "reviews": [],
            "distinct_checks": 0,
            "missing_verdicts": 0,
            "pending_checks": 0,
            "failed_checks": 0,
            "stale_verdicts": 0,
            "signals": [],
            "actor": "unmeasured",
            "reason": "unsupported forge; coverage is unmeasured",
            "tasks": [
              "u1"
            ]
          },
          {
            "task": "u2",
            "url": "https://github-com/o/r/pull/8",
            "kind": "pr",
            "checked_at": null,
            "checked": false,
            "final": false,
            "head": null,
            "verdict": null,
            "reviews": [],
            "distinct_checks": 0,
            "missing_verdicts": 0,
            "pending_checks": 0,
            "failed_checks": 0,
            "stale_verdicts": 0,
            "signals": [],
            "actor": "unmeasured",
            "reason": "unsupported forge; coverage is unmeasured",
            "tasks": [
              "u2"
            ]
          },
          {
            "task": "u3",
            "url": "https://githubXcom/o/r/issues/9",
            "kind": "issue",
            "checked_at": null,
            "checked": false,
            "final": false,
            "head": null,
            "verdict": null,
            "reviews": [],
            "distinct_checks": 0,
            "missing_verdicts": 0,
            "pending_checks": 0,
            "failed_checks": 0,
            "stale_verdicts": 0,
            "signals": [],
            "actor": "unmeasured",
            "reason": "unsupported forge; coverage is unmeasured",
            "tasks": [
              "u3"
            ]
          },
          {
            "task": "u0",
            "url": "https://gitlab.com/o/r/-/merge_requests/2",
            "kind": "pr",
            "checked_at": null,
            "checked": false,
            "final": false,
            "head": null,
            "verdict": null,
            "reviews": [],
            "distinct_checks": 0,
            "missing_verdicts": 0,
            "pending_checks": 0,
            "failed_checks": 0,
            "stale_verdicts": 0,
            "signals": [],
            "actor": "unmeasured",
            "reason": "unsupported forge; coverage is unmeasured",
            "tasks": [
              "u0"
            ]
          }
        ]
      }
    },
    {
      "step": "Bearings end-user coverage",
      "product_output": {
        "scope": "owned contributions per home",
        "known": 4,
        "checked": 0,
        "counts": {
          "captain": 0,
          "fleet": 0,
          "maintainer": 0,
          "nobody": 0
        },
        "complete": false,
        "proven_clear": false,
        "unmeasured_homes": 0,
        "unreadable_records": 0,
        "unmeasured": 4,
        "stale_verdicts": 0,
        "missing_verdicts": 0,
        "captain_omitted": 0,
        "captain": []
      }
    },
    {
      "step": "Retained unsupported ownership after backlog removal: only error cleared",
      "product_output": {
        "known": 4,
        "checked": 0,
        "counts": {
          "captain": 0,
          "fleet": 0,
          "maintainer": 0,
          "nobody": 0
        },
        "unmeasured": 4,
        "complete": false,
        "proven_clear": false,
        "stale_verdicts": 0,
        "missing_verdicts": 0,
        "unreadable_records": 0,
        "valid_until": 1789546500,
        "captain": [],
        "captain_omitted": 0,
        "r

... [16995 bytes truncated] ...

thout repeated alert",
      "product_output": {
        "stdout": "",
        "snapshot": {
          "known": 1,
          "checked": 0,
          "counts": {
            "captain": 0,
            "fleet": 1,
            "maintainer": 0,
            "nobody": 0
          },
          "unmeasured": 0,
          "complete": false,
          "proven_clear": false,
          "stale_verdicts": 0,
          "missing_verdicts": 0,
          "unreadable_records": 0,
          "valid_until": 1791952061,
          "captain": [],
          "captain_omitted": 0,
          "rows": [
            {
              "task": "delivery",
              "url": "https://github.com/o/r/issues/9",
              "kind": "issue",
              "checked_at": "2026-10-14T04:12:41Z",
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "fleet",
              "reason": "forge observation unavailable or changed during read",
              "tasks": [
                "delivery"
              ]
            }
          ]
        }
      }
    },
    {
      "step": "Successful GitHub read ends episode",
      "product_output": {
        "known": 1,
        "checked": 1,
        "counts": {
          "captain": 0,
          "fleet": 0,
          "maintainer": 1,
          "nobody": 0
        },
        "unmeasured": 0,
        "complete": true,
        "proven_clear": true,
        "stale_verdicts": 0,
        "missing_verdicts": 0,
        "unreadable_records": 0,
        "valid_until": 1791952061,
        "captain": [],
        "captain_omitted": 0,
        "rows": [
          {
            "task": "delivery",
            "url": "https://github.com/o/r/issues/9",
            "kind": "issue",
            "checked_at": "2026-10-14T04:12:41Z",
            "checked": true,
            "final": false,
            "head": null,
            "verdict": null,
            "reviews": [],
            "distinct_checks": 0,
            "missing_verdicts": 0,
            "pending_checks": 0,
            "failed_checks": 0,
            "stale_verdicts": 0,
            "signals": [],
            "actor": "maintainer",
            "reason": "awaiting issue triage",
            "tasks": [
              "delivery"
            ]
          }
        ]
      }
    },
    {
      "step": "New GitHub outage alerts again after recovery",
      "product_output": {
        "stdout": "contributions: observation unavailable for https://github.com/o/r/issues/9\n",
        "snapshot": {
          "known": 1,
          "checked": 0,
          "counts": {
            "captain": 0,
            "fleet": 1,
            "maintainer": 0,
            "nobody": 0
          },
          "unmeasured": 0,
          "complete": false,
          "proven_clear": false,
          "stale_verdicts": 0,
          "missing_verdicts": 0,
          "unreadable_records": 0,
          "valid_until": 1791952062,
          "captain": [],
          "captain_omitted": 0,
          "rows": [
            {
              "task": "delivery",
              "url": "https://github.com/o/r/issues/9",
              "kind": "issue",
              "checked_at": "2026-10-14T04:12:42Z",
              "checked": false,
              "final": false,
              "head": null,
              "verdict": null,
              "reviews": [],
              "distinct_checks": 0,
              "missing_verdicts": 0,
              "pending_checks": 0,
              "failed_checks": 0,
              "stale_verdicts": 0,
              "signals": [],
              "actor": "fleet",
              "reason": "forge observation unavailable or changed during read",
              "tasks": [
                "delivery"
              ]
            }
          ]
        }
      }
    },
    {
      "step": "Authenticated watcher surfaces only real unreadable-record diagnostic and maintainer signal with GitLab ownership present",
      "product_output": {
        "stdout": "check: ~/.no-mistakes/worktrees/cb3ff81633e8/01M4V7KED2NMFN9WG1FW7VBW9S/.test-validation-tmp/live-contributions-zhzzxmtu/watcher/state/contributions.check.sh: contributions: 1 unreadable durable record(s)\n",
        "stderr": "",
        "durable_wake_queue": "1791951164\t1\tcheck\tcontribution-b621d5d943471c9cda5373405c1a628d73e54452b09144f42b8dc4be8947b3fa\tcheck: contributions delivery b621d5d943471c9cda5373405c1a628d73e54452b09144f42b8dc4be8947b3fa\n1791951164\t2\tcheck\t~/.no-mistakes/worktrees/cb3ff81633e8/01M4V7KED2NMFN9WG1FW7VBW9S/.test-validation-tmp/live-contributions-zhzzxmtu/watcher/state/contributions.check.sh\tcheck: ~/.no-mistakes/worktrees/cb3ff81633e8/01M4V7KED2NMFN9WG1FW7VBW9S/.test-validation-tmp/live-contributions-zhzzxmtu/watcher/state/contributions.check.sh: contributions: 1 unreadable durable record(s)\n",
        "pending": {
          "schema": "fm-contributions.v1",
          "task": "delivery",
          "records": [
            {
              "url": "https://github.com/o/r/issues/9",
              "kind": "issue",
              "checked_at": "2026-10-14T04:12:43Z",
              "observation": {
                "state": "open",
                "head": null,
                "ready": false,
                "checks": [],
                "reviews": [],
                "events": [
                  {
                    "token": "comment:12:2026-10-14T08:01:00Z",
                    "type": "comment",
                    "source": "https://github.com/o/r/issues/9#issuecomment-12",
                    "head": null,
                    "author": "maintainer",
                    "body": "Please clarify the contract"
                  }
                ],
                "absent_checks": []
              },
              "verdict": null,
              "seen": [
                "comment:12:2026-10-14T08:01:00Z"
              ],
              "pending": [
                {
                  "token": "comment:12:2026-10-14T08:01:00Z",
                  "type": "comment",
                  "source": "https://github.com/o/r/issues/9#issuecomment-12",
                  "head": null,
                  "author": "maintainer",
                  "body": "Please clarify the contract"
                }
              ],
              "notified": [
                "comment:12:2026-10-14T08:01:00Z"
              ],
              "error": null
            }
          ]
        }
      }
    }
  ],
  "forge_requests": [
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "down"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/comments?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/events?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "down"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "down"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/events?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/comments?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "down"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/comments?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/events?per_page=100",
      "mode": "healthy"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9",
      "mode": "signal"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/comments?per_page=100",
      "mode": "signal"
    },
    {
      "path": "/api/v3/repos/o/r/issues/9/events?per_page=100",
      "mode": "signal"
    }
  ]
}
Evidence: Repeatable isolated live verification driver

Source: Repeatable isolated live verification driver

#!/usr/bin/env python3
"""Drive shipped CLI with disposable FM_HOME and real gh against local HTTPS forge data.
No tool shims, operator data, or production credentials are used.
"""
import os, json, pathlib, tempfile, subprocess, ssl, threading, http.server, shutil
ROOT = pathlib.Path.cwd()
EVIDENCE = pathlib.Path('~/.no-mistakes/evidence/01M4V7KED2NMFN9WG1FW7VBW9S')
lab = pathlib.Path(tempfile.mkdtemp(prefix='live-contributions-', dir=ROOT / '.test-validation-tmp'))
requests = []
mode = 'healthy'
class Forge(http.server.BaseHTTPRequestHandler):
    def do_GET(self):
        requests.append({'path': self.path, 'mode': mode})
        code = 502 if mode == 'down' else 200
        if code == 502: data = {'message': 'Disposable forge outage'}
        elif self.path.endswith('/issues/9'): data = {'state':'open', 'user':{'login':'author'}, 'labels':[], 'html_url':'https://github.com/o/r/issues/9'}
        elif mode == 'signal' and '/comments?' in self.path: data = [{'id':12,'user':{'login':'maintainer'},'author_association':'OWNER','body':'Please clarify the contract','html_url':'https://github.com/o/r/issues/9#issuecomment-12','updated_at':'2026-10-14T08:01:00Z'}]
        else: data = []
        payload = json.dumps(data).encode()
        self.send_response(code); self.send_header('Content-Type','application/json'); self.send_header('Content-Length',str(len(payload))); self.end_headers(); self.wfile.write(payload)
    def log_message(self, *args): pass
server = None
log = []
def emit(title, data): log.append({'step':title, 'product_output':data})
try:
    subprocess.run(['openssl','req','-x509','-newkey','rsa:2048','-nodes','-keyout',str(lab/'key.pem'),'-out',str(lab/'cert.pem'),'-days','1','-subj','/CN=127.0.0.1','-addext','subjectAltName=IP:127.0.0.1'],check=True,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
    server = http.server.ThreadingHTTPServer(('127.0.0.1',0),Forge)
    ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER); ctx.load_cert_chain(lab/'cert.pem',lab/'key.pem'); server.socket = ctx.wrap_socket(server.socket,server_side=True)
    threading.Thread(target=server.serve_forever,daemon=True).start()
    env = dict(os.environ)
    for key in list(env):
        if key.startswith(('FM_', 'GH_', 'GITHUB_', 'TASKS_AXI_')) or key == 'TMUX': env.pop(key)
    env.update(GH_HOST=f'127.0.0.1:{server.server_port}', GH_ENTERPRISE_TOKEN='disposable-local-fixture-only', GH_CONFIG_DIR=str(lab/'gh-config'), SSL_CERT_FILE=str(lab/'cert.pem'), GH_PROMPT_DISABLED='1', TMPDIR=str(lab))
    def home(name):
        h=lab/name
        for d in ['data','state','config','projects']: (h/d).mkdir(parents=True)
        (h/'data/backlog.md').write_text('# Backlog\n\n## Queued\n')
        return h
    def run(h, script, *args):
        e=dict(env); e.update(FM_HOME=str(h),FM_ROOT_OVERRIDE=str(ROOT),FM_STATE_OVERRIDE=str(h/'state'),FM_DATA_OVERRIDE=str(h/'data'),FM_CONFIG_OVERRIDE=str(h/'config'),FM_PROJECTS_OVERRIDE=str(h/'projects'))
        p=subprocess.run(['bash',str(ROOT/'bin'/script),*args],env=e,text=True,capture_output=True,timeout=40)
        assert p.returncode==0,(script,p.returncode,p.stdout,p.stderr)
        return p
    def snapshot(h):
        p=run(h,'fm-fleet-snapshot.sh','--contribution-input'); (h/'input.json').write_text(p.stdout)
        s=json.loads(run(h,'fm-contributions.sh','snapshot',str(h/'input.json'),'--all').stdout)
        return s
    def coverage(s,known,checked,unmeasured,counts):
        assert (s['known'],s['checked'],s['unmeasured'],s['unreadable_records'],s['counts']) == (known,checked,unmeasured,0,counts),s
    zeros={'captain':0,'fleet':0,'maintainer':0,'nobody':0}
    urls=['https://gitlab.com/o/r/-/merge_requests/2','https://git.example.org/group/subgroup/r/-/merge_requests/3','https://github-com/o/r/pull/8','https://githubXcom/o/r/issues/9']
    h=home('fresh')
    for i,url in enumerate(urls):
        with (h/'data/backlog.md').open('a') as f: f.write(f'- [ ] u{i} - Filed {url} (repo: sample) (kind: ship) (hold: choose scope) (hold-kind: captain)\n')
    p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr; assert not requests
    assert not list((h/'data').glob('*/contributions.json')) and not (h/'state/.wake-queue').exists()
    s=snapshot(h); coverage(s,4,0,4,zeros); emit('Fresh unsupported and held lookalike links: silent poll, no HTTP calls, no error records or wakes',{'stdout':p.stdout,'stderr':p.stderr,'forge_requests':list(requests),'snapshot':s})
    with (h/'data/backlog.md').open('a') as f: f.write('- [ ] forgejo - Filed https://codeberg.org/o/r/pulls/2 (repo: sample) (kind: ship)\n')
    p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr and not requests
    coverage(snapshot(h),4,0,4,zeros); emit('Existing Forgejo pull ownership boundary unchanged',snapshot(h))
    emit('Bearings end-user coverage',json.loads(run(h,'fm-bearings-snapshot.sh','--json').stdout)['contributions'])
    h=home('retained')
    def record(url): return {'url':url,'kind':'issue' if '/issues/' in url else 'pr','checked_at':'2026-09-16T08:00:00Z','error':'forge observation unavailable or changed during read','observation':None,'verdict':None,'seen':[],'pending':[],'notified':[],'provenance':'retained ownership'}
    for i,url in enumerate(urls):
        d=h/'data'/f'u{i}'; d.mkdir(); (d/'contributions.json').write_text(json.dumps({'schema':'fm-contributions.v1','task':f'u{i}','records':[record(url)]}))
    p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr and not requests
    for i,url in enumerate(urls):
        row=json.loads((h/'data'/f'u{i}'/'contributions.json').read_text())['records'][0]; expected=record(url); expected['error']=None; assert row==expected
    s=snapshot(h); coverage(s,4,0,4,zeros); emit('Retained unsupported ownership after backlog removal: only error cleared',s)
    h=home('mixed'); d=h/'data'/'delivery'; d.mkdir(); supported='https://github.com/o/r/issues/9'
    rows=[record(supported)]+[record(u) for u in urls]
    (d/'contributions.json').write_text(json.dumps({'schema':'fm-contributions.v1','task':'delivery','records':rows}))
    mode='down'; start=len(requests)
    p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr
    assert len(requests)-start==1 and requests[-1]['path'].endswith('/issues/9'),requests
    stored=json.loads((d/'contributions.json').read_text()); assert len(stored['records'])==5
    for row in stored['records']:
        if row['url']!=supported:
            expected=record(row['url']); expected['error']=None; assert row==expected
        else: assert row['error'] and row['observation'] is None
    s=snapshot(h); coverage(s,5,0,4,dict(zeros,fleet=1)); emit('Mixed retained file: unsupported errors cleared, existing GitHub episode retried silently',{'snapshot':s,'records':stored,'HTTP':requests[start:]})
    mode='healthy'; p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr
    s=snapshot(h); coverage(s,5,1,4,dict(zeros,maintainer=1)); emit('Mixed file GitHub read recovers without dropping unsupported records',{'snapshot':s,'records':json.loads((d/'contributions.json').read_text())})
    h=home('episode'); (h/'data/backlog.md').write_text(f'# Backlog\n\n## Queued\n- [ ] delivery - Filed {supported} (repo: sample) (kind: ship)\n')
    run(h,'fm-contributions.sh','arm'); line=f'contributions: observation unavailable for {supported}\n'
    mode='down'; p=run(h,'fm-contributions.sh','poll'); assert p.stdout==line and not p.stderr; emit('GitHub failure episode starts with unavailable alert',{'stdout':p.stdout,'records':json.loads((h/'data/delivery/contributions.json').read_text())})
    p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr; emit('Repeated GitHub outage remains failed without repeated alert',{'stdout':p.stdout,'snapshot':snapshot(h)})
    mode='healthy'; p=run(h,'fm-contributions.sh','poll'); assert not p.stdout and not p.stderr; assert json.loads((h/'data/delivery/contributions.json').read_text())['records'][0]['error'] is None
    emit('Successful GitHub read ends episode',snapshot(h))
    mode='down'; p=run(h,'fm-contributions.sh','poll'); assert p.stdout==line and not p.stderr; emit('New GitHub outage alerts again after recovery',{'stdout':p.stdout,'snapshot':snapshot(h)})
    h=home('watcher'); (h/'data/backlog.md').write_text(f'# Backlog\n\n## Queued\n- [ ] unsupported - Filed {urls[0]} (repo: sample) (kind: ship)\n- [ ] delivery - Filed {supported} (repo: sample) (kind: ship)\n')
    mode='healthy'; run(h,'fm-contributions.sh','arm'); run(h,'fm-contributions.sh','poll')
    (h/'data/unreadable').mkdir(); (h/'data/unreadable/contributions.json').write_text('incomplete JSON\n')
    mode='signal'
    we=dict(env); we.update(FM_HOME=str(h),FM_ROOT_OVERRIDE=str(ROOT),FM_STATE_OVERRIDE=str(h/'state'),FM_DATA_OVERRIDE=str(h/'data'),FM_CONFIG_OVERRIDE=str(h/'config'),FM_PROJECTS_OVERRIDE=str(h/'projects'),FM_POLL='1',FM_SIGNAL_GRACE='0',FM_CHECK_INTERVAL='0',FM_HEARTBEAT='999999')
    p=subprocess.run(['bash',str(ROOT/'bin/fm-watch-checkpoint.sh'),'--seconds','15'],env=we,text=True,capture_output=True,timeout=30)
    assert p.returncode==0,(p.returncode,p.stdout,p.stderr)
    wakes=(h/'state/.wake-queue').read_text(); lines=[x for x in wakes.splitlines() if '\tcheck\t' in x]; assert len(lines)==2,wakes
    assert '1 unreadable durable record(s)' in wakes and 'check: contributions delivery ' in wakes
    assert 'observation unavailable' not in wakes and 'gitlab.com' not in wakes
    emit('Authenticated watcher surfaces only real unreadable-record diagnostic and maintainer signal with GitLab ownership present',{'stdout':p.stdout,'stderr':p.stderr,'durable_wake_queue':wakes,'pending':json.loads(run(h,'fm-contributions.sh','snapshot',str(h/'input.json'),'--all').stdout) if (h/'input.json').exists() else json.loads((h/'data/delivery/contributions.json').read_text())})
    (EVIDENCE/'live-contributions-results.json').write_text(json.dumps({'product':'unmodified bin/fm-contributions.sh, fleet snapshot, Bearings; installed gh CLI','isolation':'Disposable FM_HOME; real gh HTTPS reads to disposable local forge dataset; no production credentials or CLI mocks','steps':log,'forge_requests':requests},indent=2)+'\n')
    print('CLI live scenarios completed; evidence: live-contributions-results.json')
finally:
    if server: server.shutdown(); server.server_close()
    shutil.rmtree(lab)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 0 issues

✅ No issues found.

  • 🚨 bin/fm-contributions.jq:3 - The new supported_url predicate treats the dot in github.com as a regex wildcard. A structured backlog link such as https://github-com/o/r/pull/8 is therefore owned and classified as supported despite observe() rejecting its host. Coverage incorrectly becomes fleet work rather than unmeasured; legacy errors remain, and polling can access unset BUDGET_EXHAUSTED. This contradicts "Unsupported owned URLs ... must count in the existing unmeasured coverage" and "Previously stamped unsupported-forge errors must stop counting as failures on the next poll." Remaining consumers: bin/fm-contributions.jq:5 (ownership acceptance), :62 (freshness), :74 (actor classification); bin/fm-contributions.sh:376 (legacy cleanup), :391 (poll scheduling). Match the literal GitHub hostname in the shared predicate, using github[.]com.

🔧 Fix applied.
2 errors still open:

  • 🚨 bin/fm-contributions.jq:3 - The new supported_url predicate treats the dot in github.com as a regex wildcard. A structured backlog link such as https://github-com/o/r/pull/8 is therefore owned and classified as supported despite observe() rejecting its host. Coverage incorrectly becomes fleet work rather than unmeasured; legacy errors remain, and polling can access unset BUDGET_EXHAUSTED. This contradicts "Unsupported owned URLs ... must count in the existing unmeasured coverage" and "Previously stamped unsupported-forge errors must stop counting as failures on the next poll." Remaining consumers: bin/fm-contributions.jq:5 (ownership acceptance), :62 (freshness), :74 (actor classification); bin/fm-contributions.sh:376 (legacy cleanup), :391 (poll scheduling). Match the literal GitHub hostname in the shared predicate, using github[.]com.
  • 🚨 bin/fm-contributions.jq:5 - Round 2's fix also narrows ownership and saved-record validation because canonical_url delegates to supported_url. Previously accepted https://github-com/o/r/pull/8 and https://githubXcom/o/r/issues/9 now disappear from fresh unmeasured coverage. Previously stamped records containing those URLs instead become unreadable: read_saved discards the entire file, cleanup never clears its error, and polling emits an unreadable-record diagnostic/wake. If that file also contains a backlog-owned GitHub contribution, write_record refuses the file and polling fails. This contradicts "Previously stamped unsupported-forge errors must stop counting as failures on the next poll" and the recorded decision requiring lookalike-host "legacy error cleanup and unmeasured coverage." Keep exact-host observer eligibility separate from existing ownership/record compatibility. Remaining sites: bin/fm-contributions.jq:13 (whole-record validation), :34 and :36 (ownership acceptance); bin/fm-contributions.sh:163 (saved-record rejection), :217 (write validation), :376 (cleanup selection), :386 (diagnostic). Tests at tests/fm-contributions.test.sh:439-440 exercise legacy lookalike merge-request paths instead of the affected pull/issue paths; :455 adds those affected paths only without saved records, and :476 asserts four contributions, silently accepting their disappearance. Cover fresh and retained pull/issue lookalikes, including a mixed GitHub saved file.

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

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Poll public and self-hosted GitLab ownership without forge calls, alerts or fabricated records ✅ pass live live-contributions.json: fresh-poll, fresh-coverage and fresh-watcher
Poll retained unsupported errors after backlog links disappear, clearing only error stamps ✅ pass live live-contributions.json: legacy-poll and legacy-coverage; legacy-after.json
Poll mixed saved errors without erasing or re-alerting the existing GitHub failure ✅ pass live live-contributions.json: mixed-poll and mixed-coverage; mixed-after.json
Encounter a genuine GitHub read failure and receive one alert while repeated failures remain recorded ✅ pass live live-contributions.json: outage-first-poll, outage-repeat-poll and outage-watcher; contributions-tests.log
Keep genuine unreadable-record diagnostics when GitLab ownership is present ✅ pass live live-contributions.json: real-diagnostic-watcher and real-diagnostic-durable-wake
  • bash bin/fm-test-run.sh tests/fm-contributions.test.sh --json ~/.no-mistakes/evidence/01M4V7KED2NMFN9WG1FW7VBW9S/contributions-timing.json
  • python3 ~/.no-mistakes/evidence/01M4V7KED2NMFN9WG1FW7VBW9S/drive-contributions.py: base-commit reproduction, isolated polling, Bearings coverage, authenticated watchers, persisted-record assertions and strace verification
  • git status --short and disposable-directory cleanup verification

✅ No issues found.

  • Live validation: ✅ go - 6 of 6 scenarios driven live against the product
Scenario Result Live Evidence
Poll fresh GitLab and lookalike-host links without forge reads or alerts ✅ pass live live-contributions-results.json: fresh unsupported links and Bearings coverage
Clear legacy unsupported errors after backlog links disappear ✅ pass live live-contributions-results.json: retained unsupported ownership
Read and update mixed saved records without losing unsupported ownership ✅ pass live live-contributions-results.json: mixed retained file and recovery
Alert once per genuine GitHub failure episode ✅ pass live live-contributions-results.json: GitHub failure, repetition, recovery and subsequent failure
Keep unsupported links out of authenticated watcher notifications ✅ pass live live-contributions-results.json: authenticated watcher
Preserve existing Forgejo pull ownership boundary ✅ pass live live-contributions-results.json: Forgejo ownership boundary
  • TMPDIR="$PWD/.test-validation-tmp" bash bin/fm-test-run.sh tests/fm-contributions.test.sh initially encountered three fixture-placement failures because secondmate homes cannot reside inside the repository.
  • bash bin/fm-test-run.sh tests/fm-contributions.test.sh passed using the runner's normal temporary-fixture location, without skips.
  • python3 ~/.no-mistakes/evidence/01M4V7KED2NMFN9WG1FW7VBW9S/live-contributions.py drove real contribution polling, fleet snapshots, Bearings, authenticated check registration and watcher execution using disposable homes and the installed gh CLI against a local HTTPS forge dataset.
  • Verified persisted records, exact coverage counts, HTTP requests, alert episodes and durable notifications; removed disposable fixtures and confirmed a clean working tree.
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @mikaelz — keeping unsupported forge ownership unmeasured (no forge call, no unavailable alert, no new error stamp, legacy unsupported errors cleared) matches what bin/fm-contributions.sh already promised.

  • Diff review: bin/fm-contributions.{sh,jq} + colocated regressions only. No workflow/secret/network surface. Fork CI approved for this tip (CI 38446628387, body/no-mistakes 38446628429).
  • Attestation: MATCH at tip 4190442f. Live claim 5/5 noted.
  • Contract-class: restore. The header already said other forges remain visibly unmeasured; polling was raising observation-unavailable on GitLab ownership. This puts the unconfigured path back on that promise (not a new default).
  • VISION.md: one-interface / honesty-under-load align (stop false alerts); authority / scripts / restart / spine / vendor / scope align. No new captain surface.
  • fix: require explicit authority for Firstmate upstream contributions #7172: that merge (7df545bf, explicit authority for Firstmate upstream contributions) is orthogonal — different files and concern (self-repo role/authority vs contribution-poll forge reads). It does not land or obsolete this fix.

CI is running now. Once this tip is green and main is green, this is on the auto-merge path (restore). Nothing for you to do unless CI surfaces an author-owned failure.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @mikaelz — tip moved to 0f86c82c (Pi before_agent_start prompt narrowing for TS2339) with attestation MATCH. Diff re-reviewed: contributions supported_url filter + legacy unsupported error clear remain restore; the two-line Pi guard matches the exact sites failing main's fm-pi-primary-types (parallel 1).

Workflow-zero. Approved fork runs for this tip: CI 38452392080, Require no-mistakes 38452392029.

Contract-class: restore (unchanged). Unsupported forge ownership stays unmeasured as the contributions header already promised.

VISION: all seven rules align. Live 5/5 noted.

Main: tip helps parallel 1 (Pi types) but does not fix serial 4 (fm-remote-reply NUL capture), so it does not fully green main — no merge while main stays red for that reason. Once this tip is green and main is green, auto-merge path stands. Nothing needed from you unless CI fails.

@mikaelz
mikaelz force-pushed the fm/fm-contributions-unmeasured branch from 0f86c82 to 282820c Compare October 14, 2026 04:14
@mikaelz mikaelz changed the title fix: keep unsupported forge contributions unmeasured fix: keep unsupported contribution URLs unmeasured Oct 14, 2026
@kunchenguid
kunchenguid merged commit 8902857 into kunchenguid:main Oct 14, 2026
37 of 38 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @mikaelz — really appreciate you taking the time on this.

Contract-class restore (unsupported forge ownership stays visibly unmeasured, as the contributions header already promised); full PR CI green and no-mistakes attestation matched at tip 282820c2; landed on green main as 8902857.

mfylkesnes added a commit to mfylkesnes/firstmate that referenced this pull request Oct 15, 2026
* feat: add per-home worker tool exclusions (#6750)

* feat(spawn): add per-home worker tool exclusions

Add an optional per-home config/crew-exclude-tools file listing tool names to hide from workers, one per line, with blank lines and # comments allowed.
It applies to every ship and scout launch and relaunch in that home, is never inherited by another home, and does not affect secondmate agents.
Pi and pi-signed apply it through --exclude-tools, which also covers MCP tool names.
Any other runtime, and a raw launch command, refuses the launch when the list is non-empty rather than ignoring it.
Malformed entries are refused before provisioning, and before a relaunch stops a running worker.
Exclusions that match no tool in the worker's loaded registry are reported as unverified warnings in its status record instead of refusing the worker.

Closes #6744

* no-mistakes(review): Preserve UTF-8 exclusion paths and verify Pi lifecycle behavior

* no-mistakes(document): Clarify worker tool exclusion documentation

* no-mistakes(ci): Fixed ci-1 in bin/fm-exclude-tools-lib.sh: a failed read now returns an error before printing names, so all shared launch and relaunch callers refuse rather than silently dropping exclusions. Added deterministic regression coverage for a file disappearing after readability checks across Pi/pi-signed ship and scout launches. Reproduced the original failure; verified 83 spawn checks, 77 relaunch checks, direct parser/runtime failure cases, full targeted lint, Bash syntax, and git diff --check. Relaunch tests passed with existing fixture-cleanup permission warnings. ci-2 remains unchanged per the user's decision; the outer executor owns the fresh CI run

* feat(bin): defer spawns beyond a declared per-project capacity, opt-in (#5343)

* refactor(bin): share the local Firstmate home walk from the wake library

Teardown's walk over the root home and its registered local secondmate homes
moves into bin/fm-wake-lib.sh as fm_local_firstmate_state_dirs, next to
fm_firstmate_root_home, so a second consumer can count task records across
this machine's homes without a copy. Teardown keeps its exact refusal wording
through a thin wrapper.

* feat(bin): defer spawns beyond a project's declared machine capacity

A project whose machine-local resource only serves a few workers at once had
no way to tell Firstmate so: every queued item was launched, and the surplus
workers spent full-context turns retrying the resource.

config/project-capacity in the root home now declares how many workers each
named project admits at once on this machine. bin/fm-spawn.sh counts the ship
and scout records on the same project origin across the root and its local
secondmate homes, skipping ones whose ready PR is recorded, while holding the
shared project lock through publication. A spawn with every place held exits 75
before any brief render, endpoint, worktree, record, or backlog move, so the
item stays queued; batches report it as deferred. Undeclared projects keep
today's uncapped dispatch, and an unreadable declaration refuses rather than
guessing the limit.

Refs #4237

* no-mistakes(review): Document that capacity matches the clone directory name

* no-mistakes(document): Rewrap stale fm-wake-lib root-home doc comment

* no-mistakes(review): Dedupe local state dirs by identity to avoid double-counting

* no-mistakes(document): Rewrap fm_local_firstmate_state_dirs error doc comment

* no-mistakes(ci): I fixed all four Greptile findings. All 14 tests in tests/fm-project-capacity.test.sh pass, and shellcheck at warning level is clean on the changed files. Each new test failed against the old code and passes now. - **ci-1 (spaced names):** a declaration line must give a name its capacity whenever the name is a valid clone directory name. `fm_project_capacity_lookup` now trims each line, skips blank lines and lines whose first non-blank character is `#`, and takes the last field as the capacity. Everything before that field is the name, so it may contain spaces. The old error cases still refuse: a single field is rejected, and trailing text leaves a last field that is not an integer. The library header and docs/configuration.md now say a name starting with `#` cannot be declared. New test `test_spaced_project_name_is_declared` declares `my heavy project 1` next to an indented comment line and gets a deferral. - **ci-2 (unreadable records):** the holder count must never silently leave out a holder. `fm_project_capacity_occupants` now refuses when a local home's state directory exists but cannot be read or listed, or when a `.meta` file cannot be read. The error names the path, and `fm-spawn.sh` shows it in its existing refusal message. New test `test_unreadable_holders_refuse_admission` covers an unreadable record in the root home and an unreadable state directory in a registered local secondmate home, then checks that the spawn is admitted once both are readable. The test is skipped when run as root. - **ci-3 (Orca lock):** any spawn that can become a holder for a capped project must take that project's lock. The lookup now also reports whether the declaration caps any project at all, and an Orca spawn takes the per-origin lock whenever it does. This covers every capped same-origin clone. It also covers some cases where no same-origin clone is capped, because a spawn cannot find clones under other directory names without searching for them. With no declaration file, Orca still skips the lock. The comments in the library and in the `fm-spawn.sh` header are updated. The Orca test now clones the origin as `project-2`, which has no declaration, and checks that its Orca spawn refuses while the lock is held and publishes no record. - **ci-4 (worktrees):** `assert_nothing_created` now also compares the project's `git worktree list` from before and after a deferred spawn. Both tests that call it take that snapshot first. Files changed: bin/fm-project-capacity-lib.sh, bin/fm-spawn.sh, docs/configuration.md, tests/fm-project-capacity.test.sh

* fix(bin): declare capacity for a project name that begins with #

A clone directory whose name begins with # was skipped as a comment, so that project stayed uncapped. A line is a declaration when the # is written against the rest of the name and the line ends with a capacity; a # followed by whitespace stays a comment.

* no-mistakes(document): Rewrap project-capacity library header comment

* no-mistakes(ci): Lint 2 fails because this PR's code pushes ShellCheck past its memory cap. ShellCheck ran out of memory analyzing bin/fm-teardown.sh in CI (reason=memory, rc=251, peak about 8.39 GB). On current main the same file passes at about 7.29 GB. **Cause:** the new `fm_local_firstmate_state_dirs` function in bin/fm-wake-lib.sh had a conditional `. fm-secondmate-registry-lib.sh` with a `# shellcheck source=` directive inside the function. ShellCheck followed that source again, inside a function scope, wherever fm-wake-lib.sh is sourced, and bin/fm-teardown.sh is the heaviest root that sources it. Measured locally with `shellcheck --norc --external-sources bin/fm-teardown.sh`: - current main (fd325b1b): 7.29 GB - main merged with this PR: 7.86 GB - the same merge without the in-function source: 7.27 GB **Rule this restores:** this change must not make any lint root heavier than it is on main. That function holds the only new nested source in the change. **Fix:** I removed the in-function source, which no caller needs. Both callers already load the registry library at top level before calling the function: - bin/fm-teardown.sh sources it directly. - bin/fm-spawn.sh, the only user of bin/fm-project-capacity-lib.sh, gets it through bin/fm-ff-lib.sh. I also documented the requirement in the function's comment and in the "Requires" note in bin/fm-project-capacity-lib.sh. No behaviour changes. **Verification:** - ShellCheck on head: bin/fm-teardown.sh peaks at 7.12 GB and bin/fm-spawn.sh at 6.68 GB, both with rc=0. bin/fm-wake-lib.sh and bin/fm-project-capacity-lib.sh lint clean. - tests/fm-project-capacity.test.sh, tests/fm-teardown.test.sh (102 ok) and tests/fm-teardown-endpoint-safety.test.sh all pass. Files changed: bin/fm-wake-lib.sh, bin/fm-project-capacity-lib.sh

* fix(bin): release the Herdr session lock when reclaim finishes

A concurrent resume in another home waits five seconds for that lock.
Reclaim is the last presentation change on the recovery path, so holding
the lock through the launch tail made the waiter time out. The contributions
arm check also freezes its one-second clock, the same way the budget tests
do, because an unfrozen clock can tick past before the first forge read.

* no-mistakes(review): Keep Herdr session lock through launch handoff after reclaim

* no-mistakes(review): Skip the spawning task's own record in capacity count

* no-mistakes(review): Restore release test comment above its test

* docs: scope PR-ready re-evaluation to a declared project capacity

A ready pull request frees a place only when that project declares capacity, so the always-loaded backlog contract should re-evaluate on that handoff only in that case.

* fix(bin): name the Lavish read message count by the same label as its section (#6785)

fm-procevent-lavish.sh read labels tag=message rows SESSION-ENDING MESSAGE
only when session_ended is true and CAPTAIN MESSAGE otherwise, but the
count line always said session_ending_message_count. Several composer
messages on a still-open board were therefore counted as session-ending.

The count line now follows the same session_ended switch:
session_ending_message_count once the session ended, captain_message_count
otherwise. Message rows stay out of the annotation count, per triage.

Fixes #6743

* fix(herdr): make the presentation lock namespace per OS account (#6780)

The Herdr presentation lock namespace was the fixed machine-global
/tmp/firstmate-herdr-presentation, so on a host where two OS users run
Firstmate on Herdr the first account to create it owned it and every
teardown from the other account was refused with no way to clear it.

Suffix the namespace with the account uid. The owner-uid and mode-700
checks are unchanged, so a foreign-owned or wrong-mode name at this
account's path is still refused and never adopted, chowned, or removed.

Fixes #4716.

* Fix OpenCode arm plugin to decide with the shared supervision predicate (#6809)

The OpenCode session plugin's shouldArm kept its own copy of the need
test that only looked for in-flight task records, while the turn-end
guard decides with fm_supervision_needed in bin/fm-supervision-lib.sh,
which also counts registered process-event sources and trusted custom
checks. With an empty fleet but any registered source or check, the
guard blocked every turn end while the plugin declined to arm - a loop
the guard's own repair line could not resolve because it names the
plugin as the fix.

The plugin now delegates the decision to the shared predicate through
bash, keeping the local away-record decline and the x-mode.env arm
override. OpenCode plugin test fixtures now carry the real predicate
their arming path sources, and the arm suite gains six cases asserting
the plugin's decision against the shared verdict over the same
synthetic state directories.

Co-authored-by: Mia Sun <[email protected]>

* fix(bin): resolve a pending reply only from its own task's status line (#6792)

* fix(bin): resolve a pending reply only from its own task's status line

Remote reply ingestion handed every corr= token in a mate's payload to
fm_pending_reply_try_resolve together with that mate's own status log,
so one mate echoing another mate's token resolved the other request.
Honor a status-file override only when it is the record's own
parent_status, and match the corr= token as a whole word.

Fixes #6538

* no-mistakes(document): docs: scope remote reply settlement to the asked mate

* docs(skills): index the six missing agent-only skill triggers (#6784)

agent-skill-trigger-index claims to be the complete agent-only trigger
index but omitted operational-home-layout, session-start-recovery,
validation-supervision, ship-landing, scout-completion, and
away-quiet-supervision. Add each with its own description's trigger,
placed beside the related entries.

The decision-hold-lifecycle redirect stub stays out, per triage.

Fixes #6503

* test: make agent process fixtures compatible with multicall sleep (#6814)

* test: share a rename-safe agent stand-in across liveness suites

On Ubuntu 26.04, `sleep` is the uutils multicall binary, which refuses to
run when invoked through a symlink named after another utility. The Herdr
descendant process-walk tests built their agent-named process as a `pi`
symlink to the host `sleep`, so the process exited at once, its parent shell
was gone before the walk ran, and both cases read `unknown unreadable` and
failed on that host. The suite stops at its first failure, so every later
case went unrun. The Herdr control smoke test's `claude` symlink has the
same construction.

The tmux liveness suite already solved this with a host-compiled spinner and
a survival-checked `sleep` fallback. That builder moves into tests/lib.sh as
fm_agent_standin, and the tmux suite, both Herdr descendant cases, and the
Herdr control smoke test now use it. When no stand-in can survive a foreign
name, a case skips with the reason instead of failing.

tests/fm-test-fixtures.test.sh gains a portable regression with a fake
multicall `sleep`, so it bites on hosts whose own `sleep` is single-purpose.

* no-mistakes(document): Correct Herdr verification fixture reference

* ci: retrigger cancelled shard

* fix(bin): keep the supervision host's successor watcher alive after the Stop hook's group is torn down (#6787)

* fix(bin): keep the supervision host's pass-through successor out of the hook's process group

The successor a main-only pass-through leaves for main shared the Stop hook's
process group, so the harness tearing that group down after the exit-2 rewake
stopped it. The stop published downtime and the next park's first cycle
announced an empty check: rearm-resurface, which woke main again in a loop.
Start that successor in a process group of its own, as the hook's own
handling successor already is.

* no-mistakes(review): Give the at-turn successor left for main its own group

* no-mistakes(document): Document own-group successor for turn-start hand-back too

* no-mistakes(ci): I made the change you asked for: both new teardown tests in tests/fm-supervision-host.test.sh now call the existing `stop_home_processes "$home"` just before `pass`. The tests are `test_successor_left_at_the_turn_survives_the_hook_process_group_teardown` and `test_pass_through_successor_survives_the_hook_process_group_teardown`. No production code and no other tests changed. The rule broken was that a test must not leave a home's watcher or arm processes running after it passes. These two were the only cases in the changed area that broke it. The other host+hook tests already stop their home, and `test_successor_close_during_main_turn_is_delivered_at_the_next_turn_end` leaves its watcher behind too, but it is an older test you said not to touch. The only reason anything was left over is that the successor's arm now sits in its own process group, outside the hook's teardown. `stop_home_processes` kills the watcher by the pid in its lock file, which stops it no matter which group it is in. **Checks run:** - I ran just these two tests from a scratch copy of the suite (since deleted). Both pass in about 13 seconds. - After each test, a process listing filtered to that test's home directory came back empty once the processes had about a second to exit after TERM. - `bash -n` on the test file passes. - `shellcheck` is not installed here, so I did not lint the file. - I did not run the full serial-2 suite locally. Whether it now finishes under its 30-minute limit will only show on the next CI run

* test: make tmux Claude readiness checks independent of permission footers (#6823)

* test: use idle composer readiness for Claude tmux guards

* no-mistakes(test): Fix attended supervision test expectations and isolate worker state

* no-mistakes(document): Correct live guard coverage and readiness documentation

* no-mistakes(ci): Captain, fixed SC2100 by quoting the cursor-agent assignment in tests/fm-host-mirror-live-e2e.test.sh. Reproduced the failure before editing; pinned ShellCheck lint on both PR test files, bash syntax checks, and git diff --check now pass

* test: preserve attended successor close assertions

* no-mistakes(test): Fix attended live test watcher takeover expectations

* no-mistakes(document): Correct stale attended guard documentation

* Revert "no-mistakes(document): Correct stale attended guard documentation"

This reverts commit 8e59d89e17f48afc6e5a72d6d23fdca156a0f856.

* Revert "no-mistakes(test): Fix attended live test watcher takeover expectations"

This reverts commit c0b851054917fcbe957469eb0b1bc2c2075fcc51.

* test(herdr): accept safe exit refusals and clean lab once (#6818)

* test: stabilize watcher lock race fixtures (#6887)

* test: order stale watcher-lock fixture races explicitly

* no-mistakes(review): Removed duplicate stale-steal reap call

* fix(bin): keep herdr composer probes observable-only without autostarting server (#6920)

* fix(bin): keep herdr composer probes observable-only without autostarting server

- Refuse bare pane identifiers lacking session prefix in fm_backend_herdr_parse_target
- Add fm_backend_herdr_target_observable to passively verify server liveness without autostarting
- Route visible viewport captures through fm_backend_herdr_target_observable
- Detach stdin with </dev/null on background server launch in fm_backend_herdr_server_ensure
- Add unit and regression tests in tests/fm-backend-herdr.test.sh

* fix(bin): drop parse_target colon restriction to preserve existing fixtures

Revert the fm_backend_herdr_parse_target colon check so that single-colon
session targets like sess:p1 in secondmate liveness and other fixtures parse
properly. The probe path remains observable-only via fm_backend_herdr_target_observable.

* fix(tests): clear inherited Git repository location in fixture helper (#6956)

* test: clear inherited Git repository location in fixture helper

An absolute GIT_DIR inherited from the caller (a linked-worktree hook
exports one) overrides the discovery that git -C implies, so fixture
setup moved the caller's branches and registered fixture worktrees in
it. tests/git-config-helpers.sh now unsets GIT_DIR, GIT_WORK_TREE,
GIT_INDEX_FILE and GIT_COMMON_DIR alongside the config isolation.

Fixes #6953

* no-mistakes(document): Document fixture Git location isolation in CONTRIBUTING

* fix: avoid argument-size failures in fleet contribution snapshots (#6830)

* fix(bin): stage contribution-input JSON via temp files

The contribution-input branch passed the whole canonical backlog document to
jq as a single --argjson argv argument. A large fleet's backlog JSON exceeds
Linux MAX_ARG_STRLEN (128 KiB), so jq fails with E2BIG (Argument list too
long) and the contribution-input snapshot emits empty output, breaking the
bearings contribution path.

Write both the backlog and task documents to a temp directory and hand them
to jq with --slurpfile, matching how the full snapshot path already stages
the same pair. Output is unchanged for any backlog that fits in argv.

* no-mistakes(document): Correct contribution cleanup trap comment

* fix(bin): arm the busy contract on secondmate launches (#5342)

* fix(bin): arm the busy contract on secondmate launches

A tmux-backed secondmate's active-turn gate can only see a busy verdict from the parent home's record, and those launches never armed it.

* no-mistakes(review): Reopen secondmate busy on blocked Claude Stop; drop muse guard

* no-mistakes(review): Make Claude secondmate Stop guard the sole Stop-state writer

* no-mistakes(review): Record live rewake UserPromptSubmit evidence and add regression

* docs: record Claude secondmate Stop guard as busy writer

* no-mistakes(review): Keep Stop idle hook for older secondmate guards

* no-mistakes(document): Correct stale omp secondmate -e rationale in supervision verification

* no-mistakes(document): Fix skill-relative turnend-guard link in Claude harness reference

* no-mistakes(ci): Root cause: in shard 9, the pure-contract-unit family ran two scripts, tests/fm-rovo-harness.test.sh (14712 ms) and tests/fm-omp-harness.test.sh (10335 ms). Those two durations add up exactly to the failing family's 25047 ms. The failing one was tests/fm-omp-harness.test.sh. Its test_secondmate_launch_relies_on_discovery still asserted the old contract: that an omp secondmate launch names no -e and gets no state/<id>.omp-ext.ts. This PR (issue #4268) deliberately changed that. bin/fm-spawn.sh now arms the busy contract for omp secondmates, so their launch names `-e state/<id>.omp-ext.ts` and writes that extension. The primary extensions are still left to auto-discovery. The harness reference docs were updated to match, but the test was not. The fix is test-only and touches just tests/fm-omp-harness.test.sh. The test now asserts that the secondmate launch names exactly one -e and that it points at the parent-home state/sm.omp-ext.ts. Because only one -e is allowed, the tracked .omp/extensions files are not named a second time, which would load them twice. The test also asserts that the extension file exists, and the header comment for contract 3 was updated. The posture overlay, --cwd, marker, and supervision-model assertions are unchanged. Verification: the host's load average was about 140 on 8 cores, and the full script timed out locally after 590 s having finished only its first 2 tests. So I ran the one affected test function on its own through the real fm-spawn path, and it passed (`ok - fm-spawn: a real omp secondmate launch loads only the busy -e and auto-discovers its primary extensions`). The remaining omp tests were not re-run locally. shellcheck on the file reports only existing info-level notices. The change is left uncommitted for the outer executor

* test: keep the secondmate busy stall gate visible after main's liveness probe

The merged watcher treats a window-name inventory miss as a missing endpoint and exits a later checkpoint on the previous quiet run's recovery wake. The fake pane now answers both list-windows formats, and each observation starts without a leftover downtime marker, so a busy mate still defers the stall and an idle mate still surfaces it.

* no-mistakes(review): Align fm-spawn secondmate comments with omp -e and devin refusal

* no-mistakes(document): Document secondmate busy extensions in configuration reference

* no-mistakes(test): Make live busy-contract guard clean up read-only lab dirs

* fix(bin): pass Claude secondmate busy hooks through --settings

Rewriting a persistent mate home's settings.local.json drops the captain's saved permissions. The hooks now live in a parent-state file Claude Code loads for that session only.

* no-mistakes(review): skip busy arm for raw secondmate launch commands

* no-mistakes(review): retire earlier busy arm on raw secondmate respawn

* no-mistakes(review): retire Stop pointer on relaunch, load --settings in live guard

* no-mistakes(document): Document secondmate Claude settings file and raw-launch exception

* no-mistakes(ci): The check "Behavior portable serial 9" failed because of this PR, and I fixed it with a test-only change; `tests/fm-spawn-dispatch-profile.test.sh` now passes locally in full. Cause: the one failing test was "claude secondmate launch settings JSON does not disable Claude attribution" in `tests/fm-spawn-dispatch-profile.test.sh`. This PR makes a claude secondmate launch pass `--settings` as a file path (`state/<id>.claude-settings.json`) instead of inline JSON. The test helper `claude_settings_json_arg` handed that path string to jq as if it were JSON, so jq reported a parse error. The product behavior is correct: the file does carry `feedbackDrafts` and the attribution-off policy. Invariant: a test that checks the Claude launch settings must read the settings Claude would load, whichever form `--settings` takes (inline JSON or a file path). The only place this must hold is `claude_settings_json_arg`, the single reader of the `--settings` value in the tests. Its two callers, `assert_attribution_policy` and `assert_attribution_policy_absent`, both go through it. Fix: `claude_settings_json_arg` now prints the value when it starts with `{` and prints the file contents otherwise. No product code changed. Verification: I ran `bash tests/fm-spawn-dispatch-profile.test.sh` in the worktree. It ended with "all fm-spawn-dispatch-profile tests passed", including the previously failing secondmate case and the crewmate and keep-ai-trailers cases that use the inline form. I did not run the other tests of shard 9; they passed in the CI run and this change touches only this test file. The change is uncommitted in the worktree (one file modified)

* test: guard fleet snapshot contribution input against argument-size failures (#7036)

The large-backlog regression already proved the json and secondmate
home-summary modes stay within exec limits. It now also runs the
contribution-input mode on the same 1200-record backlog, which is the
path #6830 moved off argv. With that fix reverted the test fails with
the field error jq Argument list too long at the contribution-input call.

* fix(bin): scrub nested repos from scratch copies before treehouse return (#5843)

* fix(teardown): scrub nested repos before return

Treehouse return uses git clean -fd, which leaves a nested git
repository in the pool slot. Scout and forced teardown run
git clean -ffdq first. A return that stays dirty names the
lost slot instead of reporting a clean return.

* no-mistakes(review): Report lost pool slots early and scrub forced child copies

* no-mistakes(review): Drop misleading no-rerun clause from lost-slot message

* no-mistakes(document): Note failed status read in teardown dirty-return header

* no-mistakes(ci): I fixed ci-1 and ci-2 in bin/fm-teardown.sh, and I added tests in tests/fm-teardown.test.sh. Invariant (ci-1): a lost-slot finding must only warn. It must never change the teardown exit status. Two places must obey this: the final status block, and the remote success path that a forced remote retirement uses. - The final block no longer runs `exit 1`. When a slot is lost, teardown writes a lost-slot line to stderr instead of the clean "teardown X complete" line. Then backlog_refresh_reminder runs and teardown exits with its normal status. - Before this change, remote_secondmate_teardown discarded the remote output when the remote run succeeded. Now it sends that output to stderr. Without this, the remote lost-slot warning would not reach the operator once the remote side exits 0. - I updated the header comment to match. Invariant (ci-2): after a return that succeeds, teardown must verify every returned copy, or it must warn that it could not. This invariant is enforced inside teardown_note_dirty_return, which both return sites call (the main WT return and the forced-secondmate child return). Before, a copy that was missing or not a readable git worktree caused a silent `return 0`. Now it sets the lost flag and gives the same warning, with the text "cannot verify: the copy is missing or not a readable git worktree after return". Both call sites run only for a copy that existed before the return. The exit status does not change. Tests: - The dirty-return test now expects exit 0 and the warning. - New test (z3d): a forced secondmate teardown whose child return leaves residue. This is the same command that `retire --force` runs on the remote host. The test expects exit 0 and the warning, and it checks that the task record and the home are removed. - New test (z3e): a return that removes the copy's .git. The test expects exit 0, the "cannot verify" warning that names the copy, and no clean completion line. Verification: - I ran the new and updated tests against the old script. Three failed as expected (exit 1, or no warning). With the fix, all of them pass. - The full tests/fm-teardown.test.sh suite passes: 117 ok, 0 not ok. - shellcheck shows no new warnings. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh is still running. It covers the remote success path that now relays output. Up to now it has no failures, but it has not finished, so I cannot report a final result for it

* no-mistakes(ci): I fixed ci-1 and ci-2 as one exit contract, as the user asked. The changes are in bin/fm-teardown.sh, tests/fm-teardown.test.sh, and tests/fm-remote-secondmate-lifecycle-e2e.test.sh. Invariant (ci-1): when a returned slot is dirty or cannot be verified, teardown must finish every cleanup step and then exit with exit code 4. Exit 4 is used for nothing else. It must hold in two places: the final status of a local teardown, and the remote secondmate retirement caller. - Local: the existing lost-slot flag now leads to `exit 4` (TEARDOWN_LOST_SLOT_EXIT). This exit comes after the task record is removed, the warning is printed, and backlog_refresh_reminder runs. A clean return still exits 0. Refusals and errors exit 1, and an invalid request exits 2. The header documents all of these codes. Exit 3 is only an internal "not remote" return. The ssh transport uses 255. - Remote caller: remote_secondmate_teardown treats a remote exit 4 as "retired with a lost-slot warning". It does the full local retirement (route, registry line, reply source, records, summary refresh), prints the normal completion line on stdout, and then returns 4. The remote control script runs fm-teardown.sh as its last command, and fm-on.sh execs ssh, so the remote 4 reaches the local side unchanged. Invariant (ci-2): remote output goes to local stderr only when it is a lost-slot warning. - After a clean remote retirement (exit 0), the caller no longer prints the captured remote output. - After exit 4, the caller forwards only the lost-slot warning header and the remaining-path lines. To make those lines easy to find, teardown_note_dirty_return now indents each remaining path by two spaces. Tests: - The dirty-return (z3), forced-secondmate dirty-child (z3d), and copy-removed (z3e) tests now expect exit 4 after cleanup. The clean scout return (z1) still expects 0. - The final remote retirement in the e2e test now uses a fake-ssh mode, retire-lost-slot. In this mode the real remote retire runs, and then the fake reports a lost child slot with exit 4. The test checks the following: exit 4; the remote home, parent metadata, and route are removed; stdout has "teardown ios complete (remote"; stderr has the warning and the remaining path; and stderr does not contain the remote completion text. The remote side producing exit 4 is covered by z3d. Verification: - tests/fm-teardown.test.sh: 117 ok, 0 not ok. - tests/fm-remote-secondmate-lifecycle-e2e.test.sh: ALL TESTS PASSED. - shellcheck shows the same warning count as before on all three files. - Against the previous script, both suites fail as expected. In the local suite, dirty-return expected 4 but got 0. In the e2e test, the stdout local-completion check fails

* no-mistakes(ci): Both CI failures came from the lost-slot check that this PR added. Shard 3: tests/fm-secondmate-safety.test.sh "force teardown failed to discard child work". Shard 7: tests/fm-teardown-endpoint-safety.test.sh exited 4. The check ran after the return of every copy. Treehouse return removes a copy that is not a pool slot, so the check reported "cannot verify" and teardown exited 4. Before the fix, both failures happened on my machine. Invariant: only a Treehouse pool slot can be lost by the pool, so the check runs only for a copy that was a pool slot before the return. Fix in bin/fm-teardown.sh: both return sites (the main WT return and the forced-secondmate child return) now run fm_treehouse_pool_slot before the return. They call teardown_note_dirty_return only when the copy was a pool slot. teardown_note_dirty_return lost its pool-slot branch and its unused proj argument; the slot label still comes from the path of the copy. Test fix: in tests/fm-teardown.test.sh, the z3d child copy was not a pool slot. It is now a real pool slot (pool/6/repo plus treehouse-state.json), and the test still expects exit 4 and the warning. Verification: endpoint-safety 27 ok, exit 0. secondmate-safety 79 ok, exit 0. fm-teardown 117 ok, 0 not ok. remote-secondmate-lifecycle-e2e ALL TESTS PASSED. shellcheck count is unchanged (17)

---------

Co-authored-by: Nova Agent B <[email protected]>

* fix(bin): pin markdown backend in backlog handoff and receive (#7047)

* fix(tests): keep backlog suites hermetic against a local .tasks.toml

Fixture homes now write the tracked markdown defaults through a
fm_test_tasks_toml helper instead of copying the checkout's .tasks.toml,
which an operator may override with a beads backend at a live backlog.

The backlog handoff and receive moves pin --backend markdown, because they
already name their markdown files and otherwise resolve the backend from the
caller's working directory. The atomicity suite runs from its scratch root so
its direct tasks-axi fixture calls cannot read the checkout config.

* no-mistakes(review): Add decoy-cwd .tasks.toml regressions for handoff and receive

* no-mistakes(lint): Reuse sha256_file helper to fix SC2015 in remote handoff test

* fix(bin): parse whole project names in home seed registry queries (#7076)

* fix(bin): parse whole project name in home seed registry queries

Parse the full project name after the dash in fm-home-seed.sh registry lookups.

This matches the round-3 bootstrap mirror check parser so spaced names resolve.

Cover both the project-less seed refusal guard and registry line lookups in tests.

* no-mistakes(review): Match registry rows by name prefix plus separator

* no-mistakes(document): Note shared registry row-match rule in fm-home-seed

* fix: preserve announced recovery across Codex checkpoints (#4490)

* fix(codex): preserve announced recovery across checkpoints

* no-mistakes(review): Make announced-recovery checkpoint test reproduce the regression

* no-mistakes(review): Separate 2026-10-07 checkpoint fixture verification from original run

* no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks

* no-mistakes(document): Update checkpoint recovery and signal documentation

* no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh

* no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks

* Revert "no-mistakes(ci): Updated both lock-acquire retry loops to honor the watcher’s TERM stop status, so held-marker cleanup exits while retaining stale lock evidence. Set the --stop test’s watcher poll to 1 second to fit its 5-second stop bound. Syntax checks and the full watch-arm suite passed; the targeted held-marker test passed during the triage suite, which timed out after 600 seconds before completing. Did not change or attempt to fix fm-supervision-host.test.sh"

This reverts commit 44ce29bfbfa95149a7785efc200f6a00b5bf3a41.

* Revert "no-mistakes(ci): Removed the cleanup-bound test that incorrectly expected a TERM-stopped watcher to retry a contended lock acquisition. TERM cleanup intentionally stops after the failed attempt; the remaining held-lock test verifies it exits and retains stale lock evidence. The two relevant TERM tests passed, as did shell syntax and diff checks"

This reverts commit e1e37067a9369f0c38d7bd1c7a0913b1c54fc28a.

* Revert "no-mistakes(test): Defer TERM exit to clean up quiet checkpoint watcher locks"

This reverts commit 9877bf92134e77414e25cd8e6f122ff4d089473a.

* fix: let checkpoint watcher clean up before timeout

* no-mistakes(review): Scope checkpoint timeout escalation and restore signal docs

* no-mistakes(review): Fix Perl checkpoint timeout escalation

* no-mistakes(document): Clarify checkpoint recovery documentation

* no-mistakes(document): Document isolated checkpoint regression command

* no-mistakes(ci): Tied direct-checkpoint SIGKILL escalation to the effective cleanup bound, preserving the five-second minimum and leaving the supervision-host path unchanged. The targeted checkpoint suite, shell syntax checks, ShellCheck, and diff checks pass. CI was not manually rerun

---------

Co-authored-by: jopo <[email protected]>

* feat(bin): support Forgejo/Gitea as a forge via the tea CLI (#4395)

* feat(bin): add Forgejo (tea) as a third forge alongside GitHub and GitLab

Extends the existing provider-tagged PR/MR dispatch in fm-pr-lib.sh,
fm-pr-poll.sh, fm-pr-check.sh, and fm-pr-merge.sh with a forgejo arm,
following the same pattern already established for GitLab. tea addresses a
repository by owner/repo slug only and resolves the host through a named
"tea login" rather than a URL, so the login is matched against the PR's host
fresh at arm and merge time. tea's own merge subcommand exposes no
head-binding flag, so the merge itself calls Forgejo/Gitea's REST API
directly via "tea api" with head_commit_id, verified against a real
disposable instance to behave like --match-head-commit/--sha; that same
verification found that "tea api" reports an HTTP-level failure with exit
status 0, so a merge is confirmed only by reading the pull request back
afterward, never by trusting the command's own exit code.

Adds forgejo as a value of the registry's existing forge= binding (the
closed set becomes none|gerrit|forgejo, with its refusals unchanged), so a
generated brief and its direct-PR Definition of done name tea before any PR
exists and bin/fm-spawn.sh's forge agreement and bin/fm-promote.sh carry it
like gerrit. Documents the new value in docs/configuration.md,
docs/architecture.md, and a new maintainer-verification doc mirroring
docs/gitlab-merge-watch.md.

* no-mistakes(review): Redact private Forgejo host/IP from evidence doc

* no-mistakes(review): Fix doc's tea-login JSON shape; dedupe host validators

* no-mistakes(document): Add Forgejo to README doc index and scripts.md forge list

* no-mistakes(lint): {"summary": "fix(bin): drop unused FORGEJO_LOGIN capture in fm-pr-check.sh"}

* fix(bin): refuse --allow-red on Forgejo instead of dropping it silently

The attended --allow-red waiver landed on main while the Forgejo arm was
being written, so its applicability guard only ever classified GitHub and
GitLab. On a Forgejo pull request the flag parsed, and then nothing read
it: forgejo_verify_mergeable requires the head's combined commit status to
be exactly "success", with no per-check name to match a waiver against.

The merge still refused, so no red Forgejo merge was ever possible, but it
refused without saying the waiver had been ignored. Extend the existing
GitLab guard to cover Forgejo for the same reason GitLab has it: both
collapse their checks into a single head verdict, so the green requirement
is absolute and a named waiver cannot apply.

* fix(bin): poll a Forgejo pull request by number through tea api

The merge watch listed the 50 most recent pull requests and filtered to the
watched index, so in a repository with more newer pull requests a merged
watch never fired. Read the one pull request through tea api instead and wake
only on a boolean merged field of true, since tea api exits 0 on HTTP errors.

Share the tea login match as fm_pr_forgejo_login for every sourcing script and
add fm_pr_forgejo_read_record for the state, merged flag, and head. Arming now
also requires jq, which the poll needs to read the record.

* fix(bin): gate a Forgejo merge on every status page and on draft state

The combined-status endpoint computes its state from one page of contexts, so
a failing context past the first page could leave the head reading green. Read
every page until an empty one and require each to be success. Also refuse a
pull request the API reports as a draft.

* fix(bin): prove a Forgejo task landed from its merged pull request at teardown

pr_is_merged read the recorded pr= only through gh, so a Forgejo task always
fell back to the content check and refused landed work whenever that check was
inconclusive, such as when later default-branch commits conflict with the
merged tree. Read a recorded Forgejo URL through fm_pr_forgejo_read_record and
apply the same containment check against its head.

* feat(bin): read Forgejo pull requests in crew-state and review-diff

fm-crew-state reports a terminal passed run's Forgejo pull request as open,
closed, merged, or unknown through fm_pr_forgejo_read_record, and
fm-review-diff resolves a /pulls/<n> URL to the refs/pull/<n>/head ref
Forgejo serves. Document the by-number read, the paged status gate, and the
draft gate, and mark what the evidence instance did not exercise.

* fix(bin): parse tea logins as JSON and close the remaining Forgejo gaps

The tea login match split each line of `tea login list --output json` on
quotes and read field 4, which only works while tea pretty-prints one field
per line. A login printed as one compact object put the login name where the
url belonged, so arming, merging, and polling refused every Forgejo host.
fm_pr_forgejo_login and the static poll's own copy now parse the list with
jq, matching each login's url host with scheme, userinfo, port, and path
stripped, and still refuse zero or several matches.

--allow-missing is now refused on a Forgejo pull request the way --allow-red
already is, instead of being parsed and ignored: the merge already requires
the head's combined commit status to have succeeded.

The forge=forgejo Definition of done read the draft state back with
gh-axi pr view and cleared it with gh-axi pr ready although the PR is opened
with tea; both publishing modes now read the draft state through tea api and
clear Forgejo's work-in-progress title prefix with tea pulls edit.

* no-mistakes(review): Retry Forgejo merge confirmation read before failing

* no-mistakes(document): Document Forgejo draft gate and merge confirmation retry

* fix(bin): merge Forgejo pull requests with the repository's default style

When the caller named no merge method, a Forgejo merge always sent Do=merge,
so a repository that allows only squash or rebase merges refused every
default call. The style now comes from the repository's own
default_merge_style, read live through the same tea login, and a merge is
refused when that value cannot be read or is not a known style rather than
replaced by one chosen here. A method the caller names still wins.

---------

Co-authored-by: dna <dna@local>

* fix: prevent concurrent secondmate relaunch races (#7154)

* fix: serialize secondmate liveness relaunches across task set

* no-mistakes(review): Remove relaunch wait override and test bounded contention

* no-mistakes(document): Clarify secondmate relaunch locking and timeout documentation

* chore: keep local Stele binding out of shared template

* no-mistakes(document): Correct stale secondmate recovery timing comment

* chore: exclude local Stele binding from relaunch fix

* ci: retrigger CI after a timed-out test shard

* no-mistakes(document): Correct secondmate recovery ordering documentation

* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

* fix: keep unsupported contribution URLs unmeasured (#7233)

* fix: keep unsupported contributions unmeasured during polling

* no-mistakes(document): Clarify unsupported contribution polling documentation

* no-mistakes(review): Match literal GitHub hostname and cover unsupported lookalikes

* no-mistakes(review): Separate durable ownership compatibility from GitHub observation eligibility

* no-mistakes(document): Clarify unsupported contribution coverage and ownership compatibility

* fix(bin): keep inherited Git config entries when installing the trailer-strip hooks path (#6341)

* fix(bin): keep inherited Git credential helpers when installing the trailer hooks path

Problem:
Every fleet launch prefixed the worker command with `export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=...`.
That replaced any `GIT_CONFIG_*` entries the pane already carried, so a scoped HTTPS credential setup such as `credential.helper=` followed by `credential.helper=!gh auth git-credential` was silently dropped.
Git then fell back to the system or global helper (for example `osxkeychain` from the system gitconfig on macOS), so a worker meant to use a scoped token pushed with the user's personal credentials.

Reproduction on main:
GIT_CONFIG_COUNT=2 GIT_CONFIG_KEY_0=credential.helper GIT_CONFIG_VALUE_0= GIT_CONFIG_KEY_1=credential.helper GIT_CONFIG_VALUE_1='!gh auth git-credential' sh -c "<emitted launch>; git config --get-all credential.helper" prints none of the inherited entries, only the system helper (`osxkeychain` from Homebrew's system gitconfig on the reporting machine).

Fix:
The launch prefix now appends `core.hooksPath` at index `GIT_CONFIG_COUNT` and increments the count, resolved in the destination shell after any `config/launch-env-allowlist` filtering.
The inherited count is validated as decimal before shell arithmetic, leading zeros are normalized (Git accepts `02`), and a count that cannot be extended within Git's signed int refuses.
A refusal uses `return 1 2>/dev/null || exit 1`, so when the pane sources the launch file the error stays visible and the interactive shell survives instead of the pane dying with the message.

Tests:
`tests/fm-spawn-dispatch-profile.test.sh` gains a behavior test that runs the real emitted launch under sh, bash, and zsh with inherited credential-helper entries and counts `2` and `02`, then asks Git for `credential.helper` and `core.hooksPath`.
The same test checks that an invalid or overflowing count refuses, and that sourcing the launch file from an interactive shell keeps that shell alive with the error visible.
The exact-launch assertions in the dispatch-profile and Kimi suites now extract the emitted prefix through one `fm_test_launch_git_prefix` helper in `tests/lib.sh` instead of two hand-copied strings, whose content the behavior test covers.

Risk:
Top-level `return` outside a sourced file is unspecified by POSIX; verified on macOS sh (bash 3.2 in POSIX mode), bash, and zsh, and every path still ends nonzero before the worker command runs.
The hook wrapper still unsets only `GIT_CONFIG_COUNT` and index 0, which is sufficient because Git ignores indexed entries once the count is unset.
A launch that forwards `GIT_CONFIG_COUNT` without all of its indexed keys now fails in Git instead of being masked by the overwrite.

* no-mistakes(review): Keep inherited Git config in hooks and fish-safe launch

* no-mistakes(document): docs: describe appended hooksPath keeping inherited Git config

* test: run the fish pane launch cases in CI

Install fish in the portable serial lane and run the credential-append
and invalid-count refusal cases under fish. Under CI the spawn test
fails instead of falling back to the static syntax check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: strip the Git config launch prefix before reading the Claude doorbell

The trust suite evaluated the whole launch command to find the final prompt
argument, so it now also sourced the per-spawn git-config env file that the
fake pane never writes. Drop that prefix the same way the dispatch suite does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: share the launch command parser across the spawn suites

The trust suite failed in CI because its copy of the launch parser missed
the Git configuration prefix the dispatch suite's copies already stripped.
Move the prefix and export stripping into tests/lib.sh next to
fm_test_launch_git_prefix so the three parsers cannot drift again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(bin): canonicalize env-file hooks path and tighten launch-config tests

env-file now writes the canonical (pwd -P) spelling of the hooks directory, matching what install records, so a symlinked path no longer makes the hook wrapper miss its own entry and silently skip the repository's hook.
A new strip test passes a symlinked hooks path through env-file and fails without this change.

The launch-env-allowlist test now also asserts the appended core.hooksPath, so a regression that drops the strip-hook entry only on the env -i path is caught.

Without fish installed locally, the launch test now prints an explicit fish skip line and limits its pass message to sh, bash and zsh, instead of claiming every pane shell after only a static token check.

* no-mistakes(review): Drop CI fish install and CI-only fish refusal

* no-mistakes(document): Document GIT_CONFIG_COUNT overflow refusal in configuration docs

* test: prove a refused Git config count never starts the worker

The invalid-count refusal checks only asserted a nonzero status and the helper's own error text.
If the launch line kept going after the refusal, the worker probe's final `git config` also failed under the bad count, so the checks still passed.
The probe now prints a marker on stderr, and every refusal case in sh, bash, zsh and fish asserts the marker never appears.
Dropping the `|| return 1 2>/dev/null || exit 1` guard from the launch line now fails the test.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: cloud-practitioner <[email protected]>
Co-authored-by: Tiago <[email protected]>
Co-authored-by: yairtech <[email protected]>
Co-authored-by: Asser AboElkhair <[email protected]>
Co-authored-by: dubiousenvelope <[email protected]>
Co-authored-by: Mia Sun <[email protected]>
Co-authored-by: Pedro Guimarães <[email protected]>
Co-authored-by: menidi <[email protected]>
Co-authored-by: YifuGu <[email protected]>
Co-authored-by: vikash. <[email protected]>
Co-authored-by: Martin Kessler <[email protected]>
Co-authored-by: Jon Roosevelt <[email protected]>
Co-authored-by: guanchengh-lgtm <[email protected]>
Co-authored-by: Nova Agent B <[email protected]>
Co-authored-by: John Poyser <[email protected]>
Co-authored-by: jopo <[email protected]>
Co-authored-by: Mirco Santori <[email protected]>
Co-authored-by: dna <dna@local>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Stephen Haptonstahl <[email protected]>
Co-authored-by: Michal Zuber <[email protected]>
Co-authored-by: Andrew Li <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
sgwoods added a commit to sgwoods/firstmate that referenced this pull request Oct 15, 2026
…uid#7233

Upstream kunchenguid#7233 "keep unsupported contribution URLs unmeasured" fixed this
independently and better, one layer up: it gates observation on supported_url
and keeps unsupported URLs out of final settlement and the forge-read rotation
entirely. Because observe() is therefore never called for an unsupported URL,
the two guards this branch added inside it are unreachable, and the
first-iteration unbound-variable abort they also fixed can no longer happen.

So this commit removes that half and restores observe() to upstream's form,
byte for byte. It also drops test_unsupported_forge_url_is_never_recorded_as_a_failure,
which passes against upstream without this branch's changes and therefore
proves nothing; a test that cannot fail is worse than no test, because it
claims coverage it does not have.

The earlier commits on this branch are kept rather than rewritten so the
superseded work stays visible and reviewable. Anyone reading the branch should
see why that half appears and then goes.

What remains is the distinct defect upstream still has: a contribution read
stopped by a signal aimed at the read alone is recorded as a forge failure
rather than as unmeasured. read_cut_short, the unmeasured helper,
test_read_outcome_classification and the corrected header prose all stay.