Skip to content

feat(bin): attribute Beads audit-trail actors at every boundary - #3712

Closed
RooseveltAdvisors wants to merge 4 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-actor-identity-20260904
Closed

RooseveltAdvisors wants to merge 4 commits into
kunchenguid:mainfrom
RooseveltAdvisors:fm/fm-actor-identity-20260904

Conversation

@RooseveltAdvisors

Copy link
Copy Markdown
Contributor

Intent

Captain, 2026-09-04, on the Beads gap-fill table: "go finish these" - the actor-identity lever is idle and due: "1 actor across the last 200 events; the variable appears nowhere in our launch tooling". Make every claim, hold, and close in the shared Beads graph carry who did it.

What Changed

  • Add fm_tasks_axi_export_actor in bin/fm-tasks-axi-lib.sh, which exports BEADS_ACTOR as firstmate@<basename of FM_HOME>.<short hostname> unless already set, and call it from every firstmate-owned mutation path (fm-backlog-handoff.sh, fm-backlog-receive.sh, fm-backlog-transition-lib.sh, fm-captain-hold.sh, fm-decision-hold.sh, fm-public-followup.sh) so claims, holds, and closes record who made them.
  • bin/fm-spawn.sh now sets BEADS_ACTOR to the spawned task id (deliberately replacing any inherited value) and ships the same export through the worker's tmux pane, so the dispatch claim and every worker-driven Beads write are attributed to the worker.
  • Add tests/fm-beads-actor.test.sh driving real spawn/teardown flows against a live bd database to assert recorded actors in .beads/interactions.jsonl (dispatch claim, teardown close, and never overriding an explicit actor); fix LC_ALL=C on comm invocations in bin/fm-test-run.sh and make private state roots umask-safe in several test fixtures; document the two attribution boundaries in docs/configuration.md and the resolver in docs/scripts.md.

Risk Assessment

✅ Low: The fix round is a small, mechanical, authorized change confined to the single actor resolver with matching test and doc updates, and no other caller computes the actor formula.

Testing

