Skip to content

test: isolate real-Rex suites on private servers - #7649

Merged
kunchenguid merged 3 commits into
mainfrom
fm/fm-rex-test-private-server
Oct 22, 2026
Merged

kunchenguid merged 3 commits into
mainfrom
fm/fm-rex-test-private-server

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

Intent

The real-Rex tests should create their own test-only Rex server on the fly, like the Herdr lab, instead of running against the live Rex server the user is working in. Context: Firstmate's Rex session backend landed in #7633 and #7639. The current real-Rex smoke test (tests/fm-backend-rex-smoke.test.sh) never starts a server: it requires an already reachable Rex server (the user's live one) and protects it only with a forwarding guard that limits state changes to sessions the test created. A rex link at ~/.local/bin/rex now makes the CLI reachable from the no-mistakes review pipeline, so without this change pipeline live validation (including a planned server-stop scenario) would hit the user's live Rex. Rex supports a throwaway server directly: rex server run --listen --state-dir

--config --exit-empty, with clients pointed at it through REX_SERVER or -S.

What Changed

  • Start and clean up private Rex servers with temporary sockets, state directories, and configs for real-Rex smoke, event-wait, composer, and AFK tests.
  • Add server stop/restart coverage for passive reads without autostart and reclaim after session loss; distinguish missing-tool skips from setup failures.
  • Update contributor and backend documentation to describe private-server isolation and mark historical personal-server evidence.

Risk Assessment

✅ Low: The changes are bounded to test-server isolation and documentation, with explicit private routing and cleanup and no substantiated remaining defects.

Testing

Exercised private-server lifecycle, stop/recovery, event delivery, routing guards, interruption cleanup, AFK topology, and Claude composer behavior. Initial capped exploratory runs timed out; focused isolation and extended AFK reruns passed. CLI transcripts were captured; no UI-facing code changed. No full suite, lint, or static analysis ran.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Run smoke tests on a newly created private server, then stop and recover it ✅ pass live rex-smoke.log
Receive real blocked and endpoint-gone events through the private server ✅ pass live rex-eventwait.log
Ignore an inherited server endpoint and reject mutations of unowned sessions ✅ pass live rex-isolation-final.log
Fail private-server startup without falling back to a reachable inherited server ✅ pass live rex-isolation-final.log
Interrupt preparation during readiness polling without leaking the server or state ✅ pass live rex-interruption.log
Start and stop an AFK terminal without changing the captain's Rex topology ✅ pass live rex-afk-trace.log
Launch real Claude idle on the private server and classify its composer ✅ pass live rex-composer-claude.log
Evidence: Private-server smoke and recovery

Source: Private-server smoke and recovery

ok - real rex: created the test's own session session:01a164a9-e1b5-76be-b551-7d80835d2cc1
ok - real rex: a Rex-hosted launcher gets a focus-safe 200x50 tab in its own session; duplicates are refused
ok - real rex: line submit, capture, and a derived viewport of exactly size.rows lines; literal and every mapped key send
ok - real rex: current_path follows a nested shell; agent_state reads dead at a shell, ambiguous under another program
ok - real rex: OSC 7501 records from the foreground shell drive busy_state
ok - real rex: kill closes exactly the task tab and the recorded server proves it gone
ok - real rex: relaunch reclaim opens a tab in the exact session, and a gone session returns 2 creating nothing
ok - real rex: all state-changing calls stayed within this run's private server
ok - real rex: passive reads disable autostart and do not start a stopped server
ok - real rex: after server restart, the recorded session is gone and reclaim creates nothing
Evidence: Real Rex event transitions

Source: Real Rex event transitions

ok - real rex: the push capability gate passes without starting a server
ok - real rex: a driven blocked edge returns its record, with Rex's kind and message, 192ms after the report was sent
ok - real rex: the watcher fast path enqueues a stale wake carrying Rex's blocked kind and message
ok - real rex: an escalated block is not re-delivered and the reader runs its whole budget (2104ms for 2s)
ok - real rex: closing a watched block ends the wait 153ms later for an immediate poll
ok - real rex: a reader that cannot start returns 2 and the watcher falls back to polling
ok - real rex: all state-changing calls stayed within this run's private server
Evidence: Routing isolation and fail-closed startup

Source: Routing isolation and fail-closed startup

Disposable sentinel endpoint: unix:///private/tmp/fm-rex-test.ohcQJF/rex.sock
Sentinel session: session:01a164b0-6b6e-7f2a-a519-0da42ee01b99
not ok - private Rex server failed to start; see ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/.rex-validation/fm-rex-test.C25Jv3/server.log
PASS: real startup error failed closed (2), cleaned scratch, and did not fall back to reachable inherited server
Nested endpoint: unix:///private/tmp/fm-rex-test.07CeKW/rex.sock
session:01a164b0-6e82-79ee-8fe1-ade09dfbf487 block:01a164b0-6e82-7b08-9307-26d4dc1382f7
Nested restart: no persisted sessions
PASS: nested helper ignored inherited REX_SERVER; sentinel remained byte-identical and reachable after private stop/restart
fm-rex-test guard: refused kill session:01a164b0-73d9-7119-b766-198fd25feb22
PASS: guard refused kill of unowned session (97); real session still exists
PASS: cleanup removed owned state and terminated the private server
Evidence: Startup interruption cleanup

Source: Startup interruption cleanup

Real server during readiness: ~/.local/bin/rex --autostart=false server run --listen unix:///private/tmp/fm-rex-test.7Kbquq/rex.sock --state-dir /private/tmp/fm-rex-test.7Kbquq/server-state --config /private/tmp/fm-rex-test.7Kbquq/rex-config.lua --exit-empty
Interrupted suite exit: -15
PASS: readiness interruption terminated owned real server
PASS: readiness interruption removed owned scratch directory
Evidence: Rex AFK lifecycle trace

Source: Rex AFK lifecycle trace

+ set -u
+++ dirname tests/.rex-afk-targeted.sh
++ cd tests/..
++ pwd
+ ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
+ LAUNCH=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-afk-launch.sh
+ START=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-afk-start.sh
+ CONTRACT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-afk-contract.sh
+ unset PI_CODING_AGENT FM_PI_HARNESS CURSOR_AGENT CURSOR_INVOKED_AS GEMINI_CLI ATLASSIAN_AGENT_TYPE ROVODEV_CLI
+ export CLAUDECODE=1 FM_TEST_HARNESS=claude FM_TEST_SEAM=1
+ CLAUDECODE=1
+ FM_TEST_HARNESS=claude
+ FM_TEST_SEAM=1
++ mktemp -d /tmp/fm-afk-off-config.XXXXXX
+ OFF_CONFIG=/tmp/fm-afk-off-config.q3iK89
+ :
+ export FM_CONFIG_OVERRIDE=/tmp/fm-afk-off-config.q3iK89
+ FM_CONFIG_OVERRIDE=/tmp/fm-afk-off-config.q3iK89
+ FAILED=0
++ mktemp /tmp/fm-afk-sleeper.XXXXXX
+ SLEEPER=/tmp/fm-afk-sleeper.AWEnfa
+ printf '#!/usr/bin/env bash\nexec sleep 600\n'
+ chmod +x /tmp/fm-afk-sleeper.AWEnfa
+ TRACK_TMUX_SESSIONS=
+ trap GLOBAL_CLEANUP EXIT
+ QUIET_MIRROR='{"seq":1,"key":"k","tag":"captain","text":"watch the fleet"}'
+ e2e_rex
+ local home_tmp out cap_sid cap_bid cap_target before during after rec_backend rec_target rec_sid label rc
+ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/tests/rex-test-safety.sh
++ set -u
++++ dirname ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/tests/rex-test-safety.sh
+++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/tests/..
+++ pwd
++ REX_TEST_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ REX_TEST_WORK=
++ REX_TEST_REAL=
++ REX_TEST_BEFORE=
++ REX_TEST_CLEANED=
++ REX_TEST_SERVER_PID=
++ REX_TEST_ENDPOINT=
+ rex_test_prepare
+ unset REX_SESSION REX_BLOCK REX_SERVER
+ export TERM_PROGRAM=fm-test
+ TERM_PROGRAM=fm-test
+ command -v jq
+ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
++ FM_BACKEND_SCRIPT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
++++ dirname ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
+++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin
+++ pwd
++ FM_BACKEND_LIB_DIR=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin
++ unset FM_BACKEND_SCRIPT
+++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/..
+++ pwd
++ FM_BACKEND_DEFAULT_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ FM_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ FM_HOME=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ FM_BACKEND_CONFIG_DIR=/tmp/fm-afk-off-config.q3iK89
++ FM_BACKEND_KNOWN='tmux herdr zellij orca cmux paseo rex'
++ FM_BACKEND_SPAWN='tmux herdr zellij orca cmux paseo rex'
++ FM_BACKEND_CMUX_BUNDLE_ID=com.cmuxterm.app
++ FM_BACKEND_VISIBLE_CAPTURE='tmux herdr zellij rex'
+ fm_backend_source rex
+ local name=rex adapter rel sibling
+ fm_backend_validate rex
+ local name=rex
+ fm_backend_is_known rex
+ fm_backend_list_contains 'tmux herdr zellij orca cmux paseo rex' rex
+ local 'list=tmux herdr zellij orca cmux paseo rex' name=rex
+ case "$name" in
+ case " $list " in
+ return 0
+ return 0
+ adapter=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
+ case "$name" in
+ set -- fm-backend-hometag-lib.sh fm-composer-lib.sh fm-agent-process-lib.sh fm-session-lock-lib.sh fm-gemini-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh ']'
+ for rel in "$@"
+ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh ']'
+ for rel in "$@"
+ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh ']'
+ for rel in "$@"
+ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh ']'
+ for rel in "$@"
+ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
+ for rel in "$@"
+ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
+ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
+ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
+ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
+ case "$name" in
+ '[' -z '' ']'
+ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
++++ dirname ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
+++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/../..
+++ pwd
++ FM_BACKEND_REX_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ FM_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ FM_HOME=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
++ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh
+++ FM_BACKEND_HOMETAG_SECONDMATE_MARKER=.fm-secondmate-home
++ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh
+++ FM_COMPOSER_UNICODE_SPACES=()
+++ for _fm_composer_space_octal in '\0302\0205' '\0302\0240' '\0341\0232\0200' '\0342\0200\0200' '\0342\0200\0201' '\0342\0200\0202' '\0342\0200\0203' '\0342\0200\0204' '\0342\0200\0205' '\0342\0200\0206' '\0342\0200\0207' '\0342\0200\0210' '\0342\0200\0211' '\0342\0200\0212' '\0342\0200\0250' '\0342\0200\0251' '\0342\0200\0257' '\0342\0201\0237' '\0343\0200\0200'
+++ printf -v _fm_composer_space_utf8 %b '\0302\0205'
+++ FM_COMPOSER_UNICODE_SPACES+=("$_fm_composer_space_utf8")
+++ for _fm_composer_space_octal in '\0302\0205' '\0302\0240' '\0341\0232\0200' '\0342\0200\0200' '\0342\0200\0201' '\0342\0200\

... [46587 bytes truncated] ...

session-lock-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
++ case "$name" in
++ '[' -z 1 ']'
++ fm_backend_rex_session_view session:01a164af-a7a6-711d-9766-3b13d1c83262
++ fm_backend_rex_read api call -s session:01a164af-a7a6-711d-9766-3b13d1c83262 session.view
+ l=
+ case "$l" in
+ rex_e2e_kill_test_session session:01a164af-a455-764d-9b9e-c91a229c0381
+ local l
++ jq -r '.label // empty'
++ rex_e2e fm_backend_rex_session_view session:01a164af-a455-764d-9b9e-c91a229c0381
++ unset REX_SESSION REX_BLOCK
++ . ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
+++ FM_BACKEND_SCRIPT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
+++++ dirname ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend.sh
++++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin
++++ pwd
+++ FM_BACKEND_LIB_DIR=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin
+++ unset FM_BACKEND_SCRIPT
++++ cd ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/..
++++ pwd
+++ FM_BACKEND_DEFAULT_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
+++ FM_ROOT=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G
+++ FM_HOME=/private/tmp/fm-rex-test.byaYIF/home
+++ FM_BACKEND_CONFIG_DIR=/tmp/fm-afk-off-config.q3iK89
+++ FM_BACKEND_KNOWN='tmux herdr zellij orca cmux paseo rex'
+++ FM_BACKEND_SPAWN='tmux herdr zellij orca cmux paseo rex'
+++ FM_BACKEND_CMUX_BUNDLE_ID=com.cmuxterm.app
+++ FM_BACKEND_VISIBLE_CAPTURE='tmux herdr zellij rex'
++ fm_backend_source rex
++ local name=rex adapter rel sibling
++ fm_backend_validate rex
++ local name=rex
++ fm_backend_is_known rex
++ fm_backend_list_contains 'tmux herdr zellij orca cmux paseo rex' rex
++ local 'list=tmux herdr zellij orca cmux paseo rex' name=rex
++ case "$name" in
++ case " $list " in
++ return 0
++ return 0
++ adapter=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
++ case "$name" in
++ set -- fm-backend-hometag-lib.sh fm-composer-lib.sh fm-agent-process-lib.sh fm-session-lock-lib.sh fm-gemini-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/backends/rex.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-backend-hometag-lib.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-composer-lib.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-agent-process-lib.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-session-lock-lib.sh ']'
++ for rel in "$@"
++ sibling=~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
++ fm_backend_source_readable ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh
++ '[' -f ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
++ '[' -r ~/.no-mistakes/worktrees/016d88035d58/01M5JA9A65YZTDHAZYVVJGGM9G/bin/fm-gemini-lib.sh ']'
++ case "$name" in
++ '[' -z 1 ']'
++ fm_backend_rex_session_view session:01a164af-a455-764d-9b9e-c91a229c0381
++ fm_backend_rex_read api call -s session:01a164af-a455-764d-9b9e-c91a229c0381 session.view
+ l=fm-test-afk-cap-53103
+ case "$l" in
+ rex_e2e fm_backend_rex_cli kill session:01a164af-a455-764d-9b9e-c91a229c0381
+ rex_test_assert_isolated
+ local after
+ '[' '!' -s /private/tmp/fm-rex-test.byaYIF/tripwire ']'
++ rex_test_foreign_snapshot
++ local sid
++ rex_test_cli ls --json
++ ~/.local/bin/rex --autostart=false -S unix:///private/tmp/fm-rex-test.byaYIF/rex.sock ls --json
++ jq -r '.sessions[].session_id'
++ sort
++ IFS=
++ read -r sid
+ after=
+ '[' '' = '' ']'
+ pass 'real rex: all state-changing calls stayed within this run'\''s private server'
+ printf 'ok - %s\n' 'real rex: all state-changing calls stayed within this run'\''s private server'
ok - real rex: all state-changing calls stayed within this run's private server
+ rex_test_cleanup
+ local sid label
+ '[' -z '' ']'
+ REX_TEST_CLEANED=1
+ '[' -n /private/tmp/fm-rex-test.byaYIF ']'
+ IFS=
+ read -r sid
+ '[' -n session:01a164af-a455-764d-9b9e-c91a229c0381 ']'
++ rex_test_cli api call -s session:01a164af-a455-764d-9b9e-c91a229c0381 session.view
++ jq -r '.label // empty'
+ label=
+ case "$label" in
+ IFS=
+ read -r sid
+ '[' -n session:01a164af-a455-764d-9b9e-c91a229c0381 ']'
++ rex_test_cli api call -s session:01a164af-a455-764d-9b9e-c91a229c0381 session.view
++ jq -r '.label // empty'
+ label=
+ case "$label" in
+ IFS=
+ read -r sid
+ '[' -n session:01a164af-a7a6-711d-9766-3b13d1c83262 ']'
++ rex_test_cli api call -s session:01a164af-a7a6-711d-9766-3b13d1c83262 session.view
++ jq -r '.label // empty'
+ label=
+ case "$label" in
+ IFS=
+ read -r sid
+ '[' -n session:01a164af-a7a6-711d-9766-3b13d1c83262 ']'
++ rex_test_cli api call -s session:01a164af-a7a6-711d-9766-3b13d1c83262 session.view
++ jq -r '.label // empty'
+ label=
+ case "$label" in
+ IFS=
+ read -r sid
+ rex_test_stop_server
+ '[' -n 53218 ']'
+ kill 53218
+ wait 53218
+ REX_TEST_SERVER_PID=
+ rm -rf /private/tmp/fm-rex-test.byaYIF
+ rm -rf /tmp/fm-afk-rex-home.U3DBbS
+ '[' 0 -eq 0 ']'
+ GLOBAL_CLEANUP
+ declare -F rex_test_cleanup
+ rex_test_cleanup
+ local sid label
+ '[' -z 1 ']'
+ return 0
+ rm -f /tmp/fm-afk-sleeper.AWEnfa
+ rm -rf /tmp/fm-afk-off-config.q3iK89
+ local s
Evidence: Real Claude composer on private Rex

Source: Real Claude composer on private Rex

ok - claude (2.1.308 (Claude Code)): real idle composer classifies empty on rex
ok - claude (2.1.308 (Claude Code)): the same idle screen read cursorless is not pending (verdict: empty)
ok - real rex: all state-changing calls stayed within this run's private server

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ tests/rex-test-safety.sh:35 - The private server starts before the standalone suites install their EXIT cleanup traps. Interrupting preparation during readiness polling leaves temporary data and potentially the server behind. Affected callers: tests/fm-backend-rex-smoke.test.sh:20–21, tests/fm-backend-rex-eventwait-smoke.test.sh:24–25, and tests/fm-backend-rex-composer-live-e2e.test.sh:45–46. Register cleanup before calling rex_test_prepare so startup interruptions also release owned resources.
  • ⚠️ tests/fm-backend-rex-smoke.test.sh:117 - The new stop/restart checks can pass without proving their claimed adapter behavior. The guard forces --autostart=false at tests/rex-test-safety.sh:121, so removing the adapter's passive-read protection would still pass this assertion. Also, the restarted-server absence check at tests/fm-backend-rex-smoke.test.sh:122 uses T, which was already killed at line 94; it cannot demonstrate disappearance caused by server shutdown. Detect passive calls that omit autostart protection while retaining private routing, and use an endpoint confirmed present immediately before stopping the server.

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

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 7 of 7 scenarios driven live against the product
Scenario Result Live Evidence
Run smoke tests on a newly created private server, then stop and recover it ✅ pass live rex-smoke.log
Receive real blocked and endpoint-gone events through the private server ✅ pass live rex-eventwait.log
Ignore an inherited server endpoint and reject mutations of unowned sessions ✅ pass live rex-isolation-final.log
Fail private-server startup without falling back to a reachable inherited server ✅ pass live rex-isolation-final.log
Interrupt preparation during readiness polling without leaking the server or state ✅ pass live rex-interruption.log
Start and stop an AFK terminal without changing the captain's Rex topology ✅ pass live rex-afk-trace.log
Launch real Claude idle on the private server and classify its composer ✅ pass live rex-composer-claude.log
  • rex --autostart=false version confirmed API revision 5.
  • bash tests/fm-backend-rex-smoke.test.sh with inherited fleet-path overrides cleared.
  • bash tests/fm-backend-rex-eventwait-smoke.test.sh with inherited fleet-path overrides cleared.
  • Focused execution of e2e_rex from tests/fm-afk-launch.test.sh; extended-timeout retry passed.
  • Focused execution of check_harness_idle_empty claude claude with FM_REX_COMPOSER_LIVE=1.
  • bash .rex-validation/isolation.sh: two disposable real servers, inherited-endpoint isolation, startup failure, unowned-session refusal, and cleanup.
  • python3 .rex-validation/lifecycle.py: SIGTERM during readiness polling against a real Rex server.
  • Removed transient drivers and verified a clean worktree and no remaining test-server processes.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.