Repository navigation
fix(bin): send harness slash commands to secondmates unmarked - #17
Merged
Merged
Conversation
A /command (or codex $skill) through a secondmate selector was wrapped in the from-firstmate carrier, so the harness read it as chat; send it bare instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Bug seen 2026-09-25: FM_HOME= bin/fm-send.sh "/clear" wrapped the text in the from-firstmate carrier (bin/fm-operational-input.sh), so the Claude second mate received it as chat and the slash command never ran; only sending to the explicit backend target (e.g. default:wH:p2) worked. Fix: when the text is a harness slash command (or a codex $skill invocation) sent to a kind=secondmate task selector, send it unmarked, exactly like the explicit-target path, while ordinary text stays marked. Keep pending-reply expectations off for these (no pending-reply record created). Add colocated tests for both shapes (slash command, codex $skill); update the fm-send header and any doc that states the marking rule. Decisions made: a command qualifies only when its leading token starts with a lowercase ASCII letter, contains only [A-Za-z0-9._:-], and ends at whitespace or end of text, so absolute paths (/tmp/x), capitalized slash-led prose, $5/month and $HOME stay marked ordinary text; the $ form counts only for a harness=codex target, matching the existing codex-scoped popup-settle rule; explicit character lists are used instead of [a-z] because locale collation made [a-z] match uppercase on macOS; the --key path, crewmate/scout targets, and explicit targets are unchanged; remote secondmates are covered because classification happens in the parent fm-send before the remote hop. docs/agent-control.md keeps lifecycle control (exit/interrupt) on fm-control even though slash commands are no longer marked. Repo rules: one sentence per line in Markdown, no agent co-author on commits, shellcheck-clean bin scripts, commit subject plus at most 3 body lines, PR description at most 5 lines plus footer.
What Changed
bin/fm-send.shnow sends a leading harness command to akind=secondmateselector unmarked and without a pending-reply record. This covers a slash command like/clear, and a$skillinvocation when the target runs codex. Ordinary text, absolute paths,$HOME, and capitalized prose are still marked.tests/fm-send-secondmate-marker.test.shcases for the slash-command and codex$skillshapes. They pass under both theCand UTF-8 locales.fm-sendheader,docs/agent-control.md, anddocs/architecture.mdwith the new marking rule. Lifecycle control (exit and interrupt) still goes throughfm-control.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The classification is narrow and runs before the --key, remote and explicit-target branches. TARGET_HARNESS is resolved before the check, and remote sends travel over the explicit endpoint path, so no marking happens there. No pending-reply record is created for unmarked commands, and the tests and docs match the stated intent.
Testing
I ran the colocated fm-send secondmate-marker test at the target commit and it passed in both the en_US.UTF-8 and C locales. It checks that slash commands and codex
$skillinvocations to a secondmate go out unmarked with no pending-reply record, while path-like and$-led prose stays marked. Running the same test against base fm-send.sh fails with the reported[fm-from-firstmate] /clearwrapping, which confirms the bug existed before the fix. The doc updates match the intent, and I left the worktree clean.Evidence: Target-commit test transcript (fm-send secondmate marker)
ok - fm-send: a slash command to a secondmate is sent unmarked with no pending reply, while slash-led text stays marked ok - fm-send: a codex $skill invocation to a secondmate is unmarked, while $-led text stays markedEvidence: Same test against base a0c8f92 fm-send.sh (shows the original bug)
not ok - exact-id /clear to a secondmate: expected the bare command, got [fm-from-firstmate]corr=929c35ca49a01ba6 /clearPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-send.sh:364- The command token stops at any whitespace, newline included. So a multi-line message whose first line is a bare command (e.g. "/clear\nthen summarize X") goes out unmarked with its trailing prose, and gets no pending-reply record. A single-segment lowercase path like "/usr is full" is also treated as a command. Both follow the documented decision rule (the token ends at whitespace or end of text). This note just flags the edge; no change is required.✅ **Test** - passed
✅ No issues found.
bash tests/fm-send-secondmate-marker.test.shat the target commit (all 10 cases, including the 2 new ones)LC_ALL=en_US.UTF-8 bash tests/fm-send-secondmate-marker.test.shandLC_ALL=C ...to check that the explicit character lists behave the same in both localesTemporarily swapped inbin/fm-send.shfrom base a0c8f92 and re-ran the test; it fails with the marked[fm-from-firstmate]corr=... /clearbytes, which matches the reported bug; restored the target file afterward and confirmed a clean worktreeRead the diffs of the fm-send header, docs/agent-control.md and docs/architecture.md against the intent's rules: marking rule updated, lifecycle control stays on fm-control, one sentence per line✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.