Completed 1 recorded test check.

  • Outcome: ⚠️ 1 error across 1 run (22m27s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ℹ️ bin/fm-tasks-axi-lib.sh:167 - The firstmate-side actor is 'firstmate@' + basename(FM_HOME), with no host qualification. Two homes on different machines whose FM_HOME basenames collide (e.g. two clones both named 'firstmate', or secondmate homes both named 'home' in the test fixture's shape) produce identical firstmate actors in the shared Beads graph, partially recreating the collapsed-identity problem this change fixes for firstmate-owned events (worker events stay distinct because the task id is the actor). The stated intent is that every event 'carry who did it', so whether a home-unique name is sufficient is the author's call; a host- or id-qualified actor would extend the change rather than correct it, so this needs authorization rather than an auto-fix.
  • ℹ️ bin/fm-test-run.sh:693 - The LC_ALL=C 'comm' fixes are a drive-by correctness repair unrelated to the actor-identity intent: the inputs are LC_ALL=C-sorted but the original comm calls ran under the ambient locale, so the coverage-guard set comparisons could report spurious missing/extra entries under a non-C locale. The fix is mechanically correct and matches the existing sort invocations; noting the scope drift, no action needed.

🔧 Fix: Qualify firstmate Beads actor with short hostname per authorized review fix
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 error
  • 🚨 tests failed with exit code 1
  • bin/fm-test-run.sh --changed --exclude-family real-herdr-gated
✅ **Document** - passed

✅ No issues found.

🔧 **Lint** - 1 issue found → auto-fixed ✅
  • ⚠️ linter found issues (exit code 1)

🔧 Fix: Fix ShellCheck SC2015 and SC1010 in tests/fm-beads-actor.test.sh
✅ Re-checked - no issues remain.

✅ **Push** - passed

✅ No issues found.

bd attributes each backlog state change to $BEADS_ACTOR, falling back to
git identity, so a fleet sharing one Beads graph collapsed into a single
actor. Export the variable at the two boundaries that matter:

- bin/fm-spawn.sh exports the task id (the registered secondmate name
  for a secondmate) process-wide and into the worker's pane, so the
  dispatch claim and every claim, hold, or close the worker drives
  record who did it.
- Every firstmate-owned mutation records firstmate@<basename of
  FM_HOME> through fm_tasks_axi_export_actor in bin/fm-tasks-axi-lib.sh,
  called from the fm_backlog_mutate chokepoint plus the direct
  tasks-axi call sites (captain holds, handoffs, receipts, the decision
  shim, public follow-ups). An explicitly exported actor is never
  overridden.

tests/fm-beads-actor.test.sh drives a real spawn and teardown on the
beads backend and asserts the claim actor is the task id, the close
actor is firstmate@home, and the documented attribution read
(tail -100 .beads/interactions.jsonl | jq -r .actor | sort | uniq -c)
shows both actors after one spawn and one teardown.

Along the way, hardened test fixtures that created state roots under an
ambient group-writable umask the process-event privacy contract refuses
(captain-hold-lifecycle, procevent, procevent-when, remote-reply,
bearings-board-render), and pinned fm-test-run.sh's comm comparisons to
LC_ALL=C so the coverage guard works outside the C locale.
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge because no concrete changed-code failure remains.

The actor resolver preserves explicit identities, spawn consistently establishes the task identity before dispatch and pane launch, and the changed mutation boundaries apply the intended attribution without an established contract break.

Reviews (1): Last reviewed commit: "no-mistakes(lint): Fix ShellCheck SC2015..." | Re-trigger Greptile

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is with the captain for a default-behavior decision — not waiting on you.

Reviewed HEAD a49741e67f621005c89a479a450819feb03c302f vs main 8f7b79c77c21. Full diff: fm_tasks_axi_export_actor + mutation call sites, spawn pane BEADS_ACTOR=$task_id, tests/docs, LC_ALL=C comm drive-by. No .github/workflows/*. Not disguised security.

Contract-class: new-default. Unconfigured Beads attribution changes fleet-wide: unset BEADS_ACTOR becomes firstmate@<FM_HOME basename>.<short hostname>; spawn always exports the task id (overrides inherited) into the worker pane. No opt-in flag. Captain Beads gap-fill motive does not make a replaced default attribution path restore.

VISION per-rule

  • One captain, one interface — aligns (audit below deck).
  • Authority explicit — aligns for attribution-only; class still gates auto-merge.
  • Scripts own mechanics — aligns.
  • Restart non-event — aligns (durable actor on events).
  • Delegation with a spine — aligns (worker vs firstmate identity).
  • Fleet outlives vendor — aligns (bd BEADS_ACTOR semantics).
  • Scope — aligns.

Attestation: MATCH. NM PASS (33885823171). CI all green (behavior portable serial/parallel, Herdr, Lint, coverage, stock macOS, timing aggregate). mergeStateStatus CLEAN.

Merge-eligible: NO — otherwise ready except default-behavior. Flagging Firstmate for a captain new-default card. Do not merge/rebase while that card is open.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: captain word on the new-default merge card — skip is not merge and not close. Leave this open. Not waiting on the author.

HEAD still a49741e67f621005c89a479a450819feb03c302f (MERGEABLE/CLEAN). Class new-default unchanged (always-on BEADS_ACTOR + spawn exports task id into worker pane). Do not merge. Do not rebase.

Firstmate will only re-flag if the tip product surface changes or this becomes otherwise-ready again and needs a fresh captain card.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: declined / closed by captain decision. Not waiting on the author. Do not merge.

HEAD a49741e67f621005c89a479a450819feb03c302f. Contract-class was new-default (always-on BEADS_ACTOR + spawn exports task id into the worker pane). Captain declined: firstmate does not currently support beads; task tracking is via tasks-axi. Introducing another task-tracking mechanism would likely conflict.

VISION.md per-rule (close-as-decided)

  • One captain, one interface — aligns that we refuse a second silent tracking path below deck.
  • Authority is explicit and never inferred — aligns (captain declined the always-on actor export).
  • Scripts own the mechanics, agents own the judgment — cannot tell on beads plumbing; moot after decline.
  • A restart is a non-event — cannot tell; moot.
  • Delegation with a spine — does not align as shipped (new always-on task-tracking surface beside tasks-axi).
  • The fleet outlives any vendor — does not align if beads becomes an unconfigured second tracker.
  • Scope — does not align: command layer should not grow a parallel task-tracking mechanism beside the configured path.

Thank you @RooseveltAdvisors for the careful work — a later PR that stays on tasks-axi (or an explicit opt-in the captain grants) can be considered on its own.

@kunchenguid kunchenguid closed this Sep 4, 2026
RooseveltAdvisors added a commit to RooseveltAdvisors/firstmate that referenced this pull request Sep 27, 2026
…henguid#3712)

Upstream: kunchenguid#3712
State: closed-unmerged
Slug: beads-actor-identity

Upstream PR kunchenguid#3712 (closed, unmerged). BEADS_ACTOR export on firstmate
mutations + beads-actor suite. Spawn/captain-hold actor wiring ships with

House tracking: one commit ↔ one upstream PR. When this PR merges to
origin/main, drop this commit from house main (rebase onto new origin/main
or reset residue without this feature).
RooseveltAdvisors added a commit to RooseveltAdvisors/firstmate that referenced this pull request Sep 27, 2026
…id#4225)

Upstream: kunchenguid#4225
State: open
Slug: stale-sweep-capacity

Upstream PR kunchenguid#4225 (open); supersedes closed kunchenguid#3720. Also sibling kunchenguid#4224.
Includes bin/fm-spawn.sh and bin/fm-captain-hold.sh full house delta
(capacity + kunchenguid#3712 actor bits + kunchenguid#3458 label bits) and bin/fm-teardown.sh
full house delta (capacity release + kunchenguid#3657 retire-secondmate authority),
because those files are not cleanly separable at tip.

House tracking: one commit ↔ one upstream PR. When this PR merges to
origin/main, drop this commit from house main (rebase onto new origin/main
or reset residue without this feature).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants