Skip to content

fix(bin): merge a secondmate child's PR through the owning home - #13

Merged
VasanthAmana merged 2 commits into
merkensoft-iris:mainfrom
VasanthAmana:fm/merge-path-for-unmergeable-mates
Oct 15, 2026
Merged

VasanthAmana merged 2 commits into
merkensoft-iris:mainfrom
VasanthAmana:fm/merge-path-for-unmergeable-mates

Conversation

@VasanthAmana

@VasanthAmana VasanthAmana commented Oct 15, 2026 •

Copy link
Copy Markdown

Problem

A task spawned by a secondmate has its task record only in that secondmate's home.
When the parent home tries to merge that task's PR, bin/fm-pr-merge.sh (and bin/fm-pr-check.sh, which it calls) refuse with task metadata is unavailable, because the record is not in the parent's state/.
The only workaround was merging outside the guarded path, which skips the checks that record merge metadata and refuse an unproved merge.

What changed

  • bin/fm-pr-merge.sh accepts a leading --secondmate <secondmate-id> option. It reruns the same script, with the remaining arguments, in the secondmate home that owns the task record.
    • A local secondmate runs it against its registered home, after the shared seeded-home validation, with every FM_* override restated for that home.
    • A remote secondmate runs it on its host through bin/fm-on.sh.
    • Either way, the owning home's own merge guards, holds, outcome recording, and upward report apply unchanged, and the parent creates no task record of its own.
  • The routed merge is attended and main-only: it is refused for the supervision branch and while the parent home has an away record, because the owning home cannot see either. This limit is documented in the script header.
  • The secondmate must have exactly one well-formed entry in data/secondmates.md.
  • A remote transport failure (exit 255) is reported as an unknown outcome to reconcile against the forge, and is never retried.
  • Documented in the script header, docs/architecture.md, and the ship-landing skill.

Testing

tests/fm-pr-merge.test.sh gains five cases, written to fail before the fix:

  • a parent merges a local secondmate's task PR through the owning home: the merge is recorded on that home's task, the outcome reaches the parent's channel, and the parent records nothing itself;
  • a red PR routed this way is still refused by the owning home's guards;
  • an unregistered secondmate and a home marked for a different secondmate are refused before any forge call;
  • the supervision branch and a parent away record are refused before any forge call;
  • the remote route sends exactly fm-pr-merge.sh <task-id> <url> to the secondmate's host, relays its output, and reports an ssh exit of 255 as an unknown outcome.

The full tests/fm-pr-merge.test.sh suite passes on bash 3.2, and ShellCheck is clean.
The routing and refusal paths were also driven against two disposable lab homes.
A real forge merge and a real remote host were not exercised live; they are covered by the mocked-forge and fake-ssh cases above.

A parent home has no task record for work its secondmate spawned, so
fm-pr-merge.sh refused a green, in-scope child PR as 'task metadata is
unavailable' and only a manual merge could land it. --secondmate <id>
now runs the same guarded merge in the home that owns the record,
locally or on the secondmate's host through fm-on.sh, so every guard,
captain hold, recorded outcome, and upward report applies there. The
routed merge is attended and main-only because the owning home cannot
see this home's away record or supervision actor.
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