Skip to content

Commit 3004ccb

Browse files
feat(bin): add an explicit-only T3 Code runtime backend (#7518)
* feat(backends): add the T3 Code runtime backend T3 Code owns the agent session while Treehouse keeps owning the task worktree. The adapter drives the T3 server over its HTTP orchestration API with a CLI-issued bearer and reads native thread changes over the WebSocket shell stream; nothing is typed into a terminal. A spawn leases a Treehouse slot durably, registers the project by real path, creates the thread on the slot, and starts the launch turn with the encoded brief. T3 sets environment per provider instance, never per thread, so the facts a pane would export (GOTMPDIR, FM_TASK_ID, TRACEPARENT, a secondmate's launch prefix) travel as per-directory harness config: an env block in .claude/settings.local.json, or a [shell_environment_policy] table in .codex/config.toml. A tracked Codex config is overlaid under skip-worktree with a journal and restored byte for byte at teardown. Teardown stops and archives the thread before the slot returns, because a live thread whose worktree path disappears re-creates it on its next turn. The backend is experimental, runs only the claude and codex harnesses, and is selected explicitly or by a configuration-gated auto-detection rule: a home whose T3 shell snapshot shows exactly one live worktree-less thread. * feat(watch): supervise T3 Code tasks from the server's session status The T3 server reports its own session status for claude and codex alike, and no shell sits in front of the agent, so both its native busy and idle verdicts are trusted ahead of harness records (source t3code-native). The watcher subscribes to the shell stream for this home's worker threads, normalizes pending approvals to blocked through the shared transition policy, and keeps polling as the fallback. A thread's capture stays byte-identical through a long tool call, so the wedge ladder gains one T3 consult that resets the idle timer only while the server still reports the session running; stopped and failed sessions read dead and are reported once by the shared dead-record probe. * feat(control): native exit, relaunch refusal, and away-mode threads on T3 Code A T3 thread has no composer, so exit is the server's own session stop, proven by the same recovery-grade agent-state wait every other backend uses. A thread is bound to the driver that first ran it and a turn on a stopped thread continues the same agent, so relaunch is refused before anything is stopped, by the control plane and by the launch owner. A T3 missing is the server's own answer, so the absence proof re-reads the thread. The away daemon can supervise a captain that runs inside a T3 thread: T3 puts nothing into the agent's environment, so after the explicit overrides and the tmux and Herdr markers it asks the server for the one live worktree-less thread on this home's project. start refuses because T3 hosts no terminal to create; start-native remains the path. * test(t3code): cover the adapter against a fake server and a real socket A node HTTP fake answering from a per-case world covers the token and version gates, project matching, the command payloads, the status table, the stop-then-archive kill, worker and secondmate spawns, the per-directory environment files, tracked Codex config preservation, teardown ordering, the control plane's native exit and relaunch refusal, and the wedge consult. A second suite frames real WebSocket messages for the event reader and the watcher's fallback. A token-free live guard skips cleanly without T3. Cases that parse TOML report themselves skipped without a Python 3.11+ interpreter instead of passing vacuously. * docs: document the T3 Code backend and record its verification The backend guide owns setup, token minting, task shape, lifecycle, restart behavior, push events, away-mode support, and active limits. The runtime backend verification record keeps the dated live evidence. The shared configuration, architecture, control-plane, trace-context, and away-mode owners gain one-line cross-references instead of restatements. * no-mistakes(review): Harden t3code launch settings, abort lease, and secondmate bearer * no-mistakes(document): Refresh T3 backend documentation * fix(t3code): harden stable V1 thread lifecycle * fix(t3code): require explicit backend selection * docs(t3code): record stable source pin and trim shared churn * fix(t3code): reject V2 teardown before local cleanup * docs(t3code): align explicit selection guidance and tests * no-mistakes(review): Unify T3 thread status, gate, and V2 recovery handling * no-mistakes(review): Complete T3 V2 recovery steps and trim probe shell reads * no-mistakes(review): Apply T3 background liveness to stopped and errored sessions * no-mistakes(review): Classify T3 background liveness by T3's own session rules * no-mistakes(document): Align T3 backend documentation with current behavior * no-mistakes(ci): Fixed the T3 probe to preserve ready, idle, and interrupted detail verdicts when the shell request fails or times out. Added behavioral coverage that failed before the fix and now passes. The fake-server adapter suite, focused lint, and diff checks pass; the live Codex guard was disabled * no-mistakes(ci): Fixed ci-5: shell-snapshot failures now preserve thread liveness with unknown busy state. T3 busy guards defer, and classifiers preserve uncertainty. Added behavioral regression coverage. T3 adapter, daemon, busy-state, and pending-reply suites, focused lint, and documentation checks pass * no-mistakes(ci): Fixed unknown T3 verdicts clearing stale markers and errored-thread rechecks. Unknown still defers delivery. Both regressions failed before their fixes and now pass. All four focused suites, syntax checks, diff checks, and fast local lint pass. Full extended lint was stopped after nine minutes of heavy memory use * fix(t3code): bound stale alerts and restore portable CI checks * no-mistakes(review): Keep T3 stale markers when thread reads fail transiently * no-mistakes(document): Correct T3 backend documentation and supervision guidance * fix: preserve T3 integration changes during rebase * no-mistakes(ci): Captain, fixed discarded T3 stale warnings to re-arm exactly once, preserving delivered-warning suppression and startup rollback. Regression failed before the fix and passes afterward. All 59 portable T3 tests, targeted lint, syntax checks, and diff checks passed * no-mistakes(document): Clarify T3 warning lifecycle and account guidance * no-mistakes(review): Set launch-sent flag before send to preserve Git hooks * no-mistakes(document): Correct T3 backend documentation and ownership * fix(t3code): bound native-uncertainty inbox deferral by the busy budget Upstream's steering-inbox busy-deferral budget now also covers T3 Code native uncertainty, so a doorbell held for an unreadable thread escalates as stuck-busy instead of waiting forever. Document it and extend the probe test. * no-mistakes(document): Correct T3 runtime documentation and owner references * no-mistakes(document): Correct stale T3 backend documentation * fix(t3code): bound the running-session wedge deferral by turn age A T3 thread that stayed running reset the wedge timer on every consult, so a hung turn past FM_BUSY_TURN_MAX_SECS never reached the possible-wedge alert. Defer only while the latest turn boundary T3 records is younger than that bound, and never defer on a missing turn timestamp. * no-mistakes(document): Correct T3 backend documentation scope * fix(watch): keep the task-record busy verdict for non-T3 inbox delivery inbox_steer_check consulted fm_busy_is_busy with the window target for every backend. Restore window_is_busy, which classifies through the recorded task, for every backend except T3 Code, which alone also treats native uncertainty as busy before ringing. * no-mistakes(document): Correct T3 lifecycle and supervision documentation * no-mistakes(document): Correct T3 cleanup and stall documentation * fix(t3code): load the composer library for the shared submit dialog check Upstream's submit dispatcher now prepares and reads the composer dialog sink around every adapter, so a T3 Code submit failed with 'the dialog check could not be recorded' because this adapter never loaded bin/fm-composer-lib.sh. * no-mistakes(document): Correct stale T3 backend documentation * feat(t3code): move the backend onto T3 Orchestrator V2's /mcp transport T3's Orchestrator V2 removed POST /api/orchestration/dispatch, and an OAuth mcp-client session is accepted only on /mcp. Add bin/fm-t3-mcp.mjs, a dependency-free MCP client with the captain-run PKCE sign-in, a tools/list capability gate pinned to the signed-in environment id, and the thread verbs the adapter needs, and port bin/backends/t3code.sh onto it: launch, send, read, interrupt, archive with a proven close, and the away-mode thread lookup. The transport forces three changes: fm-control exit refuses on t3code (V2 has no session stop), the WebSocket push path is removed (an mcp-client is refused on it, so T3 windows poll), and a launch whose reply is lost keeps its lease instead of retrying (t3_thread_launch has no idempotency key). Fixes #6904 * fix(t3code): verify the V2 wiring live on Linux and fix what it found A live run of the /mcp backend against t3 0.0.46-nightly.20261010.2935 on Linux found four defects the fake server could not: - capture read the oldest activity items: t3_thread_read pages forward from afterPosition, so the helper now starts from the thread's visible item count and widens backwards when that undercounts. - fm-control interrupt on t3code always reported cancel=unconfirmed because the key path discarded T3's own run-wait verdict; it now reports T3's confirmed, not-running, or unconfirmed. - the telemetry probe never read "off" on Linux, where /proc/<pid>/environ is NUL-separated and the value match ran into the next variable. - the credential-mode test ran BSD stat first, which GNU stat answers with filesystem output before failing. The fake server now pages like T3, the capture and interrupt tests fail without their fixes, and the runtime-backends record carries the live run. * no-mistakes(review): Archive unproven T3 launches as uncertain; gate t3_thread_list * no-mistakes(review): Restore identity-tool gate test coverage * no-mistakes(document): Align T3 backend documentation with Orchestrator V2 * fix(t3code): address the Orchestrator V2 backend review - Interrupt confirmation waits on exactly the run T3 interrupted (wait --run). - A send reply lost after T3 committed it reads unconfirmed (exit 7 from the helper, verdict unconfirmed, fm-send exit 3), and one request id per logical delivery makes the resend idempotent. - Secondmate recovery never replaces an endpoint whose close is unproved, and resumes a failed T3 run in its own thread instead of launching a second one. - Secondmate retirement reaps provider processes T3 detaches after the archive before a pooled or standalone home is returned or removed. - Pending runtime requests read blocked, escalate once per request set through the watcher's push splice, and are answered with bin/fm-t3-answer.sh; permission approvals are surfaced, never answered. - Supervisor discovery reads every thread page and counts forks, not subagents. - Model selection resolves against orchestrator_capabilities, keeps unrelated default options under an effort override, and launch reads back the full t3_thread_configuration; the stale driver-binding claim is corrected. - The watcher's push splice waits on exact active runs through t3_thread_wait, bounded by the poll interval, with polling as the backstop. - The Claude pull-request-tool clause applies only before the T3 build verified safe, with an opt-in live guard and a dated verification record. - The fake server models paging, exact-run waits, asynchronous interrupt and archive, commit-then-disconnect sends, and pending requests; read limits cap at T3's 100. * no-mistakes(review): Retain T3 send outcomes, freeze digests, keep Herdr push * no-mistakes(review): Keep T3 request ids across outages and failed retries * no-mistakes(document): Correct T3 retry, recovery, and cleanup documentation * fix(t3code): limit the secondmate close refusal to T3 threads Non-T3 secondmate recovery keeps its existing best-effort close, so homes without backend=t3code run the same liveness code as main. A T3 secondmate whose thread reads missing now re-proves the close through the idempotent archive before a replacement thread launches, and an unproved close spawns nothing. * no-mistakes(review): Report lost T3 launch-brief replies as unconfirmed, keep task record * no-mistakes(document): Correct T3 backend documentation and recovery guidance * fix(t3code): drop the unused local that failed CI lint ShellCheck SC2034 flagged the unused `between` local in the T3 secondmate close-proof test, failing the Lint 1 job on the original pull request. * fix(t3code): cover T3 0.1.0's full-access scopes in the sign-in pairing code T3 0.1.0 grants a full-access mcp-client orchestration:read, orchestration:operate, settings:write, and source-control:write, and its OAuth decision refuses a pairing code that does not cover all four. The sign-in minted its code with only the read and operate scopes the 0.0.46 nightlies required, so login failed on the stable release with insufficient_scope. Request all four; the 0.0.46 nightly CLI accepts both added scope names, and the issued credential is still the server's own full-access scope set. * no-mistakes(review): Document remote code-root update requirement for new inherited items * no-mistakes(review): Route T3 secondmates to the re-read nudge, not restart * no-mistakes(review): Tolerate older receivers' absent-item refusal; refuse T3 raw launch * no-mistakes(review): Harden T3 abort, launch, watch paths; drop default-path forks * no-mistakes(review): Fix T3 daemon restamp, project race, Git config, settings merge * no-mistakes(review): Write only Firstmate's hook entry to T3 env files * no-mistakes(review): Fix T3 symlink guard, cleanup leaks, blocked-supervisor digests * no-mistakes(review): Scope T3 codex pre-check; tighten tests; correct T3 docs * no-mistakes(review): Key T3 codex pre-check on tracked config; fix forge doc * no-mistakes(review): Treat empty T3 replies and held local failures as unconfirmed * no-mistakes(test): Keep pre-existing CLAUDE.local.md on refused t3code spawn * no-mistakes(document): Correct T3 away-mode injection and stale-marker docs * no-mistakes(ci): The failing check is the auto-relaunch leg of tests/fm-remote-secondmate-lifecycle-e2e.test.sh ("the watcher did not exit on its auto-relaunch wake within the bound"). The flake predates this branch, but the branch makes it more likely, so I fixed the test. The whole test file now passes locally. Does the branch touch the path? Partly. - For a herdr remote mate, the branch leaves the liveness probe, the relaunch, the watcher tick and fm-spawn.sh's remote-secondmate path unchanged. Every T3 branch there is gated on backend=t3code. - But the branch adds `t3code-instances` to FM_INHERITABLE_CONFIG, ahead of captain-shared.md. Every remote spawn, including the watcher's relaunch, now pushes one more remote `absent` record. - CI per-leg timings, branch vs two main runs: legs that push inheritance are about 5-12% slower (37.3 vs 35.5s, 54.3 vs 48.0-49.7s, 55.5 vs 49.9-52.1s, 30.6 vs 26.3-27.9s). Seeding-only legs are identical. Evidence the flake predates this PR: - On main this leg already takes 30.1-32.9s. - The test waits 1500 iterations of `sleep 0.02`, about 30-35s. - The watcher's own relaunch bound, FM_SECONDMATE_LIVENESS_TIMEOUT, defaults to 120s. - The identical failure appears in 7 other recent failed CI runs on unrelated branches (fm-upstream-six-local-fixes, fm-stooddown-worker-false-wedge-alarms, fm-resolve-quota-attention, fm-session-stall-2026-10-16, fm-7426-pr, fm-polytoken-worker-adapter-v2, fm-remote-convergence-upstream). None of them contain bin/backends/t3code.sh. Violated invariant: the test must never fail a relaunch the watcher still accepts inside its own relaunch bound. The fix is test-only. It is the uncommitted change to tests/fm-remote-secondmate-lifecycle-e2e.test.sh that the timed-out earlier agent left; I reviewed it and kept it. - The watcher leg pins FM_SECONDMATE_LIVENESS_TIMEOUT=120, the same value as the default. - The iteration-count loop becomes a wall-clock deadline: that bound plus 30s for startup and probe. - Either spawn outcome, success or timeout (124/137), still wakes and exits the watcher, so the ordinary path ends as soon as the relaunch completes. - The `t3code-instances` inheritance item is a feature this PR needs, so I left the product code unchanged. The file's other ~30s waits each wait for a point partway through a spawn, not for a product-owned bound. They are the spawn and the config push reaching a blocked inheritance write, and a respawn reaching a blocked launch. All three passed locally, and the first two also passed in this branch's CI run, so I left them alone. Verification: - `bash -n` and `shellcheck -x` pass. - I ran only this one test file through bin/fm-test-run.sh, as instructed. Result: exit=0, total=1 failed=0, duration 1246656ms. This Mac runs about 2.5× slower than CI. - "watch liveness: a dead remote secondmate is auto-relaunched on its own host with one wake" passed after 89s (02:42:43 → 02:44:12). The old ~30s wait would have failed it; the new deadline is 150s * no-mistakes(review): Document t3code-instances absent-push cost for remote inheritance * no-mistakes(ci): The failing check is a timing flake in tests/fm-watcher-lock.test.sh, not a defect in this branch's code. I fixed it with a test-only change. What failed: in "Behavior portable serial 7", test_lock_recovers_dead_nested_steal_chain failed with "not ok - dead link-lock owner did not publish its pid" (tests/fm-watcher-lock.test.sh:394). That message comes from the helper leave_dead_link_locks. The helper starts a bash child that sources bin/fm-wake-lib.sh and creates one or more link locks, then waits for the child to write its pid. The wait was 50 rounds of `sleep 0.02`, about 1s on Linux CI. The other child-startup waits in this file allow about 5s (lines 536, 635, 808). Locally the child publishes in about 60ms, so the 1s bound only fails when the runner stalls. Did the branch cause it? The branch does not touch the test, bin/fm-wake-lib.sh, bin/fm-path-lib.sh or tests/lib.sh. Its only change to bin/fm-test-run.sh puts the new T3 tests into test families, which can change which tests share a serial shard. I searched the failed CI logs of the last 60 runs on other branches and found no instance of this failure, so I can't show it predates the PR. Violated invariant: a wait the test owns must not fail a child that a loaded runner merely slows down. Sibling sites: the helper is the one shared place where all four of its callers wait (reclaims_dead_steal_owner, recovers_dead_nested_steal_chain, steal_reap_cannot_remove_successor, resumes_own_interrupted_steal_reap), so the one edit covers all of them. The other short wait in the file (line 132) reads output from a watcher that has already exited, not a child still starting up. Fix: one edit to the helper. The loop runs up to 250 rounds instead of 50, about 5s, the same as the file's other startup waits, with a two-line comment. It still returns as soon as the pid appears, so the normal path is unchanged. No product code changed. Verification: - `bash -n` and `shellcheck -x` pass. - I ran the four helper callers from a temporary copy of the file, with only the child's startup delayed by 10s. - Old helper: fails with the exact CI message "dead link-lock owner did not publish its pid" (rc=1). - New helper: all four pass (rc=0). - With no delay, all four pass in about 2s. - I could not run the full file locally. An unrelated earlier test, test_lock_stale_steal_single_winner_under_concurrency, hangs on this Mac's bash 3.2: the read from its FIFO fails with "Interrupted system call". That test passed in this CI run and is outside this fix, so I left it alone and stopped the run. - The temporary driver files were removed. The unselected ci-2 (Behavior portable serial 2, cancelled with no verdict) was not addressed * no-mistakes(document): Fix T3 path inventory and thread wording * no-mistakes(review): Fix T3 lease abort, approval identity, waits, and selection * no-mistakes(review): Pin T3 approval identity to verified v0.1.0 waiting items * no-mistakes(review): Remove stray Paseo fragment from fm-backend.sh header * no-mistakes(document): Correct T3 lease, send-verdict, and teardown docs * no-mistakes(review): Prove T3 launch archives, clean aborted homes, reap nested homes * no-mistakes(review): Keep T3 slot lease only on dirty-slot refusal * no-mistakes(review): Treat T3 orchestration_error as unconfirmed; fix backend docs * no-mistakes(review): State unproven T3 outcome cause in operator text * no-mistakes(review): Refuse T3 secondmate teardown without lsof; name env cleanup * no-mistakes(review): Restore main's reassigned-slot test; add separate T3 overlay test * no-mistakes(test): Document Codex trust prerequisite for T3 Codex env * no-mistakes(document): Correct T3 uncertain-launch lease and coverage docs * no-mistakes(review): Warn on unconfirmed T3 Codex trust; harden launch-archive proof and tests * no-mistakes(document): List T3 Codex trust warning in coverage inventory * no-mistakes(ci): The rebase onto 25bb43b completed cleanly. I also fixed a CI test-coverage failure that the combined tree caused, by adding a tenth portable serial CI shard. Every verification run passes. The shard fix is in the working tree and not committed. **Rebase:** all 82 commits are replayed with no merge commits, and the new head is f1bb58ae. Each commit keeps its original author, date and subject, including Bryce Eppler's. - One commit conflicted: fff8ce69, in tests/fm-remote-secondmate-lifecycle-e2e.test.sh. Main (ac8a767) raised a watcher wait loop from 1500 to 3000 iterations of `sleep 0.02`, about 60s. The branch replaces that loop with a 150s wall-clock deadline: the watcher's 120s relaunch bound plus 30s. I kept the branch side, which already gives the longer wait main wanted. - The branch's patch on the new base matches the original apart from line numbers. Main's patch also matches, except for that one hunk. - Main also edited fm-watch.sh, fm-pending-reply-lib.sh, fm-fleet-snapshot.sh, fm-test-run.sh and some docs. Its edits there sit in different hunks from the branch's. **Coverage-guard break:** each side passes alone, but together they do not. CI's "Test coverage guard" job runs `bin/fm-test-run.sh --check-coverage`, which failed with "largest portable serial shard packs 1200805ms above the 1200000ms target". | tree | serial lane total | largest shard | |---|---|---| | main | 10582151ms | 1192918ms (ok) | | branch before rebase | 10762151ms | 1195805ms (ok) | | rebased | 10807151ms | 1200805ms (over by 805) | - **Cause:** the five tests the branch adds have no timing hint, so each is packed at the 45000ms default. Main added one more unhinted test. Nine shards hold at most 10800000ms. - **Why hints alone don't fix it:** this PR's CI runs 39463576576, 39814995718 and 39883948163 measured the slowest successful samples: | test | slowest sample (ms) | |---|---| | fm-backend-t3code | 239245 | | fm-t3-mcp | 57613 | | fm-watch-inbox-meta | 283 | | fm-backend-t3code-live-e2e (live-guard skip) | 51 | | fm-backend-t3code-pr-tools-live-e2e (live-guard skip) | 52 | With these the lane totals 10879395ms. That is more than nine shards can hold, and docs/fm-test-portable-shards.md says to refresh hints or add shards rather than raise the job timeout. **Fix (test and CI files only, nothing a home runs):** - `bin/fm-test-run.sh`: `PORTABLE_SERIAL_SHARDS` goes from 9 to 10, and the five measured hints are inserted without reordering existing lines. - `.github/workflows/ci.yml`: the serial matrix gains shard 10. The timing aggregate already collects artifacts by glob, so it picks up the new shard. - `docs/fm-test-portable-shards.md`: records where the hints came from, and says fifteen long-lived jobs, ten of them serial. - With ten shards the largest is 1192918ms, the indivisible fm-supervision-host test, and the others land near 1076300ms. This adds one CI runner per run. It is the remedy the shard docs prescribe, but the maintainer may want a say since the PR now changes CI capacity. **Verification (all pass):** - tests/fm-test-run.test.sh, including the coverage-guard and packing-boundary cases. - tests/fm-ci-workflow.test.sh and tests/fm-lint-workflows.test.sh. - tests/fm-pending-reply.test.sh and tests/fm-fleet-snapshot-contribution-input.test.sh. - `bin/fm-lint.sh` on bin/fm-test-run.sh and on the files both sides touched. - `bash -n` on every script in bin, bin/backends and tests, and `node --check` on bin/fm-t3-mcp.mjs * no-mistakes(review): Fix T3 review findings and revert tenth CI shard * no-mistakes(review): Prove next-since arrival write; keep T3 backend suite serial * test(t3code): run the T3 suites in the portable parallel lanes The two T3 suites pushed the portable serial lane past the nine-shard budget. Give every case id the backend suite spawns a per-run suffix so its /tmp/fm-<id> directories cannot collide across concurrent runs, with cleanup limited to the ids that run created, then move both suites into the proven-isolated set with their CI-measured hints as parallel hints and rebalance the two parallel lanes. Record the concurrent proof. * fix(t3code): refuse a Codex approval mode T3 cannot honor T3 starts every worker at its full-access runtime mode, so a t3code codex spawn with config/codex-approval-mode=approve-for-me would launch at full access while recording approval_mode=approve-for-me. Refuse it before any mutation, as the Claude permission-mode refusal already does, and cover the refusal and the bypass posture with fake-server tests. * no-mistakes(review): Refuse managed approval failover for t3code tasks * no-mistakes(document): List T3 failover refusal in approval coverage inventory * fix(t3code): name the Codex restricted mode in the T3 refusal config/codex-permission-mode=restricted sets the Codex approval posture that a t3code spawn already refuses, but the refusal named config/codex-approval-mode. Name the setting that produced the posture, document the limit beside the restricted mode, and cover the refusal. * no-mistakes(document): Name T3's Codex restricted refusal in fm-spawn header --------- Co-authored-by: Bryce Eppler <[email protected]>
1 parent 6c87d7b commit 3004ccb

76 files changed

Lines changed: 9116 additions & 649 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/afk/SKILL.md‎

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ Hold-for-return is the default and the only reach profile this release records:
4141
If the native launch fails, run `bin/fm-afk-launch.sh stop` to roll back the prepared lifecycle.
4242
Do not wrap it in `nohup ... &` (Codex/herdr can reap fire-and-forget shell children after a tool call returns).
4343
- **Every other harness** (codex, opencode, omp, and cursor on a home that does not run the supervision host, and kimi): run `bin/fm-afk-launch.sh start`.
44-
It is the single owner of the daemon terminal: it creates a NON-VISIBLE tracked terminal for the current backend and passes the captain pane in as `FM_SUPERVISOR_TARGET` so the daemon injects into the captain, not its own new pane (docs/herdr-backend.md "Away-mode supervisor support").
44+
It is the single owner of the daemon terminal: on pane backends it creates a NON-VISIBLE tracked terminal and passes the captain endpoint as `FM_SUPERVISOR_TARGET` so the daemon injects into the captain, not its own new pane (docs/herdr-backend.md "Away-mode supervisor support").
45+
On the t3code backend there is no terminal to create, so `start` refuses and only the native path above works; a Codex captain hosted by T3 Code has no away daemon (docs/t3code-backend.md "Active limits").
4546
Both daemon paths require the record `enter` wrote and share `bin/fm-afk-start.sh` as the daemon entry.
4647
The daemon is **presence-gated**: it injects escalations only while `state/.afk` exists, and stays quiet otherwise.
4748
3. **Announce, then read back after entry.**
@@ -103,7 +104,8 @@ Destructive, irreversible, and security-sensitive actions are never pre-authoriz
103104

104105
## The daemon, where it still runs
105106

106-
On the harnesses that still launch the daemon (every verified harness except Pi and pi-signed, and except away mode on a home that runs the supervision host), the mechanics below are unchanged.
107+
On the harness and backend combinations that still launch the daemon, the mechanics below are unchanged.
108+
Pi, pi-signed, a home that runs the supervision host, and the T3 Code limits above remain outside this section.
107109

108110
### Operational prefix contract
109111

@@ -117,9 +119,11 @@ For other harnesses, the operational prefix travels with the message text; neith
117119

118120
### Busy-guard and composer guard
119121

120-
The daemon never injects into an in-use pane. Two checks run before every
121-
injection, dispatched through `bin/fm-backend.sh` for the supervisor's own
122-
backend (see [supervisor backend configuration](../../../docs/configuration.md#away-mode-supervisor-backend-fm_supervisor_backend--fm_supervisor_target)):
122+
The daemon never injects into an in-use pane. T3 Code has no composer and uses
123+
the native status and turn transport owned by
124+
[`docs/t3code-backend.md`](../../../docs/t3code-backend.md#away-mode). Two
125+
checks run before every pane injection, dispatched through `bin/fm-backend.sh`
126+
for the supervisor's own backend (see [supervisor backend configuration](../../../docs/configuration.md#away-mode-supervisor-backend-fm_supervisor_backend--fm_supervisor_target)):
123127

124128
- **Primary-pane busy guard** - `pane_is_busy` trusts the backend's native `busy` when available, otherwise matches rendered output against only the detected primary harness's signature.
125129
This narrow delivery guard never classifies a recorded worker task and never uses a global union of vendor patterns.
@@ -133,8 +137,7 @@ A busy primary pane, or any composer verdict other than `empty`, defers the inje
133137
In afk mode the composer guard is belt-and-suspenders (no human is typing), but it protects against the race window between the captain returning and their message landing, a dead shell, and the daemon's own previous injection sitting unsent.
134138

135139
**Max-defer escape (the daemon must never silently wedge).**
136-
If anything stays buffered past `FM_MAX_DEFER_SECS` (default 300), the daemon
137-
attempts one normal flush, which still requires an idle pane and an affirmatively empty composer.
140+
If anything stays buffered past `FM_MAX_DEFER_SECS` (default 300), the daemon attempts one normal flush, which still requires an idle endpoint and, on pane backends, an affirmatively empty composer.
138141
The alarm is defense in depth rather than a substitute for keeping every genuinely idle supported composer injectable.
139142
If that submit cannot be confirmed, it raises a loud, rate-limited wedge alarm:
140143
an ERROR in the daemon log naming the last delivery failure, a durable
@@ -144,9 +147,8 @@ So a guard false-positive becomes a visible stall, never an unbounded silent no-
144147

145148
### Submit model
146149

147-
The digest is typed **once** (`send-keys -l` on tmux, `pane send-text` on
148-
herdr - both literal, non-submitting sends), then submitted with Enter and
149-
**verified** through the selected backend's submit primitive.
150+
On tmux and Herdr, the digest is typed **once** with a literal, non-submitting send (`send-keys -l` on tmux, `pane send-text` on Herdr).
151+
Enter submits it, and the selected backend's submit primitive verifies delivery.
150152
Enter is retried (Enter only, never a retype) until the backend confirms the
151153
submit landed.
152154
A failed delivery is logged with its stage (initial send or Enter delivery, where no confirmation retry ran and the text may already be typed on backends such as herdr whose Enter could not be sent, or Enter confirmation), the payload's byte count, and the transport's own error output.
@@ -157,7 +159,7 @@ A bordered-empty or ghost-only composer is recognized as empty where that backen
157159
`fm-send.sh` uses the same primitive only on its typed plane and exits non-zero when that plane's Enter is positively swallowed; ordinary local text steers use the durable inbox and do not treat doorbell submission as delivery proof.
158160

159161
**Busy-queued Enter exception (opencode).** OpenCode keeps queued text visible while it is mid-turn, so the supported supervisor adapters delegate the final delivery decision to `fm_composer_queued_enter_verdict` in `bin/fm-composer-lib.sh` rather than treating visible text alone as a swallowed Enter.
160-
The daemon still clears its buffer only on the backend's `empty` success verdict; [`docs/tmux-backend.md`](../../../docs/tmux-backend.md), [`docs/herdr-backend.md`](../../../docs/herdr-backend.md), and [`docs/rex-backend.md`](../../../docs/rex-backend.md#current-operation-and-safety) own the backend-specific confirmation signals.
162+
The daemon still clears its buffer only on the backend's `empty` success verdict; [`docs/tmux-backend.md`](../../../docs/tmux-backend.md), [`docs/herdr-backend.md`](../../../docs/herdr-backend.md), [`docs/rex-backend.md`](../../../docs/rex-backend.md#current-operation-and-safety), and [`docs/t3code-backend.md`](../../../docs/t3code-backend.md#away-mode) own the backend-specific confirmation signals.
161163

162164
### Classification policy
163165

@@ -184,6 +186,7 @@ Classify each wake this way, applying the steering-inbox exception before status
184186
- `stale` with a terminal status, a bare legacy captain-relevant line, or an unrecognized status prefix such as `parked:` -> escalate.
185187
Nonterminal progress remains transient even when its prose contains a legacy free-text token or its seen-status marker already matches, so record a marker and self-handle.
186188
If the pane is still idle past `FM_STALE_ESCALATE_SECS` (default 240s), housekeeping escalates it as a possible wedge.
189+
For T3 native uncertainty, follow the [stale-alert retention contract](../../../docs/t3code-backend.md#away-mode).
187190
This bounds wedge-detection latency to the threshold plus a tick: a delay, never a loss.
188191
A stale detail that ends with `blocked-on-prompt:` and a dialog name means the pane shows that dialog, so the worker cannot continue until someone answers it.
189192
An escalation this path already sends keeps that name, whether it comes from the status log or from housekeeping.
@@ -206,30 +209,18 @@ The single-line format makes submission unambiguous across harnesses; the carrie
206209
- **Single-line digest** - embedded newlines are collapsed to a literal
207210
separator before injection, so submission is unambiguous regardless of
208211
harness.
209-
- **Busy and composer guards on the supervisor pane** - before injecting, the daemon runs the detected-primary-harness rendered busy guard and reads `fm_backend_composer_state` directly.
210-
Only `empty` permits injection; `pending` protects half-typed or swallowed input, and `unknown` protects unreadable panes and bare dead-shell prompts.
211-
Every other result preserves the buffer for retry, so the daemon never merges its digest into the captain's half-typed line or types it into a shell.
212-
- The active backend passes its capture plus declarative styled, cursor, identity, and row capabilities to the shared screen classifier; all structural recognition and verdict logic remains in `bin/fm-composer-lib.sh`.
212+
- **Busy and composer guards on the supervisor endpoint** - before injecting, the daemon runs the backend's busy guard and reads `fm_backend_composer_state` directly.
213+
On pane backends, only `empty` permits injection; `pending` protects half-typed or swallowed input, and `unknown` protects unreadable panes and bare dead-shell prompts.
214+
For T3 Code, follow the [native injection contract](../../../docs/t3code-backend.md#away-mode).
215+
Every other pane verdict preserves the buffer for retry, so the daemon never merges its digest into the captain's half-typed line or types it into a shell.
216+
- Pane backends pass their capture plus declarative styled, cursor, identity, and row capabilities to the shared screen classifier; all structural recognition and verdict logic remains in `bin/fm-composer-lib.sh`.
213217
Styled captures let that owner remove dim/faint and dark-TRUECOLOR ghost or placeholder text while shape detection uses the ANSI-stripped screen, so a dark border is not lost with ghost content.
214218
A ghost-only or idle bordered composer such as claude's `│ > ... │` therefore reads empty without allowing an unbordered shell prompt to do the same.
215219
`FM_COMPOSER_IDLE_RE` overrides the shared idle-placeholder regex, but a match alone never bypasses the classifier's shape-specific position and ANSI de-emphasis safety gates.
216220
`FM_BUSY_REGEX` overrides the rendered delivery guards plus Grok's isolated task-state fallback.
217221
A blank or otherwise unidentified input row carries no positive container proof and defers injection, so a modal dialog or a mid-redraw pane is never an injection target.
218-
- **Max-defer escape** - the daemon must never silently wedge. If anything stays
219-
buffered past `FM_MAX_DEFER_SECS` (default 300s), the daemon attempts one
220-
normal flush, which still requires an idle pane and an affirmatively empty composer. If that
221-
cannot confirm a submit, it raises a loud, rate-limited wedge alarm: ERROR log,
222-
durable `state/.subsuper-inject-wedged` marker, a tmux status-line flash when
223-
applicable, and a backend-independent active alert. A
224-
composer false-positive surfaces as a visible stall, never an unbounded silent
225-
no-op.
226-
- **Verified type-once submit model** - the digest is typed once (`send-keys -l`
227-
on tmux, `pane send-text` on herdr), then submitted with Enter and verified.
228-
Enter is retried, Enter only and never a retype, until the backend submit
229-
primitive reports `empty` as its caller-facing success verdict.
230-
For tmux that verdict normally means the shared classifier proved the composer cleared; a baseline-gated idle-to-busy transition may instead prove this Enter started the turn.
231-
For herdr's idle-baseline path it means native agent-state observed a turn start, the shared classifier proved the composer cleared, or the shared queued-Enter verdict proved delivery while busy.
232-
This lets ghost-only or bordered-empty composers count as empty where a composer read is the active confirmation signal.
222+
- **Max-defer escape** - follow the [bounded flush and alarm contract above](#busy-guard-and-composer-guard) and the [alert setup guide](../../../docs/wedge-alarm.md).
223+
- **Verified submit model** - follow the [submit model](#submit-model) and its linked backend confirmation contracts.
233224
- **Marker strip** - `strip_injection_marker` removes the current operational
234225
prefix or legacy bare marker before classification or relay, so the digest
235226
text firstmate sees is clean; `open` prints a record-backed doorbell's digest
@@ -246,7 +237,7 @@ The single-line format makes submission unambiguous across harnesses; the carrie
246237
Treat `state/.subsuper-escalations`, its `.since` sidecar, `state/.subsuper-inject-wedged`, and `state/.subsuper-unknown-acked` as session-scoped delivery artifacts, not as the durable work record.
247238
Always enter through `bin/fm-afk-launch.sh`, which clears prior-session artifacts only for a fresh entry and preserves the current session's buffer on refresh.
248239
Always exit through `bin/fm-afk-launch.sh stop`, which keeps `state/.afk` present through the daemon's shutdown flush, clears it, and archives the posture record last.
249-
`docs/herdr-backend.md` "Away-mode supervisor support" owns the current mechanism, and `docs/verification/runtime-backends.md` "Away-mode transport" owns active evidence.
240+
`docs/herdr-backend.md` "Away-mode supervisor support" and `docs/t3code-backend.md` "Away mode" own the backend mechanisms, and `docs/verification/runtime-backends.md` "Away-mode transport" owns active evidence.
250241

251242
### Reliability properties
252243

‎.agents/skills/harness-adapters/references/common/model-and-effort.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Add `references/common/dispatch.md` for configured profile precedence.
66
## Axes and precedence
77

88
`../../../bin/fm-spawn.sh` accepts concrete `--harness`, `--model`, and `--effort` values selected at intake; scripts never parse natural-language dispatch rules.
9-
The tool reference records verified flags, accepted values, omission behavior, and discovery.
9+
The tool reference records verified flags, accepted values, omission behavior, and discovery for pane-backed launches.
10+
For T3 Code, resolve both axes through the [provider catalog contract](../../../../../docs/t3code-backend.md#provider-instances-and-models) before selecting a profile.
1011

1112
Effort precedence is a per-task captain instruction, then applicable dispatch profile or secondmate pin, then the fallback below.
1213
Never replace either higher-precedence value.
@@ -18,9 +19,7 @@ If an adapter lacks `xhigh`, cap at its highest supported non-`max` level rather
1819
Never select `max` through this fallback; only an explicit per-task or standing captain preference permits it.
1920

2021
The explicit native `ultra` value follows the model-scoped refusal contract in `../../../bin/fm-harness.sh validate-native-effort`; it is never silently omitted or mapped to a Pi level.
21-
For other values, if requested effort is outside the adapter's accepted set, the spawn records `effort=` in task metadata but emits no effort flag.
22-
This preserves launch success instead of passing a known-bad value.
23-
A harness with no verified interactive effort flag follows the same record-and-omit contract.
22+
[`configuration.md`](../../../../../docs/configuration.md#crew-dispatch-profiles-configcrew-dispatchjson) owns backend-specific refusal or omission behavior for other effort values, including harnesses with no verified interactive effort flag.
2423
Polytoken uses its [model-scoped selectable-reference contract](../harness/polytoken.md) instead of record-and-omit.
2524

2625
## Harness and provider identity

0 commit comments

Comments
 (0)