Repository navigation
fix: require explicit authority for Firstmate upstream contributions - #7172
Conversation
… 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.
Rollout: one-time maintainer opt-in before mergeThis change defaults every Firstmate home to user/operator with no authority to publish to this repository's upstream. The two homes that develop Firstmate need a one-time opt-in so they can keep dispatching Firstmate work after merge. Ordering: write the opt-in first, then merge. Main home:
|
|
Pushed me over edge with all this shit!
…On Tue, 13 Oct 2026 at 19:32, Kun Chen ***@***.***> wrote:
Merged #7172 <#7172> into
main.
—
Reply to this email directly, view it on GitHub
<#7172?email_source=notifications&email_token=CRQVOK5OMT7V4IIBWHLITR35TZYMTA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTGMZRGYYTCNZWGU2DFJTSMVQXG33OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#event-33161176542>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/CRQVOK3QB2GVQ665LICCX735TZYMTAVCNFSNUABGKJSXA33TNF2G64TZHMYTENRWHA4DIMZRG45US43TOVSTWNJYGE4TSNRRHA3TRILWAI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
…, relaunch races) (#10) * 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 (cherry picked from commit 6407052) * 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 (cherry picked from commit 7df545b) * 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 (cherry picked from commit 8c9c67d) * 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. (cherry picked from commit 2911a3b) --------- Co-authored-by: Pedro Guimarães <[email protected]> Co-authored-by: Kun Chen <[email protected]> Co-authored-by: Ian Brown <[email protected]> Co-authored-by: Stephen Haptonstahl <[email protected]>
Intent
The original ask: "my firstmate repo has a problem - i think a lot of users simply clone my repo and start using it. this setup flow is great and i don't want to change it. but many users reported that when their firstmate runs into a bug, the agent would automatically start raising PRs against my repo... that's unexpectd. i think the root cause is that there's no distinction between me (maintainer of the firstmate repo) and a regular user (who just wants to use it). get an astra crewmate to look into this and see what's a good way to fix"
After reading the investigation's options, the decision was: "ship B".
Context - Option B from the investigation report: every Firstmate home defaults to user/operator, with no upstream publication of Firstmate itself; when a user's firstmate hits a Firstmate bug it does private diagnosis, a local workaround, a local issue draft, or a proposed patch only, and never pushes, forks, files an issue, comments, or opens a PR on its own. The maintainer opts in through an explicit gitignored, home-local setting scoped to a named repository. A user can separately consent to one specific contribution for one task without becoming a maintainer. Role is never inferred from gh identity, permissions, origin, environment, or CI. The clone-and-run setup flow stays unchanged, and ordinary delivery of users' own projects stays unchanged.
What Changed
Risk Assessment
✅ Low: The shared publication gate and reviewed fixes are bounded and consistent with the recorded decisions, with no additional substantiated defects found.
Testing
The focused regression test, live CLI boundaries, generated consent and promotion contracts, and a real Claude policy response passed. Fixture placeholders and an overlong tmux socket path were corrected before re-driving the affected checks. All disposable state was removed; no publication or pipeline was executed. This was a CLI/policy change, so terminal transcripts—not screenshots—provide evidence.
Evidence: Live CLI scenarios and observable refusals
Source: Live CLI scenarios and observable refusals
Evidence: Real Claude primary's default-policy response
Source: Real Claude primary's default-policy response
Evidence: Generated one-task consent brief
Source: Generated one-task consent brief
Evidence: Persisted promoted task and bounded consent
Source: Persisted promoted task and bounded consent
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed (2) ✅
bin/fm-role-lib.sh:308- The parser returns after the first directive, so its multiple-directive rejection is unreachable. A file containingmaintainer github.com/kunchenguid/firstmatefollowed byuserstill grants publication authority instead of resolving malformed input to user. Consume and validate the entire file before accepting the role. This must hold for both inherited parsing at bin/fm-role-lib.sh:420 and local parsing at :436, which feed the brief, spawn, and promotion gates.bin/fm-role-lib.sh:170- Remote normalization removes.gitbefore the trailing slash. Consequently, an ordinary second clone usinghttps://github.com/kunchenguid/firstmate.git/normalizes differently from a code root using the same URL without the trailing slash. Their common directories also differ, so self-repository detection returns false and the publishing gate returns 2 without checking authority. Remove trailing slashes before the suffix in both URL representations: bin/fm-role-lib.sh:170-171 and :191-192. The resulting identity must agree across the consumers at bin/fm-brief.sh:365, bin/fm-spawn.sh:3390, and bin/fm-promote.sh:232.bin/fm-config-inherit-lib.sh:88- Simplification: automatic role inheritance and its receipt machinery extend the requested home-local opt-in to other homes; no stated requirement needs that component. It also creates a concrete elevation path: a symlinked primary firstmate-role resolves to user at bin/fm-role-lib.sh:250, but local propagation follows that symlink through the generic copy path at bin/fm-config-inherit-lib.sh:728-737, then certifies the ordinary destination file at :245. The secondmate accepts that grant at bin/fm-role-lib.sh:420 and can launch publishing work despite the primary's rejected setting. The smallest honest remedy is removing role inheritance and its receipt mechanism, leaving explicit per-home opt-in; retaining cross-home grants needs authorization. Related surfaces are bin/fm-role-lib.sh:407-431, .agents/skills/firstmate-self-repo/SKILL.md:73-75, .agents/skills/secondmate-provisioning/SKILL.md:121, and docs/configuration.md:597.bin/fm-role-lib.sh:280- Simplification: the multi-scope maintainer directive adds standing authority for several repositories, whereas the intent requires an explicit home-local setting 'scoped to a named repository.' No requirement needs the additional scopes. Prefer exactlymaintainer <scope>and remove the multi-scope acceptance and matching paths at bin/fm-role-lib.sh:280-301 and :492-499, together with their plural schema descriptions in docs/configuration.md:586 and .agents/skills/firstmate-self-repo/SKILL.md:40.🔧 Fix applied.
6 issues (4 errors, 2 warnings) still open:
bin/fm-role-lib.sh:308- The parser returns after the first directive, so its multiple-directive rejection is unreachable. A file containingmaintainer github.com/kunchenguid/firstmatefollowed byuserstill grants publication authority instead of resolving malformed input to user. Consume and validate the entire file before accepting the role. This must hold for both inherited parsing at bin/fm-role-lib.sh:420 and local parsing at :436, which feed the brief, spawn, and promotion gates.bin/fm-role-lib.sh:170- Remote normalization removes.gitbefore the trailing slash. Consequently, an ordinary second clone usinghttps://github.com/kunchenguid/firstmate.git/normalizes differently from a code root using the same URL without the trailing slash. Their common directories also differ, so self-repository detection returns false and the publishing gate returns 2 without checking authority. Remove trailing slashes before the suffix in both URL representations: bin/fm-role-lib.sh:170-171 and :191-192. The resulting identity must agree across the consumers at bin/fm-brief.sh:365, bin/fm-spawn.sh:3390, and bin/fm-promote.sh:232.bin/fm-role-lib.sh:280- Simplification: the multi-scope maintainer directive adds standing authority for several repositories, whereas the intent requires an explicit home-local setting 'scoped to a named repository.' No requirement needs the additional scopes. Prefer exactlymaintainer <scope>and remove the multi-scope acceptance and matching paths at bin/fm-role-lib.sh:280-301 and :492-499, together with their plural schema descriptions in docs/configuration.md:586 and .agents/skills/firstmate-self-repo/SKILL.md:40.bin/fm-role-lib.sh:244- Self-repository detection loses the boundary across fork/parent checkouts. For example, run Firstmate from a fork whose origin names the fork, then dispatch a task against a separate clone of kunchenguid/firstmate. Their common directories and selected publication targets differ, so[ "$ta" = "$tb" ]fails and the gate returns 2 without checking consent. Brief, spawn, and promotion all accept that result, permitting upstream publication contrary to the required default of "no upstream publication of Firstmate itself" and the documented fork-maintainer requirement to use per-task consent. Fix repository recognition at this shared boundary without equating repository identity with its single selected publication target. Related sites: bin/fm-role-lib.sh:474-475 (bypass), bin/fm-brief.sh:367 (accepts 2), bin/fm-spawn.sh:3392 (accepts 2), bin/fm-promote.sh:234 (accepts 2), docs/configuration.md:589 (fork contribution policy).bin/fm-role-lib.sh:387- The inheritance receipt verifies consistency, not parent provenance. A secondmate can writemaintainer github.com/kunchenguid/firstmateand a four-line receipt containing any numeric generation, its byte count, its SHA-256, andput; resolution accepts this as inherited and the publishing gate authorizes it even when the parent resolves to user. The accepted test already constructs a self-written receipt at tests/fm-self-repo-role.test.sh:293-305, but uses an unrelated scope, masking the publication bypass. Round 1 fixed rejected-primary propagation, but left this distinct self-grant path intact. Related sites: bin/fm-role-lib.sh:407-420 (trusts receipt), :505-508 (grants publication), bin/fm-config-inherit-lib.sh:287-334 (locally writable receipt), bin/fm-remote-inherit-push.sh:86 (same receipt contract remotely), .agents/skills/firstmate-self-repo/SKILL.md:74 (claims children cannot self-grant). Parent-authenticated provenance needs an authorized trust-boundary change beyond the accepted checksum machinery; the remedy, rather than the demonstrated defect, requires human approval.bin/fm-role-lib.sh:491- Simplification: the unknown-publication-target consent fallback is not required by the intent. It authorizes a publishing contract when no target can be compared with the approved repository, and the consent token does not configure or constrain the worker's eventual publication destination. Remove the authorization fallback at bin/fm-role-lib.sh:491-494 and retain refusal until the publication target is determinable; matching consent for a known target already satisfies the one-task contribution requirement.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
TMPDIR="$PWD/.test-tmp" bash tests/fm-self-repo-role.test.shbash .test-tmp/drive-role.sh: real role, brief, spawn-refusal, promotion, and inheritance interfaces against disposable homes and Git repositories.bash .test-tmp/claude-live.sh: real Claude primary on a private, sized tmux session; captured its default-policy response and tore down the lab.git status --short: confirmed cleanup left no worktree changes.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.