Skip to content

feat: add experimental T3 Code runtime backend - #5596

Closed
bryceeppler wants to merge 57 commits into
kunchenguid:mainfrom
bryceeppler:t3code-backend
Closed

bryceeppler wants to merge 57 commits into
kunchenguid:mainfrom
bryceeppler:t3code-backend

Conversation

@bryceeppler

@bryceeppler bryceeppler commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Adds an experimental, opt-in t3code runtime backend that runs Firstmate workers as T3 Code threads on T3's Orchestrator V2 /mcp transport.

Draft, paused until Orchestrator V2 ships in a stable T3 release.
T3 0.0.46 removed POST /api/orchestration/dispatch, so this branch targets V2 only.
It will be re-verified on stable and marked ready for a fresh review then.

Backend shape

What changed since the last review

A Codex review of the V2 wiring returned twelve findings; all are fixed, each with a fake-server test that fails on the previous head.

  • Interrupt confirms only the exact run T3 interrupted, never a later queued run.
  • Lost send replies read as unconfirmed rather than undelivered (fm-send exit 3); one request id per logical delivery makes a resend land once, the accepted message and run ids are kept, and the away daemon freezes an unconfirmed digest and retries it with its own request id until confirmed, with later events in the next digest.
  • Secondmate recovery on T3 resumes a failed run in its own thread, treats an archived thread with a live run as not yet closed, re-proves the archive of a missing thread before launching a replacement, and launches nothing when that close is unproved.
  • Secondmate retirement reaps provider processes T3 detaches after the archive before a pooled or standalone home is returned or removed.
  • Pending questions read blocked, wake the supervisor once per request set, and are answered with bin/fm-t3-answer.sh; permission approvals are surfaced and left to T3 Code.
  • Supervisor discovery reads every thread page, counts forks, and excludes subagents.
  • Model selection resolves against orchestrator_capabilities before leasing, keeps unrelated default options under an effort override, and the launch reads back the full t3_thread_configuration.
  • Event-driven waits: the watcher's push splice waits on exact active runs through t3_thread_wait, bounded by the poll interval with polling as the backstop, and Herdr keeps its push wait in mixed homes.
  • Spawn reports a launch brief whose T3 reply was lost as possibly delivered, keeps the task record, and never retries it.
  • Claude PR tools: link, list, and unlink no longer crash a Claude session on the current nightly, so the worker clause steering off them applies only to older servers, with an opt-in live guard.
  • Fake server now models paging, exact-run waits, asynchronous interrupt and archive, commit-then-disconnect sends, and pending requests; the helper's read limit caps at T3's 100.

Verification

Live on 2026-10-10, Linux x86_64, t3 0.0.46-nightly.20261010.2935 (service-managed), Claude Code 2.1.296, in a scratch Firstmate home and scratch projects.
docs/verification/runtime-backends.md records the commands and results.

Scenario Result
Claude scout spawn with catalog-resolved selection and configuration read-back 5.6 s
Question asked through Claude's question tool surfaced by the watcher's event wait within 1 s, answered by request id
Inbox steer starting a long tool call, then fm-control interrupt cancel=confirmed on the interrupted run; the child was gone 2 s later
Scout teardown thread archived with no active run; slot available
Secondmate spawn in a standalone home, then retirement the barrier reaped the lingering provider process before the home was removed
link_pull_request, list_thread_pull_requests, unlink_pull_request in a Claude thread all answered; the run completed

The live check ran on the code before the review rounds' fixes to sends, the away-daemon digest, and secondmate shutdown; those are covered by the fake-server suites.
Test suites: fm-t3-mcp, fm-backend-t3code, fm-secondmate-liveness, fm-supervision-events, and the other colocated suites pass; bin/fm-lint.sh and bin/fm-doc-audience-check.sh pass.
fm-test-run (--jobs admission, pty-host reparent) and fm-control-relaunch (Herdr Pi relaunch) fail the same way on current main on this host, and the Herdr control smoke needs a default Herdr session this host lacks.

Selection

Still opt-in: only an explicit config/backend=t3code plus a signed-in credential selects it, and unconfigured homes keep their existing backends.

Default-path files and non-T3 homes

Each shared file this round touched, and why a home without config/backend=t3code is unchanged:

  • bin/fm-backend.sh: adds t3code cases to the push dispatchers (has_push, events_capable, wait_transition, commit/clear_transition, event_session, transition_target, transition_note); every existing backend keeps its own branch and default.
  • bin/fm-watch.sh: T3 windows join the push wait only when no other push backend is recorded, so a Herdr-only or mixed home keeps Herdr's push wait exactly (tests/fm-supervision-events.test.sh).
  • bin/fm-push-transition-lib.sh: appends a backend note to the wake reason; the note is empty for every backend but t3code, so the Herdr reason is byte-identical (tests/fm-supervision-events.test.sh).
  • bin/fm-send.sh: a new unconfirmed verdict case; only the T3 adapter emits that verdict, so other backends reach the same branches as before.
  • bin/fm-supervise-daemon.sh: a digest request id is minted only when the supervisor backend is t3code, and a digest freezes only on the unconfirmed verdict, so non-T3 digests flush and retry as before (tests/fm-daemon.test.sh).
  • bin/fm-teardown.sh: the secondmate home shutdown barrier runs only for kind=secondmate with backend=t3code.
  • bin/fm-control.sh, bin/fm-control-lib.sh: comment and refusal-message corrections on paths only t3code reaches.
  • bin/fm-spawn.sh: the relaunch refusal message only t3code reaches, the version-scoped Claude channel clause in the T3-only channel installer, and the unconfirmed launch-brief report on the T3 launch-turn path.
  • bin/fm-test-run.sh: registers the new opt-in live guard in the live family.
  • bin/fm-secondmate-liveness-lib.sh: the resume-in-place path, the archive re-proof for a missing thread, and the refusal to replace an unproved close all require backend=t3code; every other backend runs main's best-effort kill line unchanged (tests/fm-secondmate-liveness.test.sh pins it for tmux, tests/fm-backend-t3code.test.sh covers the T3 refusal).

This round does not touch bin/backends/herdr.sh or the opencode watch plugin.

Follow-ups

  • Refusing to replace a secondmate whose old endpoint cannot be proven closed would also protect tmux and Herdr homes, where recovery still ignores a failed close; that cross-backend change belongs in its own upstream PR.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

⏭️ **Rebase** - skipped

Step was skipped.

🔧 **Review** - 1 issue found → auto-fixed ✅
  • ⚠️ bin/fm-spawn.sh:5803 - The spawn launch turn treats a lost T3 reply as a proven refusal. fm_backend_t3code_turn_start now returns 7 when T3 may already have committed the brief: the request went out, but its reply was lost (helper exit 7, delivery_unconfirmed). The launch-brief caller ignores that distinction. Any nonzero status prints "error: T3 refused the launch turn for $ID on thread $T" and exits 1. By then the task record is already published, and T3CODE_ABORT_CLEANUP/T3CODE_LEASED were cleared at line 5462. Concrete sequence: T3 commits the brief and the connection drops before its reply. spawn reports a refusal, but the worker thread is running the brief in its leased worktree. The dispatcher, believing nothing started, may tear the task down and re-dispatch it, which kills a working agent. A manual resend of a different text would deliver a second brief. Intent item 2 requires the caller to separate a proven refusal from an uncertain transport outcome and to report delivery as unconfirmed after a lost response. fm-send and the away daemon do this; this third caller of the same adapter does not. Fix: branch on rc 7 here. Report that the launch brief's delivery is unconfirmed: the thread may already be working, so inspect thread $T, and if the brief is absent, resend only the identical brief text, which reuses the recorded request id within the hour. Keep the existing refusal message for every other nonzero status.

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Test** - 1 warning
  • ⚠️ live validation verdict: inconclusive (4 of 21 scenarios were driven live against the product); untested: Connect to T3 and verify capabilities and environment identity, Refuse an incompatible or wrong-environment server before mutation, Launch Claude and Codex workers in leased worktrees with their briefs and task environment, Launch a secondmate in its isolated home with its charter and supervision environment, Resume a failed secondmate on its existing thread and prevent replacement until closure is proved, Retire secondmates only after archive and physical shutdown, preserving their homes when shutdown cannot be proved, Surface questions once, answer by request identity, and keep permission approvals on T3's approval path, Discover supervisors across all pages while retaining forks, excluding subagents, and refusing ambiguity, Override effort while retaining unrelated options and refuse unsupported or mismatched configurations, Confirm only the interrupted run despite newer-run races and refuse exit or fresh-agent relaunch, Recover a lost send response without duplicate delivery while retaining the accepted message and run identities, Retry a frozen two-event digest after an hour-long outage and deliver a third event in the next generation exactly once, Wake on exact-run termination or pending requests, retain polling after failure, and bound uncertain or hung-turn deferral, Peek at the newest activity and accept a read limit of 100 while rejecting 101, Apply the Claude PR-tool workaround only before the verified version and execute all three PR tools safely, Preserve Herdr push notifications in mixed homes and existing busy checks for other backends, Lose a launch response and retain the lease and task record, report uncertainty, and never retry the brief automatically
  • Live validation: ⚠️ inconclusive - 4 of 21 scenarios driven live against the product
Scenario Result Live Evidence
Installing T3 leaves the default backend unchanged; explicit home configuration selects T3 ✅ pass live Backend selection and missing-credential refusals
Status and send without a credential refuse with an actionable sign-in instruction ✅ pass live Backend selection and missing-credential refusals
Codex retains its project model, exposes the injected task identity to shell commands, and restores configuration on cleanup ✅ pass live Live Codex configuration and shell environment
Installing the Codex environment through a symlink refuses without changing the target ✅ pass live Codex symlink refusal preserves the target file
Connect to T3 and verify capabilities and environment identity ⏸️ untested no No OAuth mcp-client credential was available in this worktree. Supply a valid credential for an isolated T3 server through FM_T3CODE_LIVE_TOKEN_FILE and rerun.
Refuse an incompatible or wrong-environment server before mutation ⏸️ untested no Live admission checks require an OAuth credential for an isolated T3 server. Supply it through --token-file.
Launch Claude and Codex workers in leased worktrees with their briefs and task environment ⏸️ untested no No OAuth credential was available to launch real T3 threads. Provide one for a disposable T3 environment using the existing provider logins.
Launch a secondmate in its isolated home with its charter and supervision environment ⏸️ untested no Real secondmate launch requires an OAuth credential for an isolated T3 server. Provide that credential and rerun in a disposable home.
Resume a failed secondmate on its existing thread and prevent replacement until closure is proved ⏸️ untested no No authenticated disposable T3 thread was available. Supply an isolated-server OAuth credential to exercise failed runs and refused or draining archives.
Retire secondmates only after archive and physical shutdown, preserving their homes when shutdown cannot be proved ⏸️ untested no The process checks used real owned processes, but T3 archive responses came from the fake server. An isolated-server OAuth credential is needed for the complete live lifecycle.
Surface questions once, answer by request identity, and keep permission approvals on T3's approval path ⏸️ untested no Generating real pending questions and approvals requires authenticated disposable T3 threads. Supply an isolated-server OAuth credential.
Discover supervisors across all pages while retaining forks, excluding subagents, and refusing ambiguity ⏸️ untested no No authenticated T3 catalog was available. Provide an isolated-server OAuth credential and disposable threads spanning multiple pages.
Override effort while retaining unrelated options and refuse unsupported or mismatched configurations ⏸️ untested no Reading the real provider catalog and launch configuration requires an isolated-server OAuth credential. Supply it through --token-file.
Confirm only the interrupted run despite newer-run races and refuse exit or fresh-agent relaunch ⏸️ untested no The authenticated T3 runtime check prevents reaching these controls without a credential. Supply one for disposable threads on an isolated server.
Recover a lost send response without duplicate delivery while retaining the accepted message and run identities ⏸️ untested no Live fault injection requires an OAuth credential and disposable T3 endpoint. Provide the credential so connection loss can be tested without affecting the real fleet.
Retry a frozen two-event digest after an hour-long outage and deliver a third event in the next generation exactly once ⏸️ untested no The outage and clock conditions were simulated against the fake server. An authenticated isolated T3 environment is required for live delivery verification.
Wake on exact-run termination or pending requests, retain polling after failure, and bound uncertain or hung-turn deferral ⏸️ untested no Real T3 events require an authenticated disposable thread. Supply an isolated-server OAuth credential.
Peek at the newest activity and accept a read limit of 100 while rejecting 101 ⏸️ untested no The helper checks authentication before the read-limit boundary. Supply an isolated-server OAuth credential and a disposable long thread.
Apply the Claude PR-tool workaround only before the verified version and execute all three PR tools safely ⏸️ untested no The live guard requires an isolated-server OAuth credential. Supply it and run tests/fm-backend-t3code-pr-tools-live-e2e.test.sh with FM_T3CODE_PR_TOOLS_LIVE=1 using the existing Claude login.
Preserve Herdr push notifications in mixed homes and existing busy checks for other backends ⏸️ untested no These were isolated simulated-backend checks. Complete live mixed-home verification needs an authenticated disposable T3 thread and a named Herdr lab provisioned through bin/fm-herdr-lab.sh.
Lose a launch response and retain the lease and task record, report uncertainty, and never retry the brief automatically ⏸️ untested no The previous false refusal was reproduced and the fix passed against the fake server. Real commit-then-disconnect verification requires an isolated-server OAuth credential.
  • t3 --version and node bin/fm-t3-mcp.mjs status
  • TMPDIR="$PWD/.test-phase-tmp" bash tests/fm-t3-mcp.test.sh
  • TMPDIR="$PWD/.test-phase-tmp" bash tests/fm-backend-t3code.test.sh; reached a temporary-home placement refusal after the earlier cases passed
  • TMPDIR=/tmp FM_TEST_ONLY=run_remaining bash tests/fm-backend-t3code.test.sh; reran the secondmate launch case and every remaining case successfully
  • TMPDIR="$PWD/.test-phase-tmp" bash tests/fm-supervision-events.test.sh
  • TMPDIR="$PWD/.test-phase-tmp" bash tests/fm-watch-inbox-meta.test.sh
  • bash tests/fm-backend-t3code-live-e2e.test.sh; skipped for missing credential
  • Ran test_uncertain_launch_message_keeps_task_record in a temporary source snapshot with the previous fm-spawn.sh; reproduced the expected false-refusal failure
  • Ran test_uncertain_launch_message_keeps_task_record against the target implementation and captured its unconfirmed-delivery message
  • Created and removed a marked disposable lab; exercised missing-credential status/send refusals and implicit versus explicit backend selection
  • Ran real codex app-server --stdio with isolated CODEX_HOME; exercised config/read, command/exec, and configuration cleanup
  • Ran bin/fm-t3code-codex-env.sh install through a symlink and verified refusal preserved the target bytes
  • Removed task-created worktree fixtures and confirmed git status --short was clean
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds experimental T3 Code runtime backend support.

The PR appears safe to merge based on the reviewed changes.

Reviews (15) · Last reviewed commit: "fix(t3code): load the composer library f..."

Comment thread bin/fm-spawn.sh Resolved
Comment thread bin/backends/t3code.sh Resolved
Comment thread bin/fm-spawn.sh Resolved
Comment thread bin/backends/t3code.sh Resolved
Comment thread bin/fm-spawn.sh Resolved
Comment thread bin/fm-spawn.sh Resolved
Comment thread bin/backends/t3code.sh Resolved
Comment thread bin/backends/t3code.sh Resolved
@greptile-apps

This comment has been minimized.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Verdict: Tip vs main 8f756bb reviewed. No closing issue link — does not close an issue. Adds T3 Code runtime backend with explicit selection (plus token/origin-gated auto-detect). Unconfigured homes keep existing backends — opt-in, not new-default.

VISION: aligns when opted in on captain-interface/authority/scripts/spine/scope; restart and fleet-outlives-vendor need tighter adapter bounds (see Greptile P1s).

Blockers: (1) attestation MISMATCH — body head_sha 9efec65c5ac9 vs HEAD 07182e6c0bd0; (2) Greptile P1s outstanding (worktree symlink path, default model instance mapping, Codex settings overwrite, unbounded HTTP client, uncertain thread.create abort path).

