fix(bin): let fm-secondmate-report.sh carry a decision key - #6
Merged
Merged
Conversation
added 5 commits
September 18, 2026 16:55
The helper always wrote [corr=<id>] in the leading bracket, which bin/fm-classify-lib.sh reads as [key=...]. A decision opened through the helper therefore folded under the default key, and fm-send.sh --resolve-key refused with "no open decision or blocker with that key" even though the key was present later on the line. Add a --key <key> option: when given, the status line carries [key=<key>] in the leading bracket position, with the corr token retained unbracketed so fm_pending_reply_extract_corr and the pending-reply contract still correlate the reply. A call with no key writes the historical [corr=<id>] bracket shape byte-for-byte. Update the helper header/usage, fm-brief.sh charter text, fm-classify-lib.sh comment, and add tests across three suites.
…n fm-secondmate-report.sh
The --key option now refuses keys in the reserved pending-reply- namespace (read from FM_CLASSIFY_RESERVED_KEY_PREFIXES_DEFAULT in bin/fm-classify-lib.sh) and the literal default key, so a key the helper accepts is always one the fold can open and fm-send.sh --resolve-key can close. Reads the prefix list from its one owner to avoid drift. Add tests for both rejected forms.
There was a problem hiding this comment.
🟡 Changes recommended
The helper accepts overlong keys that fm-send --resolve-key cannot close, and custom reserved-prefix errors identify the wrong owner.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Captain, this PR adds keyed decision reporting for secondmates while preserving correlation tokens and keyless output compatibility.
Changes:
- Adds
--keyand--key=<key>support with validation. - Updates secondmate instructions and tests for keyed reports.
- Adds coverage for resolving keyed decisions and reserved keys.
File summaries
| File | Description |
|---|---|
bin/fm-secondmate-report.sh |
Implements keyed report formatting and validation. |
bin/fm-brief.sh |
Documents the keyed helper contract. |
tests/fm-classify-corr-token.test.sh |
Tests parsing, placement, compatibility, and validation. |
tests/fm-pending-reply.test.sh |
Tests parent-channel correlation and resolution. |
tests/fm-send-resolve-key.test.sh |
Tests end-to-end keyed resolution. |
Review details
- Files reviewed: 4/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Secondmates raising a decision through bin/fm-secondmate-report.sh could not have it closed: the helper always wrote [corr=] in the leading bracket and appended (via-helper) at the tail, so any key a caller tried to embed landed at the note tail where neither _fm_key_before_colon nor _fm_key_at_note_head reads it, the decision folded under default, and fm-send --resolve-key refused.
This change adds a --key option that places [key=] at the note head — the only bracket position the fold reads — while the corr token stays in the leading bracket so the pending-reply contract still correlates. Keyless calls are byte-identical to the historical shape. The helper also rejects keys in the reserved pending-reply- namespace and the literal default key, reading those prefixes from fm-classify-lib.sh FM_CLASSIFY_RESERVED_KEY_PREFIXES_DEFAULT so the guard cannot silently drift.
Three pipeline-fix commits from the aborted validation run are preserved: dash-leading key rejection, --key=value support, and doc accuracy.
Proof: a needs-decision via the helper with --key appears in OPEN DECISIONS under its key, fm-send --resolve-key closes it, and the drain no longer lists it. A keyless call writes byte-identical output to the historical format.