Repository navigation
feat(bin): add duplex Signal process-event adapter - #2680
Closed
FocalFactotum wants to merge 25 commits into
Closed
FocalFactotum wants to merge 25 commits into
FocalFactotum wants to merge 25 commits into
Conversation
FocalFactotum
force-pushed
the
fm/firstmate-signal-duplex-adapter-v4
branch
from
August 23, 2026 10:39
1485b82 to
75a573c
Compare
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "no-mistakes(lint): Captain: fix Signal a..." | Re-trigger Greptile |
FocalFactotum
force-pushed
the
fm/firstmate-signal-duplex-adapter-v4
branch
from
August 26, 2026 07:04
75a573c to
c801060
Compare
…d temp-file leaks
…m error, timeout, and mktemp dup
…eign Signal owners
…3247) * feat(extensions): bind trusted external process-event adapters * no-mistakes(review): Enforce owner and remote-home conformance * no-mistakes(review): Enforce serialized remote extension package lifecycle * no-mistakes(review): Enforce identity-conditional extension retirement * no-mistakes(review): Serialize extension retirement and recover crash cuts * no-mistakes(review): Unify retirement worker and lifecycle lock ownership * no-mistakes(review): Harden extension lifecycle retirement serialization * no-mistakes(review): Unify extension registration and overridden-state lifecycle boundaries * no-mistakes(document): Clarify built-in-only captain answer routing * no-mistakes(lint): Captain: fix extension binding ShellCheck findings * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes(review): Use isolated UID mapping for owner conformance * no-mistakes(review): Captain: remove forbidden CI ownership wrapper * no-mistakes(review): Serialize extension binding publication * no-mistakes(review): Document ordinary CI owner-fixture exclusion * no-mistakes(review): Quarantine orphaned handshake descendants * no-mistakes(test): Fix orphan attribution * no-mistakes(test): Harden process tracker baseline * no-mistakes(test): Harden detached descendant attribution * no-mistakes(test): Use exact invocation-group cleanup * no-mistakes(test): Bound remote conformance transport crossings * no-mistakes(test): Parallelize isolated extension conformance tests * no-mistakes(test): Lifecycle suite still exceeds deadline * feat(extensions): bind trusted external process-event adapters * no-mistakes(review): Enforce owner and remote-home conformance * no-mistakes(review): Enforce serialized remote extension package lifecycle * no-mistakes(review): Enforce identity-conditional extension retirement * no-mistakes(review): Serialize extension retirement and recover crash cuts * no-mistakes(review): Unify retirement worker and lifecycle lock ownership * no-mistakes(review): Harden extension lifecycle retirement serialization * no-mistakes(review): Unify extension registration and overridden-state lifecycle boundaries * no-mistakes(document): Clarify built-in-only captain answer routing * no-mistakes(lint): Captain: fix extension binding ShellCheck findings * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes(review): Use isolated UID mapping for owner conformance * no-mistakes(review): Captain: remove forbidden CI ownership wrapper * no-mistakes(review): Serialize extension binding publication * no-mistakes(review): Document ordinary CI owner-fixture exclusion * no-mistakes(review): Quarantine orphaned handshake descendants * no-mistakes(test): Fix orphan attribution * no-mistakes(test): Harden process tracker baseline * no-mistakes(test): Harden detached descendant attribution * no-mistakes(test): Use exact invocation-group cleanup * no-mistakes(test): Bound remote conformance transport crossings * no-mistakes(test): Parallelize isolated extension conformance tests * no-mistakes(test): Lifecycle suite still exceeds deadline * no-mistakes(review): Split extension conformance and forward remote transfer input * no-mistakes(review): Forward malformed remote payloads through fm-on * no-mistakes(review): Bound extension coordinator failure cleanup * no-mistakes(test): Skip repeated orphan sweep in coordinator children * no-mistakes(test): Queue isolated extension sections through bounded workers * no-mistakes(test): Bound extension coordinator lane cleanup * no-mistakes(test): Split remote lifecycle coordinator sections * no-mistakes(test): Coordinator probes pass; aggregate deadline remains * no-mistakes(test): Launch extension sections concurrently * no-mistakes(test): Fix coordinator marker publication * no-mistakes(test): Stabilize extension binding coordinator timing * no-mistakes(lint): Fix extension binding ShellCheck warnings * fix(extensions): prove invocation cleanup before retirement * no-mistakes(review): Harden process-event inbox confinement * no-mistakes(review): Preserve legacy capture parity * no-mistakes(review): Protect external registry staging * no-mistakes(test): Stabilize bounded extension conformance aggregate * no-mistakes(document): Document external evidence confinement * no-mistakes(ci): CI phase fixed. The failure was a flaky fixture in `tests/fm-remote-transport-lanes.test.sh`: its “fresh/in-use” staging directory had no live owner identity, so the real worker correctly reaped it once the 1-second age boundary elapsed on slower CI. The fixture now records the active test shell’s exact PID/start identity and cleans those records before removal. Verified: `bash tests/fm-remote-transport-lanes.test.sh` exits 0 with all checks passing; `git diff --check` passes. Provider check retrieval was also retried successfully, resolving the selected manual CI finding. Changed file: `tests/fm-remote-transport-lanes.test.sh` * no-mistakes(review): Harden extension staging and lifecycle reservation * no-mistakes(review): Harden external staging and lifecycle reservations * no-mistakes(review): Wire capture helper into remote conformance * no-mistakes(review): Pin external capture handoff and signal failures * no-mistakes(review): Bind pinned capture authority to inherited descriptor * no-mistakes(review): Harden descriptor-bound capture authority * no-mistakes(review): Harden core capture reservation authority * no-mistakes(review): Harden capture reservation boundaries * no-mistakes(review): Harden capture reservations and cleanup * no-mistakes(review): Harden capture handoff and reservation cleanup * no-mistakes(review): Bind capture handoff to claim descriptors * no-mistakes(review): Release lifecycle locks after host crashes * no-mistakes(review): Pin reservation recovery to recorded state roots * no-mistakes(review): Reject control bytes in claim state roots * no-mistakes(test): Stabilize extension capture descriptor handoff * no-mistakes(document): Document extension capture authority boundary * no-mistakes(lint): Fix ShellCheck extension binding warnings * no-mistakes(ci): CI phase result: fixed `bin/fm-procevent.sh` by initializing the shared `capture_state` sentinel for built-in adapters under `set -u`. This prevents normal built-in captures from aborting before publication. Verified: `bash -n bin/fm-procevent.sh` and `git diff --check` pass. The focused process-event suite was run locally but stopped earlier at a local detached-runner claim failure (`reconcile never claimed the registered source`), before the CI-reported post-capture path; CI evidence confirms the fixed unset-variable failure affected the failing remote, board, watcher, and process-event checks * no-mistakes(document): Correct extension namespace creation timing * no-mistakes(lint): Initialize capture locals for ShellCheck
…on-safe Signal rearm
FocalFactotum
force-pushed
the
fm/firstmate-signal-duplex-adapter-v4
branch
from
August 30, 2026 15:34
c801060 to
01f1926
Compare
Contributor
Author
|
Closing: the trusted external process-event extension bindings from #3247 are the right home for a personal Signal adapter, so this built-in version is no longer the plan. |
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
Rebase the existing upstream pull request #2680 (feat(bin): add duplex Signal process-event adapter, author FocalFactotum) onto the current kunchenguid/firstmate:main, preserving its accepted Signal adapter behavior, and update that exact PR rather than opening a replacement. This is a history-refresh task, not authorization to redesign or broaden the feature. The captain explicitly authorized rebasing the PR, including the necessary history rewrite of its existing FocalFactotum topic branch fm/firstmate-signal-duplex-adapter-v4, but did not authorize merging it.
The PR was verified open at head c801060a71e3e609f8a9ea6caa3cf594c2decbd2 on the FocalFactotum fork before any change, with the same identity throughout. The 19 original commits (starting "Add optional Signal process-event adapter" through "no-mistakes(document): Document Signal capture envelope") were manually rebased onto current upstream main and verified: bin/fm-procevent-signal.sh and tests/fm-procevent-signal.test.sh landed byte-identical to the original PR, and only bin/fm-procevent.sh required semantic conflict resolution against upstream commit 1fbc7bb "feat(bin): add trusted process-event extension bindings" - the Signal PRs generation-bound readiness feature (ready/unready/wait-ready commands, the readiness token export in cmd_start, and every ready_file cleanup site) was grafted onto upstreams new extension-owner branching rather than colliding with it; one redundant duplicate runner-file write (superseded by upstreams own equivalent write already present on the built-in-adapter branch) was dropped as the only genuine removal. Documentation/verification-history conflicts were resolved by keeping both sides content (upstream extension-binding verification entries alongside the Signal verification entries) and the dispatch-table conflict by keeping every command from both sides. All required guarantees were preserved: privacy/home-local temp and data-dir isolation, lifecycle retire-before-every-signal-cli-operation and restore-after-success-or-failure, bounded command timeouts, single-owner idempotent retirement/re-arm, stdin-only message bytes (never argv), the generation-bound readiness boundary, validated-account JSON-RPC attribution, and inert-when-unconfigured behavior. Focused Signal/process-event tests (tests/fm-procevent-signal.test.sh, tests/fm-procevent.test.sh), the full changed-file repository test set (bin/fm-test-run.sh --changed --base upstream/main, 38/38 passed), bin/fm-lint.sh, and bin/fm-doc-audience-check.sh all passed against that manual rebase (note: on this macOS sandbox, TMPDIR must be set to an already-canonical path for process-event claim-acquisition tests to pass, due to a pre-existing upstream symlink-canonicalization requirement in fm_procevent_claim_state_root_identity that is unrelated to this PR and reproduces identically on unmodified upstream/main - not something to fix here).
A prior no-mistakes run in this same home (01M0FMVP6QQGZ0MZ24WH8K9P5H) had already rebased, reviewed, tested, documented, linted, and pushed this exact PR as of 2026-08-26 (onto upstream main as it stood then, 07bf0c8) before being cancelled at the CI step; that push is the still-live c801060 PR head. Per explicit firstmate/captain direction, do not force or rewrite the no-mistakes gate and do not use the separately-verified manual rebase (preserved read-only at local ref backup/fm-firstmate-signal-duplex-adapter-v4-rebased-2141998, and pr2680-orig-head/c801060 preserved verbatim) as the submitted branch content. Instead this run starts fresh from the unchanged gate-known/remote head c801060 so the pipeline itself performs the deterministic rebase onto current main, review, fixes, documentation, lint, push, and PR update end to end - mirroring the same history-preserving reconciliation already used for PR 3176. The manual rebase remains available only as read-only evidence of already-verified Signal semantics if a conflict-resolution decision needs it.
Do not copy from or reference the captain-private untracked Signal prototype, read any private Signal configuration/identifiers/account state/messages, or run a real Signal account. Update only the existing PR 2680 branch (fm/firstmate-signal-duplex-adapter-v4 on the FocalFactotum fork) - never open a duplicate PR. Push only to that configured fork. Do not merge; leave the PR ready for the captains explicit merge decision.
What Changed
ready,unready, andwait-readyprocess-event commands so sends can retire the receiver and restore it only after the replacement runner is ready.Risk Assessment
✅ Low: The optional adapter is well-bounded and inert when unconfigured, and the reviewed generation, interruption, home-confinement, message-pinning, ownership, and readiness paths preserve the accepted behavior and documented limitations.
Testing
The supplied baseline reported prior focused, changed-file, lint, and documentation checks green. This phase independently ran the two targeted executable suites and a fake-account CLI flow. Testing exposed and fixed a TERM timing deadlock, after which interruption re-arm, home confinement, pinned message bytes, readiness, privacy, routing, and generic replacement semantics passed without accessing a real Signal account.
Evidence: Fake-account public CLI send and restored-receive transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 2 issues found → auto-fixed ✅
bin/fm-procevent.sh- merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/firstmate-signal-duplex-adapter-v4docs/verification/process-event-sources.md- merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/firstmate-signal-duplex-adapter-v4🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Review** - 3 issues found → auto-fixed (2) ✅
bin/fm-procevent-lib.sh:152- Repeated generic registration no longer creates a fresh generation. For a live terminal source, registering the identical argv now preserves the source inode, so the old runner's claim identity still matches and it can retire the supposedly replacement registration. This also contradicts the new executable regression in tests/fm-procevent.test.sh. Restore replace-on-register semantics here and keep Signal-only idempotence in cmd_arm_locked.bin/fm-procevent-signal.sh:457- After cmd_send_locked retires the receive source, HUP, INT, or TERM during account discovery, prefixing, or JSON-RPC send invokes interrupt_send, which disables the EXIT trap and exits without restore_source. This leaves inbound Signal registration absent, violating the approved restore-after-failure behavior. Route catchable interruptions through restoration while preserving the signal exit status, and cover the observable re-arm in the interruption regression.bin/fm-procevent-signal.sh:89- A private file is created by mktemp before its path is added to PRIVATE_TEMPFILES. If a trapped signal arrives while the shell waits for mktemp, Bash can run the deferred trap after mktemp returns but before the array assignment, so cleanup cannot find the newly created sensitive file. Establish a cleanup-owned path before creation, such as an invocation-private directory, so every catchable interruption removes the file.🔧 Fix: Restore process-event generations and interruption-safe Signal rearm
2 errors still open:
bin/fm-procevent-signal.sh:67- The intent requires "privacy/home-local temp and data-dir isolation" and says Signal mapping, credentials, and state remain home-local, but these checks reject only final-component symlinks. For example,$FM_HOME/configor$FM_HOME/statecan be a symlink outside the home; the adapter then accepts the mode-0600 routing file or createssignal/datathere and invokes signal-cli against external state. Validate canonical confinement beneath the effective home before reading configuration or creating Signal state.bin/fm-procevent-signal.sh:400- The message-file safety check is separated from the actualcpby route validation, receive retirement, and account discovery. A concurrent replacement can swap the validated regular file for a symlink, causing arbitrary target contents to be sent without error. Open the file once, validate the opened descriptor as a regular non-symlink source, and stage bytes from that pinned descriptor.🔧 Fix: Confine Signal state and pin outbound message bytes
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
TMPDIR="$PWD/.no-mistakes-test-tmp" bash tests/fm-procevent-signal.test.sh- initially reproduced the deadlock, then passed after the fixTMPDIR="$PWD/.no-mistakes-test-tmp" bash tests/fm-procevent.test.sh- passed, including replacement-generation and runner ownership behaviorManual fake-accountbin/fm-procevent-signal.sh sendcheck - verified sanitized output, valid account/group/body attribution, home-local data directory, identifier-free argv, restored generation-ready receive, private-temp cleanup, and retirement✅ **Document** - passed
✅ No issues found.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix: Captain: fix Signal adapter ShellCheck findings
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.