Attestation: MISMATCH. CI/NM: fork workflows action_required — not approved this pass (P1s outstanding). MERGEABLE/UNSTABLE. No auto-merge. Firstmate-flag no (not otherwise-ready). Cron FYI on Greptile P1 findings; not withhold/close.

Comment thread bin/backends/t3code.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate:

Verdict: Tip vs main 6af83310535b3d48b1d35bcc1597a0b7b98902d7. No closing issue. Tip adds experimental T3 Code backend selected explicitly only (tests assert no auto-detect even with bearer) — opt-in. Attestation now MATCH on head 38136394.

VISION.md (each rule)

  • One captain, one interface: aligns when opted in.
  • Authority is explicit and never inferred: aligns — explicit config/backend=t3code + bearer.
  • Scripts own the mechanics, agents own the judgment: aligns (adapter scripts).
  • A restart is a non-event: cannot tell until remaining Greptile P1s on lifecycle/probe are cleared.
  • Delegation with a spine: aligns when Treehouse lease + archive paths are solid.
  • The fleet outlives any vendor: aligns in intent (quarantined adapter) — still need bounded HTTP and reliable probe.
  • Scope: aligns as experimental harness adapter.

Blockers (waiting-author): Greptile still FAILURE with outstanding P1s including tip finding Live thread appears unreadable (bin/backends/t3code.sh ~362 — shell-snapshot failure discards successful detail). Earlier P1 themes (symlink escape, instance mapping, Codex settings, unbounded fetch, uncertain create abort, nightly/capability pins) need tip-line replies or remaining fixes. Security-tagged worktree symlink finding must stay addressed on tip.

Attestation: MATCH. CI/NM: fork workflows still action_required — not approved this pass (P1s outstanding). MERGEABLE/UNSTABLE. No auto-merge. Firstmate flag: no (not otherwise-ready). Cron FYI: Greptile P1s incl. prior security-tagged symlink path — stamp only, not withhold/close.

Comment thread bin/backends/t3code.sh Resolved
Comment thread bin/fm-supervise-daemon.sh Resolved
Comment thread bin/fm-supervise-daemon.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: whole thread re-read (prior stamps; body + attestation; Greptile now SUCCESS; author tip fixes after 38136394). Diff tip vs main 8690c411 re-checked on head 5a9364ce.

Verdict: waiting-ci · contract-class: opt-in · Firstmate flag: no · no closing issue

Tip vs main (own inspection):

  • Experimental T3 Code backend; tests/docs assert explicit config/backend=t3code only (no auto-detect). Unconfigured homes keep existing backends — opt-in.
  • Since prior stamp: tip fixes probe/liveness/unknown-busy stale-marker paths (444064c8…5a9364ce). Greptile check SUCCESS; only open thread is non-blocking P2 (repeated stale alerts under prolonged unknown).

VISION.md per-rule:

  • One captain, one interface: aligns when opted in.
  • Authority explicit never inferred: aligns — explicit backend + bearer.
  • Scripts vs agents: aligns (adapter scripts).
  • A restart is a non-event: aligns better on tip (bounded HTTP, retain lease on uncertain create, preserve detail when shell-snapshot fails).
  • Delegation with a spine: aligns (Treehouse lease / archive paths).
  • Fleet outlives any vendor: aligns — quarantined adapter; V2 refused; version pin.
  • Scope: aligns as experimental harness adapter.

Attestation: MATCH 5a9364ce. CI/NM: fork workflows approved this pass (CI 36953644250, Require no-mistakes 36953644298) — was action_required; now running. Prior security-tagged worktree symlink P1 addressed on tip (author reply + a487f917 hardening). Greptile: SUCCESS (P2 only). MERGEABLE/UNSTABLE. No auto-merge until CI/NM green on this head.

