Skip to content

feat(pi): accept native Codex ultra effort with progress-aware supervision - #4038

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
3264studios:fm/fm-native-codex-ultra-effort
Sep 9, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
3264studios:fm/fm-native-codex-ultra-effort

Conversation

@3264studios

@3264studios 3264studios commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Firstmate documents worker effort as a concrete harness axis, but the shared enum rejects native Codex ultra before Pi can launch it.
Native activity inside a long Pi turn also fails to refresh the watcher age bound, and native tool execution cannot discover Firstmate's guarded controls.

Accept ultra only for explicit codex-native/<model> selections on Pi or Pi-signed and emit --codex-effort ultra, never --thinking ultra or max.
Preserve that effort through batch dispatch, guarded relaunch, and local or remote secondmate restart; refuse unsupported and raw launches before lifecycle changes.
Refresh a generation-bound progress marker independently of semantic busy state and turn completion, so observable native activity prevents false wedge escalation while stale incarnations remain unable to refresh their replacements.
Expose the registered Firstmate tools and operational-message types through firstmate:native-tools, retaining the original execute callbacks and ownership checks without exposing Pi built-ins.

When the primary itself runs native Codex, its background supervision branch remains an independent ordinary Pi agent.
It follows the same model through openai-codex, never inherits the main native thread, refuses a codex-native branch pin, and returns the wake to main if the ordinary model is unavailable.
The branch builder and /supervision-model picker share one resolution rule, so the picker reports the model that will run or the exact refusal.

Reproduction and validation

On upstream base b84e0e362face25f3dd8945297a3df1320d7668c, the native Ultra spawn fails with --effort must be one of low, medium, high, xhigh, max.
Running the expanded dispatch test with the base bin/ also fails its new Ultra cases.
On this branch, the expanded suite passes: native Pi and Pi-signed launches emit --codex-effort ultra, metadata retains effort=ultra, and invalid profiles and raw launches are refused.

Targeted spawn, relaunch, restart, bootstrap, busy-state, adapter, watcher, and Pi extension tests pass.
Shell syntax, canonical ShellCheck, workflow lint, strict Pi typechecking, and documentation checks pass.
The default-on native guard passes against installed Pi 0.85.1 and pi-codex-native 0.2.1, including initial, operational, and resumed Ultra turns; observable adapter progress; guarded tool execution; and durable outcome acknowledgement with duplicate refusal.
Its App Server peer and watcher-close process are deterministic fixtures; it does not test a live model or real backend.

The broad portable run completed 151 scripts with six capability skips and the pre-existing macOS fixture failure disclosed below.
A separate live-harness run completed 26 scripts with zero failures and 24 capability or opt-in skips; real Herdr lifecycle checks were not exercised.

The responsiveness guard now copies fm-native-contract.ts into its isolated Pi fixture.
The missing dependency caused Pi to reject the extension; the corrected fixture loads successfully, and its serial CI job passes.

Baseline disclosures

The unchanged turn-end fixture in tests/fm-turnend-guard.test.sh fails under BSD touch on macOS because GNU-style touch -d @<epoch> is rejected, leaving the stale-beacon fixture fresh.
The complete suite passes with GNU touch selected through an isolated PATH.
The test and guard sources match upstream, and this branch does not change that fixture or fix its portability issue.

The opt-in Pi branch SDK guard also fails identically on upstream main and this branch against Pi 0.85.1: its unpinned session-restore assertion observes gpt-5.5 instead of fixture model fm-live-a.
This branch does not change or fix that pre-existing failure.
Neither baseline failure is reported as a pass.

Upstream reconciliation

The busy-age documentation overlapped newer upstream pause and foreign-queue stall guidance.
The reconciliation preserves upstream pause behavior and the 180-second no-progress foreign-stall bound while adding native progress to the busy-age description.

Updates from git push no-mistakes

@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

