Repository navigation
feat(bin): add Prime Agent crewmate/scout adapter - #4470
Open
eduardstan wants to merge 33 commits into
Open
eduardstan wants to merge 33 commits into
eduardstan wants to merge 33 commits into
Conversation
eduardstan
force-pushed
the
fm/fm-upstream-prime-one-pr
branch
from
September 15, 2026 00:49
7a03fc6 to
a539625
Compare
…gent harness tasks
…unch, not just carry it
…e for identity-less backends
eduardstan
force-pushed
the
fm/fm-upstream-prime-one-pr
branch
from
September 15, 2026 06:30
cb1229d to
0eb074e
Compare
…d stop cleanup dropping accents from a held body (kunchenguid#4471) * fix(bin): let captain holds work on hosts with an older JSON::PP Holding a task for the captain, and the cleanup that keeps a captain-held row open, both fail outright on any host whose JSON::PP defaults allow_nonref off - 2.27202 on a Linux desk is one. Both read a task's body back with `decode_json`, but tasks-axi shows a scalar field as a JSON-encoded bare string, and an older library rejects that whole value with "must be object or array". The consequence is fleet-wide on such a host, not one broken command: a worker there cannot formally record a decision for the captain at all. It can only mention the decision in passing in a status line, where it can be missed - which is how a real decision goes unrecorded. The hold reports that the task lost its hold-set stamp; the cleanup cannot return the row to Queued. Both call sites now ask for allow_nonref explicitly rather than inheriting whatever the installed library defaults to. The second one is worth naming: its `/\A"/` guard reads as deliberate, but a leading quote is exactly the bare-string case that fails, so the guard selects for the failing input rather than protecting against it. The regression case forces the older default back off for every perl the commands spawn, then drives both paths - holding a task that carries a body, and tearing down a captain-held row whose deliverable must still be appended. It also probes that the simulation genuinely rejects a bare scalar, so the case cannot pass vacuously on a lenient host. Each half was verified failing on its own unfixed call site with that site's real error message. Suites: fm-captain-hold-lifecycle 51 cases, fm-backlog-atomicity 99 cases, 0 failures. Verification limit: the mechanism is reproduced and tested, but neither fix is verified against a real JSON::PP 2.27202 host, because none is in the loop. This laptop runs 4.06, where the bug does not manifest. `bin/fm-procevent-lavish.sh:471` was checked and left alone - it matches a brace-delimited object before decoding, so allow_nonref never applies. * fix(bin): stop cleanup silently dropping accented characters from a held body Cleanup rewrites a captain-held row's body to append the finished work's deliverable, and the decoder it reads that body with printed decoded characters to a stream with no `:raw` layer. A character at or below U+00FF then came out as one latin-1 byte instead of two UTF-8 ones, so a body reading "café" lost the accent. `fm_backlog_retain` writes that body straight back through `--body-file`, and nothing reported an error - the character was simply gone from a row still waiting on the captain. The decoder now writes bytes, the same `binmode STDOUT, ":raw"` plus `utf8::encode` that the sibling decoder in `bin/fm-captain-hold.sh` already used. Review of the parent commit found this on one of the lines that commit already changed. It predates that change. The test asserts bytes rather than decoded strings, because comparing strings cannot tell latin-1 from UTF-8. It uses two separate rows on purpose: any character above U+00FF makes perl print the whole string as UTF-8, so one body carrying both an accent and an em dash passes even unfixed and proves nothing. Verified failing before the fix on the accented row, passing after. Suites: fm-captain-hold-lifecycle 52 cases, fm-backlog-atomicity 99 cases, 0 failures. * no-mistakes(document): record body-decode regression proofs in captain-hold lifecycle doc * no-mistakes(review): drop whole-file UTF-8 check from retained-body test * no-mistakes(review): correct stale JSON::PP fleet-host claim in lifecycle doc * no-mistakes(review): anchor native-reproduction claims per defect in lifecycle doc
…furniture (kunchenguid#4532) * fix(composer): read codex 0.154's idle starfield and status footer as furniture codex-cli 0.154.0 animates a braille "starfield" around its idle composer: on the row above the bold `›` prompt row, on the `›` row behind the SGR-2 dim `Ask Codex to do anything` placeholder, and on the row below it, then draws a bright status footer (`<model> <effort>[ fast] · <path> · <title>`). The cells are truecolor greys on both sides of the ghost luminance ceiling, so the brighter ones survive ghost stripping, and the rows below the glyph carry no structural edge. The shared classifier selected the bare `›` shape, extended its wrap region over the two rows beneath the glyph, read the survivors and the footer as wrapped typed input, and answered `pending`; the steering doorbell defers on exactly that verdict, so no doorbell ever reached an idle codex 0.154 pane. bin/fm-composer-lib.sh now recognises that furniture by shape, declared once next to the idle placeholders and reached from the two wrap-region boundary points: - a row whose non-whitespace content is entirely braille cells (U+2800..U+28FF, detected byte-exactly under LC_ALL=C) is furniture: it never counts as wrapped typed content and bounds a bare composer's wrap region; braille behind the glyph row's content is stripped before the emptiness decision when nothing else follows the glyph; a row mixing braille with other text stays typed content; - the codex status footer bounds the wrap region exactly as omp's status row does, anchored on the effort token, a spaced middle dot, and a `~` or `/` path cell, so a typed `fix · tests` stays composer input; - `^Ask Codex to do anything$` joins the verified idle-placeholder set; the ghost strip remains what proves that row empty, and the bare-row rule that bright placeholder text is real input is unchanged. Unchanged: the strict blank-row rule, the styled=0 degradation (a plain cmux/orca capture of this screen still reads `unknown`, never `pending`), FM_COMPOSER_GHOST_LUMA_MAX, and every other harness's shape. tests/fm-composer-lib.test.sh carries both live Herdr samples byte-for-byte with the divergence (letters in place of the starfield read `pending`) and the over-stripping negatives; tests/fm-composer-codex-idle-live-e2e.test.sh is the default-on live guard (token-free, skips explicitly without codex or tmux) that launches the installed codex idle and asserts `empty` through both the tmux and the cursorless styled reads, naming codex --version on failure. docs/verification/runtime-backends.md records the dated Herdr evidence: `pending` before, `empty` after, on the captured screen. * no-mistakes(review): drop unreachable codex footer rule and inert placeholder entry --------- Co-authored-by: Todd Billings <todd@usdvcapital.com>
* fix(bin): refuse empty text steers in fm-send A marked secondmate request sent with an empty message delivered only marker and correlation bytes and minted a pending-reply expectation the parent could never see resolved, stalling the fleet with no loud error (kunchenguid#4255). Fail closed on an empty or whitespace-only message on the text path, mirroring the existing --resolve-key refusal. * chore: retain ambient Pi-lens autoformat as its own commit Formatting-only edits produced by ambient Pi-lens autoformat during the msg-loss investigation, kept separate from the behavioural change in c23acba6 so the fix stays reviewable on its own. AGENTS.md is deliberately excluded: its only autoformat edit stripped the trailing space from the documented FM_OPERATIONAL_PREFIX value, which bin/fm-operational-input.sh:28 defines as "FIRSTMATE_OP: " and line 11 records as permanent compatibility. Documenting that constant without its trailing space makes the doc wrong about the contract, so that one line was restored rather than retained.
…chenguid#4554) On rose-pine-moon the two-color water (cyan crests over blue troughs) read as a pink stripe over aqua, the yellow left sail and mast clashed with the red right sail, and the hull carried a blue interior run. Every water cell is now blue so the swell reads through glyph height alone, and both sail halves, the mast, and the whole hull are one yellow run. Geometry, cadence, animation, direction flip, resize clamping, and the narrow fallback are unchanged. Update the unit and real-TUI color assertions to the new palette and the Calm docs that described the old one.
…chenguid#4270) * fix(watch): stop aging a second mate's active turn from its launch The parent watcher's second-mate wake-loop stall check exempts a mate that is demonstrably inside an active turn, but secondmate_in_active_turn asked busy_turn_over_age first and returned "not in a turn" whenever that said the bound was crossed. busy_turn_over_age ages from state/<task>.turn-ended, falling back to state/<task>.meta. A second mate's turns end in its own home, so the parent never gets a turn-ended mark for it and the fallback ages the mate's last launch. Every mate launched more than BUSY_TURN_MAX_SECS ago was therefore permanently "over age", the busy pane was never consulted, and any turn outstripping FM_SECONDMATE_WAKE_STALL_SECS raised a false wake-loop stall. The gate now bounds the busy exemption by <idle> - how long the queue's drain position has not moved - which is evidence this home actually holds. A busy mate stays exempt while the queue has been frozen for less than BUSY_TURN_MAX_SECS, and a mate stuck busy forever still alarms, so the bound that stops a busy pane from proving liveness forever is kept rather than removed. busy_turn_over_age is untouched; its remaining callers are the ordinary crew busy-pane bound. The regression pins the case that actually broke: a mate whose launch record predates BUSY_TURN_MAX_SECS and which is demonstrably mid-turn must not escalate, while the same mate with its queue frozen past the bound still publishes exactly one notification. The existing coverage only exercised a freshly launched mate, which passes either way. Reaching that alert now costs a pane capture inside the gate, so the three checkpoints in this suite that assert an alert move from a 1s to a 4s bound - the value the neighbouring active-turn cases already use. The bound is a ceiling, not a wait: the checkpoint returns on the first actionable wake. On a loaded machine a 1s bound missed the alert repeatedly; at 4s it did not miss in 20 runs under the same load. * no-mistakes(review): scope the second-mate active-turn regression test's coverage claim * no-mistakes(document): fix stale second-mate active-turn comments in fm-watch
…unchenguid#4278) * feat(bin): add read-only PR blocker and reviewer-discovery commands Two focused, opt-in commands that read GitHub and never write to it. fm-pr-state.sh reports what still blocks one pull request from the author's side: a closed or merged state, draft state, unknown or conflicting mergeability, absent or failing required checks, and a blocking CHANGES_REQUESTED decision explained by each reviewer's latest verdict, marked STALE when it was left at a superseded head. A pull request that only awaits an approval is not reported as blocked, and advisory checks are omitted. Every reading is taken against one exact head; a push that lands mid-read invalidates the whole result rather than mixing two snapshots. fm-pr-reviewers.sh suggests reviewers from the most recent commits to the pull request's exact changed paths, counting each commit once, resolving handles through GitHub's own commit author.login mapping, and excluding the author and Bot accounts. Both stay read-only: no review request, no approval, no merge. Unresolved review-thread state is left unreported because the REST API does not expose it and unattended commands may not use GraphQL. Closes kunchenguid#3731 * no-mistakes(review): accept only PR URLs and stop at terminal state * no-mistakes(review): report unconfirmed required checks; make URL-only guards discriminate * no-mistakes(review): stop attributing readings to unverified heads * no-mistakes(review): narrow readiness contract to checks that have reported * no-mistakes(review): read the pull request once, drop the head guard * no-mistakes(document): scope pr-forge isolation proof to its measured members * no-mistakes(document): record uncovered pr-forge members and their pending proof * docs(isolation-proof): re-prove pr-forge at its full membership tests/fm-pr-state.test.sh and tests/fm-pr-reviewers.test.sh joined the pr-forge family in this branch, and script_allows_concurrency grants four workers by family membership alone, so both ran concurrently on a proof measured before they existed. Re-proved the family at all eight members: two consecutive runs, 0 failures, each begun with the one-minute load average below 6.0 so the result measures isolation rather than contention. A third run taken between them is disclosed rather than recorded, because it started while the previous run's workers were still decaying. The new durations are not comparable with the six-member measurement above them, so they are not presented as evidence about the two new members, and that record's 1.72x four-worker figure is left as a statement about its own run rather than restated as current. * no-mistakes(review): disclose gh error-text coupling at its matching site and tests
…uid#2752) * fix(bin): teach validation-round pauses in briefs * no-mistakes(document): Point classifier comments to authoritative pause examples
…gent harness tasks
…unch, not just carry it
…e for identity-less backends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
The owner's words (2026-09-14): "So wouldn't it be better to have just one PR as other harnesses did? I'm tired of spinning around. I want to land this integration. Everyone should benefit from it. I'd probably do a mix B+C. We have precedents for having just one PR. We can point to those in our new issue/PR. Fix our prime-agent first, before sending anything to upstream... The idea to integrate prime-agent is mine, at least I was the first one to mention it in the upstream firstmate." Tonight, after the fork fix merged: "Ok, proceed with upstream + validation." The no-mistakes pipeline is explicitly permitted for this task, and only for this task. The fork fix is merged as eduardstan#13 (fork main 1ed9e6c), after three independent adversarial review rounds. It makes Prime Agent 0.9.4 a verified crewmate and scout adapter with semantic busy state bound to its own session, provider-qualified quota mapping that refuses non-Codex routes, Prime Agent secondmates refused, and a live verification record at docs/verification/prime-agent.md. The owner's three older upstream PRs, #2062, #2070, and #2075, sliced the same integration. The maintainer ruled the adapter direction aligned and opt-in on upstream issue 3953. The merged omp, rovo, agy, and gemini adapters each landed as one bundled PR with a docs/verification record. Deliver one solid pull request against kunchenguid/firstmate that lands the Prime Agent crewmate/scout adapter as it stands in the fork, rebuilt on current upstream main, validated through no-mistakes, with a description that points to the single-PR precedents, issue 3953, and the older PRs it supersedes, and that briefly notes the integration was first proposed by the owner with a link to his earliest upstream mention if found. Keep it polite and factual. Do not open a new issue because issue 3953 carries the design discussion.
What Changed
bin/fm-prime-agent-lib.sh, a Prime Agent 0.9.4 crewmate/scout backend adapter with busy-state detection bound to its own session, provider-qualified quota mapping that refuses non-Codex routes, and rejection of Prime Agent secondmates.bin/fm-spawn.sh,bin/fm-harness.sh,bin/fm-bootstrap.sh,bin/fm-brief.sh,bin/fm-composer-lib.sh,bin/fm-control.sh,bin/fm-control-lib.sh,bin/fm-quota-choose.sh,bin/fm-busy-lib.sh,bin/fm-session-lock-lib.sh,bin/fm-teardown.sh,bin/fm-agent-process-lib.sh,bin/fm-test-run.sh, andbin/backends/herdr.sh..agents/skills/harness-adapters/references/harness/prime-agent.md,docs/verification/prime-agent.md, plus updates todocs/agent-control.md,docs/architecture.md,docs/configuration.md,docs/documentation-audiences.json,docs/trace-context.md,docs/verification/runtime-backends.md,AGENTS.md, and the harness-adapters, quota-array-dispatch, and stuck-crewmate-recovery skills.tests/fm-prime-agent-harness.test.sh,tests/fm-prime-agent-signals-live-e2e.test.sh,tests/fm-backend-herdr.test.sh) and extend existing suites (fm-busy-adapter-wiring,fm-control-relaunch,fm-control,fm-gotmp,fm-quota-choose,fm-spawn-dispatch-profile,fm-tmux-agent-liveness,tests/lib.sh) to cover the new backend.Risk Assessment
✅ Low: Branch already passed many adversarial review/test/document rounds; the newest reconciliation commits were traced line-by-line and introduce no new defects, and independent spot-checks of the core new logic hold up under concrete-input tracing.
Testing
Per the standing user instruction to rerun the six named deterministic suites in the foreground and then the opt-in live e2e in its named lab, all seven ran to completion with zero failures: prime-agent harness detection/lifecycle (4 ok), busy-adapter wiring across harnesses including prime-agent (13 ok), quota selection including prime-agent's openai-codex mapping (50 ok), spawn dispatch profile flags for prime-agent crewmate/scout (60 ok), Herdr backend classification/composer/busy/workspace (53.6s, no failures — the "Terminated"/"Killed" lines are expected inside the SIGHUP-escalation test itself), and control/relaunch lifecycle including harness switches (1m36s, 59 ok). The live e2e drove the real installed Prime Agent 0.9.4 binary inside an isolated Herdr lab session (never the shared default session) through boot, busy/idle signaling, cancel, clean exit, and relaunch, confirming worker retirement — all 7 checks passed. Working tree left clean; the live test's own trap tore down its lab and temp directory.
./tests/fm-prime-agent-harness.test.sh— 4 ok, exit 0./tests/fm-busy-adapter-wiring.test.sh— 13 ok including prime-agent session binding/retry/debounce, exit 0./tests/fm-quota-choose.test.sh— 50 ok including 'prime-agent quota requires its verified openai-codex provider', exit 0./tests/fm-spawn-dispatch-profile.test.sh— 60 ok including prime-agent launch marker and secondmate refusal, exit 0./tests/fm-backend-herdr.test.sh— all ok in 53.6s, exit 0./tests/fm-control-relaunch.test.sh— 59 ok in 1m36s, exit 0FM_PRIME_AGENT_LIVE_E2E=1 ./tests/fm-prime-agent-signals-live-e2e.test.sh— 7 ok driving real installed Prime Agent 0.9.4 through boot/busy/cancel/exit/relaunch/retirement in an isolated Herdr lab,…Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
./tests/fm-prime-agent-harness.test.sh— 4 ok, exit 0./tests/fm-busy-adapter-wiring.test.sh— 13 ok including prime-agent session binding/retry/debounce, exit 0./tests/fm-quota-choose.test.sh— 50 ok including 'prime-agent quota requires its verified openai-codex provider', exit 0./tests/fm-spawn-dispatch-profile.test.sh— 60 ok including prime-agent launch marker and secondmate refusal, exit 0./tests/fm-backend-herdr.test.sh— all ok in 53.6s, exit 0./tests/fm-control-relaunch.test.sh— 59 ok in 1m36s, exit 0FM_PRIME_AGENT_LIVE_E2E=1 ./tests/fm-prime-agent-signals-live-e2e.test.sh— 7 ok driving real installed Prime Agent 0.9.4 through boot/busy/cancel/exit/relaunch/retirement in an isolated Herdr lab,…./tests/fm-prime-agent-harness.test.sh./tests/fm-busy-adapter-wiring.test.sh./tests/fm-quota-choose.test.sh./tests/fm-spawn-dispatch-profile.test.sh./tests/fm-backend-herdr.test.sh./tests/fm-control-relaunch.test.shFM_PRIME_AGENT_LIVE_E2E=1 ./tests/fm-prime-agent-signals-live-e2e.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.