@bryceeppler bryceeppler changed the title feat(backends): add T3 Code runtime backend feat: add experimental T3 Code runtime backend Oct 2, 2026
Comment thread bin/fm-supervise-daemon.sh Resolved
@bryceeppler bryceeppler changed the title feat: add experimental T3 Code runtime backend feat(backends): add experimental T3 Code runtime support Oct 2, 2026
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.
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.
…n 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.
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.
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.
@arthurcruzd

Copy link
Copy Markdown
Contributor

@bryceeppler, a heads-up on the transport, with an offer.

T3's Orchestrator V2 (pingdotgg/t3code#2829) removed POST /api/orchestration/dispatch. On the current T3 nightly (0.0.46), that route returns 404 and its string is gone from the binary. This PR's adapter at 2d30a46c writes through it (fm_backend_t3code_api POST /api/orchestration/dispatch), so the backend stops working once 0.0.46 becomes the stable release. Your version pin keeps that failure clean, but it leaves no supported version after that.

V2's supported write path is the orchestration MCP endpoint at /mcp, signed in as an OAuth mcp-client. I ran Firstmate's non-terminal backend contract against it on a local 0.0.46 nightly, with Claude and Codex threads. These all held:

  • launch into an existing Treehouse-style worktree
  • send, and steer mid-turn
  • bounded read
  • an event-driven turn-end wait
  • confirmed interrupt
  • archive
  • ids and context surviving a T3 restart
  • a real fm-brief.sh brief end to end, including status lines and an inbox doorbell steer

The evidence, the tool-by-tool mapping and the gaps are in #6904.

If it helps, I can contribute to this PR rather than open a competing one:

  • a dependency-free .mjs MCP client with headless OAuth/PKCE sign-in (one-time pairing code, scopes orchestration:read orchestration:operate, mode-0600 token storage, re-mint before the 30-day expiry because there is no refresh grant)
  • a tools/list capability gate that pins environmentId and replaces the dispatch probe
  • the busy/turn-end/interrupt/archive mapping onto the t3_thread_* tools

Most of your Firstmate-side wiring (lease, proven close, explicit selection, per-harness env) should carry over unchanged. Let me know whether you'd like that as a PR against your branch.

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 kunchenguid#6904
@arthurcruzd

Copy link
Copy Markdown
Contributor

Opened bryceeppler#5 against this branch: it moves the t3code backend onto T3 Orchestrator V2's /mcp OAuth transport (dispatch is gone in the 0.0.46 nightly), keeping your wiring and names, and carries Fixes #6904. Merge it into t3code-backend or cherry-pick whatever fits.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate (OSS triage, not the captain).

Thanks @bryceeppler. I re-read the thread since my 2026-10-05 stamp and reviewed head 2d30a46c (attestation MATCH) against main 19fcbbde. The branch is behind main but still MERGEABLE.

Since the last stamp: both items from that pass are addressed in your own commits.

  • 32881710: wedge_defer_t3code_running now defers only while the thread's latest turn boundary is younger than BUSY_TURN_MAX_SECS, and it never defers on a missing timestamp. That bounds the Greptile P1 ("Running status hides hung turns").
  • 6237559b: inbox_steer_check uses window_is_busy again for every backend except T3 Code, and tests/fm-watch-inbox-meta.test.sh pins the targetless and recorded cases. The non-T3 path matches main again.
  • 074cfb12, 7728f8c2, 320c4695, 2d30a46c: docs, plus loading fm-composer-lib.sh in the T3 adapter for the shared submit dispatcher.

Contract-class: opt-in (unchanged). T3 Code is chosen only with an explicit config/backend=t3code and a bearer token. Unconfigured homes keep their existing backends, and I re-checked that the shared inbox path is back to main's behavior for non-T3 backends.

VISION.md, rule by rule: One captain, one interface (aligns when opted in). Authority explicit (aligns: explicit selection and bearer). Scripts own the mechanics (aligns: adapter scripts). Restart a non-event (aligns: lease kept on uncertain create, bounded HTTP). Delegation with a spine (aligns). Fleet outlives any vendor (aligns, with a vendor note below). Scope (aligns: experimental harness adapter).

