Skip to content

fix: preserve lane ids in tmux pane titles - #18

Merged
pearson-tfl merged 4 commits into
mainfrom
fm/ahrfmname
Nov 6, 2026
Merged

pearson-tfl merged 4 commits into
mainfrom
fm/ahrfmname

Conversation

@pearson-tfl

@pearson-tfl pearson-tfl commented Nov 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add shell-quoted --name <lane-id> to the shared Claude launch, covering workers and secondmates, fresh launches and exact-session resumes.
  • In the shared tmux launch path, resolve the lane's stable window to a pane id, set that pane's allow-set-title off, and set its title to the lane id before starting any harness, including Pi.
  • Use claude --name main in the README's primary launch example.
  • Extend launch-command regressions and update custom tmux fixtures to answer the new pane-id query without changing their existing lifecycle behavior.

Both tmux mutations address a %<id> pane, never a window name or pane index.
Invalid pane identity or failed title setup stops before the harness launches.
Window names, other harness launch arguments, non-tmux backends, existing running panes, and AHR's CTX ledger hook are unchanged.
The separate AHR main-seat launcher was reported by Firstmate to already use --name firstmate; this PR does not edit that external launcher.
This PR targets pearson-tfl/firstmate:main only and must not be redirected to kunchenguid/firstmate.
Do not merge automatically.

Live Mac proof

Date: 2026-11-06.
Versions: tmux 3.7b, Claude Code 2.1.319, Pi 1.2.0.
All proof used a private task-owned tmux socket and disposable scratch panes, not existing fleet panes.
Claude used the generated launch shape with hooks, tools, skills and MCP disabled for the proof; Pi likewise disabled tools, extensions and context discovery.

Scratch pane Before protection After protection and a completed prompt
Claude Johns-Mac-Studio before launch; with --name ahrfmname-claude and application titles enabled, ✳ ahrfmname-claude after LANE_TITLE_PROOF_OK exactly ahrfmname-claude, allow-set-title off; replied PINNED_CLAUDE_OK
Pi π - ahrfmname with application titles enabled exactly ahrfmname-pi, allow-set-title off; replied PI_TITLE_PROOF_OK

The title read-back used:

tmux -S "$SOCKET" set-option -p -t "$PANE" allow-set-title off
tmux -S "$SOCKET" select-pane -t "$PANE" -T "$LANE"
tmux -S "$SOCKET" display-message -p -t "$PANE" '#{pane_title}'

A same-window sibling isolation check also passed: a protected shell kept ahrfmname-osc after emitting printf '\033]0;application-overwrite\007', while its unprotected sibling accepted application-overwrite and retained allow-set-title on.
The private scratch server was stopped after captures were archived.
The active verification record is in docs/verification/runtime-backends.md.

Validation

Repository: pearson-tfl/firstmate, branch: fm/ahrfmname, final head: fa5e8f7d5a5811a5ca0dc27de2e63b4627535d55.
The live measurements used the matching production patch on base commit 33220962c90bc29de83e87af8e78f49b6b9a6c65, subsequently committed unchanged as f1d46c1e88132e9dd033163e0ab5dab85062b259.
The core launch/loadout suite started at that implementation commit; its production and test files are byte-identical at final head.
The 13 passing fixture compatibility suites use c40571676df4c4c61b4d2294abfbefbb17eb383c, with their selected files byte-identical at final head.
The secondmate suite initially exposed legacy command expectations; those are corrected and rerun alongside the Orca suite at final head.
The ledger suite uses 33621dee2311b8084abacc743ad523729642a067, with the tested files unchanged at final head.
Final lint and documentation checks use final head.

  • PASS: bash bin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.sh tests/fm-spawn-loadout.test.sh (2 suites).
  • PASS: bash bin/fm-test-run.sh tests/fm-fleet-ledger.test.sh.
  • PASS: bash bin/fm-lint.sh with pinned ShellCheck 0.11.0 and actionlint 1.7.12.
  • PASS: bash bin/fm-doc-audience-check.sh.
  • PASS: git diff --check.
  • PASS: 13 custom-fixture compatibility suites: backend selection, backlog atomicity, control relaunch, Kimi, Kiro, Muse, Polytoken, project capacity, Rovo, compact-adviser launch, pool base freshening, worktree settling, and trace-context spawn.
  • PASS: shared test-fixture suite (tests/fm-test-fixtures.test.sh).
  • PASS: corrected tests/fm-secondmate-harness.test.sh and tests/fm-backend-orca.test.sh (2 suites, no skipped suite).

The new matrix checks shell-parsed Claude --name and exact session identity, plus pane-id-only title mutations for Claude and Pi workers/secondmates on fresh and resumed launches.
Negative cases cover invalid pane identity and either title mutation failing.
Fish is not installed on this Mac, so the existing fish-specific execution check capability-skipped; its static syntax check still ran.
One existing secondmate Cursor-resolution case also skipped because its executable was not resolvable in the test environment.
Earlier exploratory runs were incomplete or invalidated while editing and are not counted as passing evidence.
This is the explicitly requested direct PR; no-mistakes was not run.

Review

Two complete-branch self-review rounds, including the final fixture-only follow-ups.
No independent reviewer was commissioned.

Axis Verdict Model
Standards PASS: existing quoting, public executable tests, pane scope, and documentation ownership preserved gpt-6.1-sol
Spec PASS: shared Claude naming, all-harness tmux protection, main launch example, fresh/resume coverage, and live Claude/Pi proof gpt-6.1-sol

Note

Medium Risk
Changes alter tmux bootstrap for every spawn and fail fast on title errors, so backend misconfiguration could now block launches; coverage is strong but this path is execution-critical.

Overview
Firstmate now pins lane identity end-to-end: tmux launches resolve the owning pane id, disable application title overrides on that pane only, and force its title to the lane id before any harness starts, aborting spawn if pane identity or either tmux mutation fails so users never lose track of which task owns a window.

Claude workers and secondmates additionally receive shell-quoted --name <lane> in the generated launch (Orca, secondmate suites, and dispatch-profile expectations updated accordingly), and the README’s primary claude example mirrors that naming guidance.

Regression + documentation coverage expanded: a new dispatch-profile matrix asserts pane-scoped title commands plus --name, many tmux fixtures now answer #{pane_id} probes, and docs/verification/runtime-backends.md records the manual Claude/Pi proof.

Reviewed by Cursor Bugbot for commit fa5e8f7. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit fa5e8f7. Configure here.

Comment thread bin/fm-spawn.sh
! tmux select-pane -t "$lane_pane" -T "$ID"; then
echo "error: could not set task $ID's tmux pane title" >&2
exit 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title setup requires tmux 3.5

Medium Severity

allow-set-title is a tmux 3.5+ pane option, and a failed set-option aborts the spawn. Hosts still on 3.4 or older, including Ubuntu 24.04 LTS, then cannot launch any tmux-hosted harness. Window rename pinning already treats unknown options as best-effort, so this fail-closed check is a new hard dependency.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fa5e8f7. Configure here.

@pearson-tfl
pearson-tfl merged commit 6232ec6 into main Nov 6, 2026
1 check passed
pearson-tfl added a commit that referenced this pull request Nov 14, 2026
…e fork's full CI (#45)

* Make the fork's full CI green on stock Ubuntu 24.04 and current Pi

Product:
- fm-spawn: tmux before 3.5 has no allow-set-title, so every tmux spawn
  refused on Ubuntu 24.04's tmux 3.4. Skip only that unknown option and still
  set the lane title; any other title failure still refuses.
- fm-pending-reply-lib: the inbox scan reused the name rec inside pipeline
  subshells, so ShellCheck flagged rec in tests that source the library.

Tests:
- Fake tmux fixtures in the secondmate, liveness, restart, wake-queue,
  tangle-guard and agy tests now answer #{pane_id} and accept the title
  commands, as #18 did for the shared fixtures.
- spawn-loadout names the secondmate harness instead of relying on detection
  from the calling agent.
- calm-pi's hand-built host carries pendingBashComponents, which Pi 1.5
  sets in its constructor.
- session-start's digest-death case triggers on fm-lock.sh's mkdir; the lock
  no longer runs ps.
- ShellCheck fixes in spawn-loadout, omp live e2e and wedge-cap parity tests.

* no-mistakes(document): Note old-tmux title fallback in regression scope

* no-mistakes(ci): I fixed all four failing checks as Firstmate ruled, with no waivers. ci-3 (Stock macOS Bash snapshot compatibility). Rule broken: every script must parse under stock Bash 3.2. The only place in bin/fm-test-run.sh that broke it was a case arm inside a command substitution, at line 1589. I applied commit f6cfc38 from fm/ahr5999fm exactly as written, taking its patch from the GitHub API and applying it with git apply, so I did not have to fetch into the gate repository. The script now checks the file suffix with [[ ]] instead. ci-4 and ci-1 (Test coverage guard, and Behavior portable parallel 2). Rule broken: the largest modelled portable serial shard must stay under the 1200000 ms target. Main was at 1220565 ms with ten shards, and the same guard failure is what made tests/fm-test-run.test.sh fail inside the parallel 2 lane. The shard count is set in one place in bin/fm-test-run.sh (PORTABLE_SERIAL_SHARDS), and ci.yml's matrix must agree with it, because the runner refuses lane names that disagree. I copied only the shard-count part of commit 9fb3ef1: - PORTABLE_SERIAL_SHARDS is now 11. - The ci.yml serial matrix now runs shards 1 to 11. - docs/fm-test-portable-shards.md now describes sixteen long-lived Linux jobs (eleven serial), plus one line explaining why the lane grew. I left out 9fb3ef1's registration of the turn-end test. That covers its bin/fm-test-isolation-proof.sh hunk, the family entry and the timing hint, because that test does not exist on this branch. ci-2 (Full suite) only collects the other jobs' results, so it clears once they pass. Verified locally on Linux: - bin/fm-test-run.sh --check-coverage passes: 11 shards, largest 1109612 ms against the 1200000 ms target. - tests/fm-test-run.test.sh passes all 45 checks. - tests/fm-ci-workflow.test.sh passes all 18. - tests/fm-test-isolation-proof.test.sh passes all 9. - bash -n reads bin/fm-test-run.sh cleanly. Not checked: I could not run stock Bash 3.2 here because this host is Linux, so the macOS parse check itself is confirmed only by CI. The changes are left uncommitted for the outer executor
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.

1 participant