…d by this PR. The shard ran the default-on live guard tests/fm-pi-branch-responsiveness-live-e2e.test.sh, whose idle arm loads .pi/extensions/fm-branch-supervision.ts into a scratch project with a fixed list of copied libs. This PR added `import { registerFirstmateTool } from "./lib/fm-native-contract.ts"` to that extension and updated every other loading fixture's copy list, but missed this guard. Pi 0.85.1 therefore refused to load the extension ("Cannot find module './lib/fm-native-contract.ts'"), never drew its TUI, the test failed with "Pi 0.85.1 never drew its TUI in the idle arm", and the job hit its 20-minute cap. Fix (one line): added fm-native-contract to the lib copy loop in tests/fm-pi-branch-responsiveness-live-e2e.test.sh. Swept all other suites referencing fm-branch-supervision.ts / fm-primary-pi-watch.ts; the remaining ones without the new lib only hash, path-reference, or string-match the files and do not load them into Pi, so no further fixture changes are needed. Verification: reproduced the mechanism against the installed Pi 0.85.1 by building the lab copy with the old lib list (load error as above) and the fixed list (loads cleanly). tmux is not installed on this machine, so the live guard itself gate-skips locally ("skip: live: tmux absent") and could not be run end to end here; CI (which has tmux and Pi) will exercise it. shellcheck is clean on the edited file
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Triage: HEAD 97205f8ee87282ef246af6492c3b3fcde507eef4. Attestation MATCH (Updates from git push no-mistakes + head_sha). Tip Require no-mistakes SUCCESS; full CI green; Greptile SUCCESS. MERGEABLE/CLEAN. No .github/workflows/* delta. Inspected fm-spawn.sh / fm-harness.sh validate-native-effort / fm-busy-event.sh progress / fm-native-contract.ts / watch wiring vs main b84e0e36 (pre-#4037 merge tip).

Classing evidence:

  1. ultra is refused unless harness is pi/pi-signed with explicit codex-native/<model> (validate-native-effort); emits --codex-effort ultra, never --thinking ultra.
  2. Generation-bound .progress refresh is for observed native-harness activity; absent a progress file, ordinary busy-age is unchanged.
  3. firstmate:native-tools only re-exports already-registered Firstmate controls to native adapters that opt into the discovery event.

VISION (per rule):

  • One captain, one interface: aligns. False wedge escalation during long native turns is noise; ultra stays a profile axis.
  • Authority is explicit: aligns. Ultra and native-tool discovery stay behind explicit native selection; no ambient consent.
  • Scripts own the mechanics: aligns. Effort validation, progress touch, and watch age math are scripts.
  • A restart is a non-event: aligns. Gen-bound progress cannot refresh a replacement incarnation.
  • Delegation with a spine: aligns. Existing harness/effort primitives; not a new task shape.
  • The fleet outlives any vendor: aligns. Binds to Codex native effort semantics firstmate already documents, not UI pixels.
  • Scope: aligns. Adapter/command-layer; forge unchanged.

contract-class: opt-in. New unconfigured default path does not select ultra; progress/native-tools activate only for native Codex paths.

Security: no tip beyond ordinary adapter surface. Auto-merge now.

@kunchenguid
kunchenguid merged commit 746fc0a into kunchenguid:main Sep 9, 2026
16 of 17 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

babbarc added a commit to babbarc/firstmate that referenced this pull request Sep 10, 2026
* fix(bin): refuse test runs in the primary checkout when a task marker is set (#3891)

* fix(bin): refuse the behavior suite in the repository primary checkout

A task worker's isolated worktree placement is verified exactly once, when
its task starts, and nothing re-checks it afterwards. A worker that later
changes directory into the repository's primary checkout runs its Git
commands, and this branch-switching suite, against the one checkout every
linked worktree resolves against and every landing merges into. A run that
dies mid-suite can leave that checkout on a stray branch.

bin/fm-test-run.sh now refuses that case. When FM_TASK_ID marks a task
worker and the runner resolves to the primary checkout, every executing mode
exits non-zero before selecting a suite, with one line naming the primary
path and pointing at the assigned task worktree. The predicate is the one
bin/fm-spawn.sh already uses for launch placement: the working tree's own
git dir is the repository's common git dir, which separates the primary from
every linked worktree even when their top levels differ. A run with no
FM_TASK_ID set is unchanged, and so are the inspection modes, which execute
nothing. When git resolves neither directory - a non-repository fixture, a
detached copy - nothing proves this is the primary, so the run proceeds.

bin/fm-spawn.sh sets the marker: ship and scout launches export FM_TASK_ID
into the pane shell on the same pre-launch channel as GOTMPDIR, and the name
joins the sanitized launch environment allowlist so an isolated launch keeps
it.

* no-mistakes(review): clear inherited task marker in test lib; name resolved ROOT

* no-mistakes(document): docs: record FM_TASK_ID marker and runner placement refusal

---------

Co-authored-by: Talon Stark <[email protected]>

* fix(bin): bound stale alarms for backlog captain holds (#3842)

* fix(bin): bound a stale alarm with the backlog hold, not only the status line

A legitimate wait has two records and the stale alarm reads only one.
`status_is_paused_or_captain_held` takes a status line, so it sees a wait the
worker declared. It cannot see the wait firstmate records when it hands work to
the captain: `bin/fm-captain-hold.sh hold` writes that into the backlog and
leaves the status log alone, so a delivered task keeps `done: PR ...` as its
last line for the whole time the captain is deciding.

Both stale branches were blind to it, and each churned a new pane hash back into
its own alarm: a `done:` line is captain-relevant and reaches the terminal-