Vendor note (FYI, not a blocker here): @arthurcruzd reports that T3's Orchestrator V2 (0.0.46 nightly) removes POST /api/orchestration/dispatch, which this adapter writes through. He opened bryceeppler#5 against your branch to move to the /mcp OAuth transport (#6904). The version pin keeps today's failure clean. Whether to fold that in before or after this lands is up to you. If you merge it into this branch, it's a new head and gets a fresh review here.

Fork CI: this head's runs were sitting in action_required. I reviewed the author-commit delta since 63d9068b first: no .github/workflows/*, no secrets, and no new network surface beyond the existing T3 HTTP adapter. Then I approved CI 37695768998 and Require no-mistakes 37695769433.

Outcome: waiting-ci. If CI and no-mistakes go green on this head and it stays mergeable, this is an opt-in auto-merge candidate on a later pass.

@bryceeppler
bryceeppler marked this pull request as draft October 10, 2026 17:01
@bryceeppler

Copy link
Copy Markdown
Contributor Author

Thanks @kunchenguid for the re-review and for approving the fork CI runs, and thanks @arthurcruzd for bryceeppler#5 and the heads-up on Orchestrator V2.

Since T3's Orchestrator V2 (pingdotgg/t3code#2829) is already merged on T3's main and removes POST /api/orchestration/dispatch, this adapter will stop working as soon as 0.0.46 reaches stable.
Landing it now would ship a backend with a short shelf life, so I've moved this PR back to draft and am pausing it until V2 is out on T3 stable.
Please don't merge anything from this branch upstream in the meantime.

Plan from here:

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @bryceeppler, that's a sensible call, and thanks for saying it plainly. Noted: this is back in draft and paused until T3's Orchestrator V2 reaches stable, and nothing from this branch should be merged in the meantime. Triage will not merge it.

Head is unchanged at 2d30a46c. CI and no-mistakes are green, apart from one cancelled serial shard. My last verdict stands: contract-class opt-in (only with an explicit config/backend=t3code plus a bearer token), and every VISION.md rule aligns. The vendor note is now the reason for the pause.

Next step: waiting on you. When you push the V2 rework (built on bryceeppler#5, re-verified live against stable T3) and mark it ready, it gets a fresh review here. No rush. The 14-day contributor clock applies while it is paused, so a short status note every couple of weeks keeps it open.

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.
@bryceeppler bryceeppler changed the title feat: add experimental T3 Code runtime backend feat: add experimental T3 Code Orchestrator V2 backend Oct 10, 2026
- 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.
@bryceeppler bryceeppler changed the title feat: add experimental T3 Code Orchestrator V2 backend feat: add experimental T3 Code runtime backend Oct 10, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @bryceeppler for the V2 rework push (053f9a41: /mcp transport, live Linux fixes, merged main). It's still draft and the body still says it's paused until Orchestrator V2 ships in a stable T3, so the hold stands. Triage will not merge this.

I read the new diff for CI safety: it doesn't touch .github/, and it adds no secret or credential use in CI. The new fm-t3-mcp.mjs only talks to the configured T3 origin, keeps its token at 0600, and reads the local T3 listener's environment only to detect the telemetry flag. So I've approved the fork CI and no-mistakes runs for this head (38090723262, 38090723094) to give you early signal.

When you mark it ready, it gets a full fresh review. This rework now also edits default-path files (herdr.sh, fm-supervise-daemon.sh, fm-control.sh, fm-spawn.sh, the opencode watch plugin), so I'll re-check that homes without config/backend=t3code are unchanged before I re-confirm the earlier opt-in class.

Status: waiting on you, the author (draft hold until V2 is stable). No rush.

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.
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @bryceeppler for the follow-up commits (ba37da61..6049a5f1: the secondmate close refusal is now limited to T3 threads, lost launch-brief replies are reported as unconfirmed with the task record kept, and the docs and recovery guidance are corrected).

It's still a draft, and the body still says it's paused until Orchestrator V2 ships in a stable T3 release, so the hold stands. Triage will not merge this.

I read the delta for CI safety: no .github/ changes, and no new secret, credential, or network use. I approved this head's fork CI and no-mistakes runs for early signal.

When you mark it ready, it gets a full fresh review, including a check that homes without config/backend=t3code are unchanged before I re-confirm the earlier opt-in class.

Status: waiting on you, the author (draft hold until V2 is stable). No rush.

@arthurcruzd

Copy link
Copy Markdown
Contributor

Heads-up for the hold in the PR body: T3 Code Orchestrator V2 shipped on the stable channel yesterday as v0.1.0 (https://github.com/pingdotgg/t3code/releases/tag/v0.1.0).

Field report in case it helps: our fleet has run on a fork of this backend since 2026-10-09 (the primary as a T3 thread, four remote second mates on their own machines' T3 servers, and ship/scout workers), and today we moved our VPS and Mac T3 servers from nightly 0.0.46 to stable v0.1.0 with no backend changes needed so far.

One design difference worth raising before anything else: this PR refuses exit and relaunch on t3code and reads an archived thread as missing. In our fork we implemented native exit (interrupt, then archive) and relaunch (resume the same thread, or open a new thread in the same worktree), and read an archived thread as dead. If that direction fits the project, we'd be glad to offer it as a follow-up on top of this PR rather than diverging.

@bryceeppler

Copy link
Copy Markdown
Contributor Author

Heads-up for the hold in the PR body: T3 Code Orchestrator V2 shipped on the stable channel yesterday as v0.1.0 (https://github.com/pingdotgg/t3code/releases/tag/v0.1.0).

Field report in case it helps: our fleet has run on a fork of this backend since 2026-10-09 (the primary as a T3 thread, four remote second mates on their own machines' T3 servers, and ship/scout workers), and today we moved our VPS and Mac T3 servers from nightly 0.0.46 to stable v0.1.0 with no backend changes needed so far.

One design difference worth raising before anything else: this PR refuses exit and relaunch on t3code and reads an archived thread as missing. In our fork we implemented native exit (interrupt, then archive) and relaunch (resume the same thread, or open a new thread in the same worktree), and read an archived thread as dead. If that direction fits the project, we'd be glad to offer it as a follow-up on top of this PR rather than diverging.

I won't be upkeeping this PR, feel free to continue the work from here.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @bryceeppler for all the work on this and for saying so plainly. Understood, you're stepping away from this branch. And thanks @arthurcruzd for the heads-up that T3 Orchestrator V2 is now stable (v0.1.0), and for the field report.

Where this PR stands on head 6049a5f1: it's still a draft, it conflicts with main, and Lint 1 is failing. Triage won't merge it in this state. Without an author keeping the branch up, the 14-day contributor-stale rule will close it about two weeks after the last author activity.

If someone wants to carry it forward (@arthurcruzd, you offered), please open a successor PR from your own branch with these changes:

  1. Keep @bryceeppler's (and the feat(t3code): move the backend onto T3 Orchestrator V2's /mcp transport bryceeppler/firstmate#5) commits intact so authorship is preserved, and rebase onto current main.
  2. Fix the lint failure.
  3. Raise it through git push no-mistakes so the attestation binds to the new head.
  4. Live-test against stable T3 v0.1.0 and post the evidence in the PR.
  5. Mark it ready, not draft.

Once that successor is open, I'll close this one as superseded and point here.

A successor gets a full fresh review. That includes confirming that homes without config/backend=t3code are unchanged, because the rework edits default-path files (herdr.sh, fm-supervise-daemon.sh, fm-control.sh, fm-spawn.sh, the opencode plugin). Until that check is done I'm not re-confirming the earlier opt-in class. Your native exit/relaunch direction (interrupt then archive; resume or new thread) is a behavior choice that would be judged on its own in that review. Keeping it as a separate follow-up, as you suggested, would keep each review clean.

Status: waiting on an author, either a successor PR or someone picking this branch back up. Nothing from this branch merges as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants