Skip to content

feat: add a signal channel driven by signal-cli - #21633

Open
bjoernd wants to merge 1 commit into
kirodotdev:mainfrom
bjoernd:feat/signal-cli-channel
Open

bjoernd wants to merge 1 commit into
kirodotdev:mainfrom
bjoernd:feat/signal-cli-channel

Conversation

@bjoernd

@bjoernd bjoernd commented Oct 17, 2026 •

Copy link
Copy Markdown

Problem / Motivation

Goal: Let Kiro Crew send notifications over Signal and let the owner chat with their instance in that same Signal conversation, through a local signal-cli.

Kiro Crew can be reached over Slack, Discord, Telegram, WhatsApp, iMessage and others, but not Signal. Someone who uses Signal as their messenger has no way to get cron results, completion notices or send_message output there, and cannot talk to the agent from it.

Why it matters

Signal is a widely used end-to-end-encrypted messenger, and for privacy-minded users often the only one they want an agent on. Without a channel they fall back to the dashboard, or to a messenger they would rather not use, for notifications and for remote control of their instance.

Not a goal

  • Group chats: refused, as on iMessage, because a reply would reach members who are not on the allow-list.
  • Streaming replies or editing sent messages: every Signal edit is visible to the recipient.
  • Talking to a signal-cli daemon over HTTP or to a containerised signal-cli: the gateway spawns its own child.
  • A pairing-code flow for unknown senders: access is a static allow-list.

What changed (motivation → approach → change)

Approach. The channel is modelled on iMessage, the existing channel that also drives a local CLI bridge: the gateway spawns signal-cli -a <account> jsonRpc and speaks newline-framed JSON-RPC over its stdio (reusing imessage.rpc.JsonRpcPeer). There is no listening port and no hosted relay, so no new inbound network surface. A child process was chosen over signal-cli's HTTP daemon mode so there is nothing to bind, authenticate or secure.

Setups. Two are supported: a dedicated bot number the owner DMs, or signal-cli linked as a secondary device of the owner's own account, used through Note to Self.

What was built (src/kiro_crew/signal_cli/):

  • Access: a deny-by-default allow-list of E.164 numbers and ACIs (signal.allowed_numbers); an empty list admits nobody. Unknown senders and groups get no reply. Note to Self is recognised only from envelopes whose source is an already trusted self identity, and an echo ledger keeps the agent from answering its own replies.
  • Binary resolution: a fixed source-level list plus the KIROCREW_SIGNAL_CLI environment variable, never a config.json path (that file is not owner-gated).
  • Lifecycle: a failed start (no binary, network not up, unregistered account) is retried with capped backoff, and the reason is shown on System → Services. An untrusted-identity send failure surfaces a redacted signal-cli trust hint there.
  • WhatsApp-level features:
    • Tool approval by typed reply (1/2/3, yes/no; 300s, timeout denies), plus /stop, /cancel, /status, /commands. Only the operator may approve, trust, stop or steer: the account itself in the linked setup, else the sole allow-listed number.
    • Inbound pictures, voice notes (transcribed) and documents via signal-cli's getAttachment; outbound files through the shared extractor and upload gate; status reactions.
    • A Signal section in kirocrew doctor: offline and redacted.
  • Settings → Messaging Channels → Signal: an entry with live status and a settings panel, like iMessage's. It sets enabled, account, allowed_numbers and session_folder, and explains both setups. It is backed by GET/PUT endpoints in dashboard/handlers/signal_settings.py (its own module, because handlers/messaging.py is over the line cap). The save validates numbers and stores them as +E.164 strings, and it refuses unknown keys, so no binary path can be set. A saved allow-list applies live; enabled/account restart only the Signal channel.
  • Delivery: each conversation is bound as its session's mirror and origin, as Telegram, Discord and WeCom do, so send_message(session="signal"), file_send, cron results and notices reach it.

Wiring: config section and builder, channel descriptor, gateway hoist, the cross-cutting channel lists (SEL sources, posture, pod isolation, autonudge, dashboard slots and labels, AWS control CHANNEL_SECTIONS), and a Services label in the frontend.

Phone numbers through kirocrew config set: no CLI change. As on main (#25036), config set refuses an unquoted number, which would otherwise parse as an integer and lose its + and leading zeros, and stores a quoted one as typed. signal-integration.md shows the quoted form, kirocrew config set signal.account '"+447700900001"', and test_cli_config_set_strings.py pins both outcomes for signal.account.

Config loading: an unquoted number in config.json (e.g. "allowed_numbers": [447700900001]) is read as +447700900001. Quoting is still recommended: the settings panel writes quoted strings, and kirocrew config set refuses an unquoted number.

Backwards compatibility

Compatible: the channel is off unless signal.enabled is set, and the new signal config section defaults to disabled.

Removes nothing: the diff adds a channel and its wiring; no key, path, record or public function is hidden, renamed, tightened or deleted.

Tests

  • test_signal_client.py, test_signal_transport.py, test_signal_dispatch.py, test_signal_renderer.py, test_signal_bridge_path.py, test_signal_gateway.py: envelope parsing in both receive shapes, allow-list matching on number or ACI, forged-sync rejection, echo suppression, operator scope, backoff, binary resolution, rendering and splitting.
  • test_signal_e2e.py, test_signal_files_e2e.py, test_signal_approvals.py: the real JsonRpcPeer, client, transport and TurnDriver against a fake signal-cli child. They cover:
    • a DM and Note to Self answered to the right recipient;
    • files in and out, and status reactions;
    • approve with 1, deny with no, deny on timeout;
    • no echo or reaction ever becoming a turn.
  • test_signal_attachments.py, test_signal_files.py: size caps against the JSON-RPC line limit, filename sanitising, temp-file cleanup including on cancellation, long-text attachments delivered once.
  • test_signal_file_send_origin.py: a Signal-born session's file_send (/api/channel/upload-file) is delivered natively instead of no_channel_destination; Note to Self binds the account; a unified bucket binds nothing.
  • test_signal_config_handlers.py: the settings API keeps +, normalizes and validates numbers, refuses unknown and binary-path keys, writes the audit log, and says which fields restart the channel and which apply live. website/src/test/SettingsSignalPanel.test.tsx covers the panel's states and warnings; the ChannelsPanel, deep-link, brand-icon and API-surface tests include Signal.
  • test_signal_doctor.py: the doctor section with an injected runner; no full number ever printed.
  • test_signal_config.py, test_cli_config_set_strings.py: enabled needs a real bool; the loader keeps a quoted phone number's + and leading zeros; config set refuses an unquoted number with nothing written and stores a quoted one as typed.
  • Existing channel-roster tests now include Signal: config contract, readiness, registry, governance, outbound authz, hot reload, pre-turn, posture, orchestrator ownership.

Manual verification

  • The author ran the channel end-to-end against a real Signal account: chatting with the instance, receiving notifications, and file delivery.
  • The argv and JSON-RPC parameters were checked against a real signal-cli 0.14.9 binary and its source.
  • An isolated gateway with a fake signal-cli showed the channel connecting on System → Services, replies, refusal of unknown senders and groups, live allow-list reload, and send_message and cron delivery.
  • With an unregistered account, the gateway stays up and reports the reason.

Screenshots / video

Settings → Messaging Channels with the new Signal entry, and the working Signal panel:

channels-list-light signal-panel-light
Failure, validation and setup states

Failed to start (signal-cli reports the account is not registered):

signal-connect-failed-light

Saved, but the channel is not running yet:

signal-not-running-light

Account without a leading + (validation warning, Save disabled):
signal-account-invalid-light

Enabled with no account set:
signal-no-account-light

Bot-number setup with two allowed numbers, so nobody can approve tools or use /stop:
signal-operator-warning-light

Needs setup (signal-cli not found, empty allow-list):
signal-needs-setup-light

Note-to-Self hint, which now appears only with an empty allow-list:
signal-note-to-self-hint-light

Save, read-only and session folder

Save confirmation:

signal-saved-light

Read-only when opened from a remote session:
signal-read-only-light

Session-folder toggle on:
signal-session-folder-light

Signal row on Developer → System → Services

Connected:
services-signal-connected-light

Failing, with the reason:

services-signal-error-light

Related Issues

N/A — no tracking issue.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TRUQ2gKoHktUBhx3GDgvqT
Add Signal as a messaging channel so Kiro Crew can send notifications over Signal and the owner can chat with their instance in the same conversation. The gateway spawns a local signal-cli in jsonRpc mode and speaks newline-framed JSON-RPC over its stdio, like the iMessage bridge, so there is no new inbound network surface.

Two setups are supported: a dedicated bot number the owner DMs, or signal-cli linked as a secondary device of the owner's account using Note to Self. Access is a deny-by-default allow-list of E.164 numbers and ACIs; groups and unknown senders get no reply. Note to Self is only recognised from envelopes whose source is an already trusted self identity, and an echo ledger keeps the agent from answering its own replies. A failed start is retried with capped backoff and reported on System > Services.

The channel matches WhatsApp's feature set: tool approval by typed reply and /stop, /cancel, /status, /commands, limited to the operator (the account itself, or the sole allow-listed number); inbound pictures, voice notes and documents via getAttachment, outbound files through the shared upload gate, and status reactions; and a Signal section in kirocrew doctor. Each conversation is bound as its session's mirror and origin, so send_message, file_send, cron results and notices reach it.

Signal also appears under Settings > Messaging Channels, with live status and a panel for the account, the allow-list and enabling the channel; a save applies without a gateway restart.

Claude-Session: https://claude.ai/code/session_01TRUQ2gKoHktUBhx3GDgvqT

@bjoernd
bjoernd requested review from a team and KiroCrewCaptain as code owners October 17, 2026 16:24
@bjoernd
bjoernd requested a review from chenmingwei23 October 17, 2026 16:24
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 17, 2026
@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from 4045910 to 53fbe6c Compare October 17, 2026 20:54
@bjoernd

bjoernd commented Oct 18, 2026

Copy link
Copy Markdown
Author

The remaining Cross-Platform Portability hits are the fallback install locations in signal_cli/bridge_path.py. They are POSIX-only by design, and the comment above TRUSTED_BRIDGE_PATHS says so; on Windows the binary comes from KIROCREW_SIGNAL_CLI alone. Could a maintainer add posix-only-approved?

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of d81cec10371f99bac386d840cee77eeab7515a85 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The 14 attachments show every new Signal settings state and both Services rows. No first-time reader has looked at them, because this fork lane has no blind read; pushing the branch to this repository would get one.

Notes

  • The "Before you start" paragraph (prerequisites_body) is four sentences of privacy and how-it-works prose sitting above the setup choice. Keep "Pick one of two setups" visible and move the relay and credential explanation into the Setup guide.
  • No screenshot shows a failed save (the inline ErrorNotice next to "Save Signal settings") or the saved_restart confirmation. Add both to the description so the next revision's review can check them.

[UX-REVIEWED] d81cec1

Description read

[DESCRIPTION-READ] 26a4e373025ede142988b4f6c6e7f2846358ecff7111fe36a3f4e8df9ae855ea

That sha256 names everything this verdict read: the PR description, plus the 17 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of d81cec10371f99bac386d840cee77eeab7515a85 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the channel copies the iMessage local-CLI bridge pattern, is off by default, admits nobody until numbers are allow-listed, and adds no listening port.

Notes

  • The description's "One shared fix found on the way" has no matching code. The patch never touches cli_config.py, so it does not make a string-typed key keep its text as typed. test_cli_config_set_strings.py and signal-integration.md say the existing type check refuses an unquoted number ("quote it as JSON"), and cli_config.py:792 already does that on base. Fix the description so it matches the diff.

[DESIGN-REVIEWED] d81cec1

Description read

[DESCRIPTION-READ] 73c03562ce2f1df9b3047c52f4893aef40d1b78ff521eb1e024e5169f8ad9268

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🔴 BLOCK

Premise-level review of d81cec10371f99bac386d840cee77eeab7515a85 via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: BLOCK

The system-prompt rewrite repeats in prompt.md the send_message route list that the tool's own description already carries. It goes into every session's context, and the description never mentions it.

Notes

  • Item 8 — rides along: the loader's coerce_identifier turns an unquoted integer into +N, but the shipped guide says "do not rely on it", and config set refuses the same input. Subtraction: delete the isinstance(value, int) branch in signal_cli/identifiers.py so only quoted strings are read.
  • Item 9 — undeclared: the description says "A key declared string now keeps the text as typed", but cli_config.py is not in the diff. The new test_an_unquoted_phone_number_is_refused_with_nothing_written pins the refusal that already exists on base (cli_config.py:792). This claimed fix does not ship.

What this change ships

Inventory (10 items) — 7 justified

Intent: let a Signal user get notifications from their instance and chat with it through a local signal-cli. ADDITION.

  1. A new Signal channel, off by default: DM a bot number, or use Note to Self — justified
  2. Cron results, send_message and file_send delivered to Signal — justified
  3. Typed-reply tool approvals plus /stop, /cancel, /status and /commands — justified
  4. Inbound pictures, voice notes and documents; outbound files; status reactions — justified
  5. A Settings → Messaging Channels → Signal panel and its GET/PUT endpoints — justified
  6. A Signal section in kirocrew doctor — justified
  7. A KIROCREW_SIGNAL_CLI env var that sets the binary path — justified
  8. An unquoted number in config.json is silently read as +E.164 — rides along
  9. The described fix to how config set handles string keys — undeclared, not in the diff
  10. The send_message line in the system prompt grows from a pointer to the full route list — undeclared, duplicate of mcp_tools/messaging.py

Blockers

Re-inlined send_message routes — duplicate of src/kiro_crew/mcp_tools/messaging.py
Trigger: on base, prompt.md:74 reads "its description lists the origin and channel routes". The hunk replaces it with the full list: origin, nine channel names, best-effort fallback, and "REFUSED" Slack options. All of that already sits in the send_message schema description (messaging.py:99-138; 1 existing site, which this PR also updates with "signal").
Outcome: every session's prompt carries two copies of the routes, and they must be kept in step by hand. The budget pinned in test_prompt_compact_contract.py (41_385 bytes) gets consumed with nothing new added.
Subtraction: revert src/kiro_crew/config/prompt.md to the one-line pointer from base. The tool description already tells the agent about "signal".
Clears when: the prompt.md hunk is removed from the diff.

[FIRST-PRINCIPLES-REVIEWED] d81cec1

Description read

[DESCRIPTION-READ] d45e27cc926ddaef1a26063664d6726b6b63a67652eabbda1fe342f23652918c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed d81cec10371f99bac386d840cee77eeab7515a85 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] d81cec1

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

Reviewed d81cec10371f99bac386d840cee77eeab7515a85 via the fork AI-review pipeline; updated in place on each push.

Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

BLOCKING -- src/kiro_crew/signal_cli/client.py:654 -- Disabling Signal leaves its status reporting active

self.ready.clear()
Trigger: Disable an already-connected Signal channel in Settings; the save’s hot apply calls _close_channel_locked() → SignalClient.close().
Outcome: The child stops, but signal_connected remains true: close never calls the state observer, and intentional teardown suppresses disconnect callbacks. Subsequent settings reads display “Active,” and Services reports the stopped channel as connected.
Anchor: defect
Fix: Replace the readiness-only clear with _set_state(False, "") during close so the dashboard receives the disconnected state.

[BLOCK-MERGE] d81cec1
[GPT-REVIEWED] d81cec1

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1 — MEDIUM rung: a feature reports the wrong thing on a common path (disabling a channel). The status is silently wrong, but nothing is lost.
Conditions confirmed: close() only clears ready and never calls the observer (patch src/kiro_crew/signal_cli/client.py:654, patch line 3896). Only _set_state updates the dashboard (patch line 4209). The mirror writes signal_connected only through that callback (gateway.py _state_mirror, patch line 4630). _close_channel_locked never resets *_connected (src/kiro_crew/slack/gateway_runtime/channel_lifecycle.py:561-588). The settings GET reads state.signal_connected as-is (patch line 1299). Nothing corrects it until a restart.
Real fix: change one line in close() to call the existing _set_state(False, ""). It adds no new state or mechanism, so the cost is well below the harm.

[ADJUDICATION] d81cec10371f99bac386d840cee77eeab7515a85 total=1 uphold=1 downgrade=0
UPHOLD F1 src/kiro_crew/signal_cli/client.py:654 reason=harm-warrants-remedy
[GPT-ADJUDICATED] d81cec10371f99bac386d840cee77eeab7515a85

@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from 53fbe6c to aaeaefc Compare October 18, 2026 16:38
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 18, 2026
@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from aaeaefc to eb9e893 Compare October 18, 2026 20:36
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
@bjoernd

bjoernd commented Oct 18, 2026

Copy link
Copy Markdown
Author

Thanks for the reviews. The latest push addresses every finding, each with a regression test that fails without the fix. The fix is still one commit, so the PR stays at a single commit.

Opus review

  • Steered attachments dropped (blocking). A steered message's staged files are now handed to the running turn and deleted only when that turn ends, whether it finishes, errors or is cancelled. If the steer is declined, they are deleted at once. A message with files is never steered into a turn that no Signal dispatch owns; it gets the resend receipt, as on Telegram. Tests: TestSteeredFiles in test_signal_attachments.py. WhatsApp's steer path has the same defect; it is out of scope here.
  • Cancel during the version probe leaves the child running. _open_peer now closes the peer on any BaseException and re-raises. Tests: test_a_start_cancelled_during_the_probe_leaves_no_child_running and test_closing_during_a_reconnect_probe_leaves_no_child_running (the fake signal-cli has a new silent mode).
  • account not normalized. The account is normalized once (account_identifier) for argv, self-identity matching and doctor, so all three now agree. Tests cover four input forms, plus an e2e test asserting the -a signal-cli actually receives.
  • attachments_dropped missing. The inbound route now carries it, so a refused picture with no caption is spooled for a restart notice.

GPT review

  • Echo records keep message bodies (blocking). The ledger now holds a fixed-size SHA-256 digest of the echo key. TTL, window and matching are unchanged. Test: test_the_ledger_keeps_a_fixed_size_digest_and_never_the_body.
  • Cancelling a reconnect leaves the child alive. Same fix as the Opus finding above.
  • Linked accounts skip authorization-denial audits. These are now audited at the same per-(sender, outcome) 600s rate limit as the bot-number setup, which keeps the flood protection without a blind spot.
  • Completion-wait failures skip child cleanup. The e2e helpers close the client and child, then re-raise, when a wait fails. Both helpers have new tests.

Design review

  • _parse_value_for. A value that is exactly one JSON string literal is decoded again ('"text"' becomes text). Everything else for a string key is stored verbatim, and null clears only a nullable key; on a non-nullable key it stays the text null. Tests are in test_cli_config_set_strings.py.

UX review

  • The Note-to-Self hint now shows only when the allow-list is empty, so a correct dedicated-bot setup no longer gets it, and it never appears alongside the empty-list warning.
  • allowed_numbers_desc is shortened in every locale.
  • Screenshots of every state you listed are in the description: connection failed, saved but not running, account invalid, no account, save feedback, read-only from a remote session, the session-folder toggle, and the Signal row on Developer → System → Services (connected and failing).

First Principles review (status reactions)
I'd like to keep them. Signal is the one channel here with no streaming and no message edits, so between sending a message and getting the final reply the user sees nothing. A long tool-using turn can take minutes, and ⏳ → ✅/⚠️ on their own mesasage is the only sign it was received and is being worked on, or that it failed. That is the job streaming and edits do on the other channels; it is not decoration copied from WhatsApp. The code involved is small, and reaction envelopes are dropped by kind before any other gate, so they can never become turns or echo loops (tested in test_signal_files_e2e.py).

@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from bfd2465 to de2ff2b Compare October 18, 2026 21:46
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from de2ff2b to 352d65a Compare October 19, 2026 16:14
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 25, 2026
@bjoernd
bjoernd force-pushed the feat/signal-cli-channel branch from ebc8197 to 92ec359 Compare October 29, 2026 11:38
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 29, 2026
@bjoernd

bjoernd commented Oct 29, 2026

Copy link
Copy Markdown
Author

Rebased onto current main and pushed 92ec359583, still one commit. It fixes the blocking GPT 6.1 finding, and it changes how kirocrew config set handles signal.account to match #25036.

GPT finding: "Re-adopt Signal configuration after the deferred import" (channels.py)

_start_signal awaits the import of signal_cli.gateway on a worker thread after the registry's before_start adoption and before the dispatcher subscribes to the config watcher. A write that landed in that window, such as an allow-list revocation, reached no Signal applier. The deferred restart applier only re-runs for boot keys, so the revocation would have been missed until the next edit or a restart.

  • After the import, _start_signal runs _adopt_channel_section_from_watcher again for Signal, synchronously, just before maybe_start_signal. That function builds the dispatcher before its own first await, and a comment there now states that rule.
  • Signal is the only channel that imports its code on demand, so no other start factory has this gap.
  • New tests in test/test_signal_boot_path.py land a config write in the middle of the import, using the real adoption and hoist code:
    • a revoked number is gone from the first allow-list;
    • a disable keeps the channel off;
    • a damaged Signal section keeps the boot copy, as every applier does.
  • Without the re-adoption, the revocation, disable and delegation tests fail.
  • The Signal boot-path paragraph in messaging.md describes the re-read.

config set signal.account now follows #25036

This PR used to make config set keep the typed text as-is for string keys, so an unquoted +44… number kept its +. #25036 does the opposite: it refuses a value whose parsed type doesn't match the declared one and says to quote it as JSON, and its tests require that. I dropped our parser change and kept upstream's behaviour. The silent-corruption bug that motivated our change is still prevented, because an unquoted number is now refused instead of stored as an integer.

  • test/test_cli_config_set_strings.py now covers this for signal.account, with and without --local:
    • an unquoted number is refused and nothing is written;
    • '"+447700900001"' is stored with its + and survives a reload.
  • signal-integration.md tells CLI users to quote the number. The Settings → Signal panel is unchanged.

Other rebase fixes

  • Section builder count: upstream added config section builders twice, and git merged our matching count edit into theirs each time. The count in test_config_refactor_contract.py is now 30.
  • prompt.md byte ceiling: upstream shortened the prompt, so our "signal" addition fits under upstream's own ceiling and the PR no longer raises it.
  • Doctor report test: the expected summary in test_cli_doctor_refactor_report.py lists both upstream's new "gateway restart needed" item and our _doctor_signal issue.

Local verification on 92ec359583

  • Static checks: lint, black 26.10.1, mypy, docs, i18n, comment-history, brand and the flake ratchet all pass.
  • Backend: 173 test files, covering this PR's tests and the modules upstream also changed. 6,925 passed and 6 failed; the same 6 fail on plain main at the same base, because they need a non-root user.
  • Frontend: 17 files, 1,416 tests passed.
  • Line cap: the check fails on publish/personal_drive.py, which is 2,027 lines on main itself and not touched here.

Could the GPT review lane take another look? Still open for maintainers: CI approval for this push, the posix-only-approved label, and taking over the security_posture.py change for Sensitive Change Review.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 29, 2026
@bjoernd

bjoernd commented Nov 8, 2026

Copy link
Copy Markdown
Author

@KiroCrewCaptain @chenmingwei23 — this is ready for another look, and it needs a maintainer to unblock CI.

Head: ed134b1837, still one commit, rebased onto main at 6d07df11cf and merging cleanly.

What changed since the last bot review (d81cec1)

  • GPT 6.1, "Disabling Signal leaves its status reporting active" (upheld): SignalClient.close() now reports the stop through _set_state(False, ""), so disabling a connected channel clears Settings and Services. The failed-start path in maybe_start_signal now closes before it reports, so the new clean-stop state cannot blank the error reason. Tests cover both, and each fails against the old code.
  • First Principles, "Re-inlined send_message routes" (BLOCK): the prompt.md hunk is reverted. The send_message tool schema already lists "signal".
  • Design Review note: the description no longer claims a config set change. kirocrew config set follows fix(cli): type-check config set for a key that is already stored #25036 and refuses an unquoted phone number. signal-integration.md shows the quoted form, '"+447700900001"', and test_cli_config_set_strings.py pins both outcomes.

Adapted to recent main

  • metrics/usage_attrs.ORIGIN_VALUES and feature_usage.CHANNEL_VALUES are derived from CHANNEL_SESSION_NAMESPACES, so Signal appears in them. The three tests that pin those lengths, and metrics.md, are updated.
  • dashboard/handlers/signal_settings.py is registered in test_ssm_loopback_trust_sites.PREDICATE_SITES with 2 sites. Like every other channel settings API, it gates through is_direct_local_request: a read-only GET for remote sessions and a refused PUT.
  • channel-capabilities.md takes the new Feishu cells from main next to the Signal column.
  • test_signal_boot_path.py uses default_timeout() for its subprocess, per K19.

Local verification

  • The repo's related-test plan ran in all 17 batches, backend and frontend. Every remaining local failure also fails on plain main at the same base: root-owned tmp, no IPv6, and the gh shim. On this head, our tests plus the contract, metrics and loopback-registry tests pass (2,370), as do 1,581 frontend tests.
  • Lint, black 26.10.1, mypy, docs, i18n, the line cap and the flake ratchet are clean.

Needs a maintainer

  1. Approve and run the workflows. All 18 held runs for this push show "Action required": CI, Fast Gate, Build, CodeQL, Code Review and the review lanes.
  2. Add the posix-only-approved label for Cross-Platform Portability.
  3. Sensitive Change Review. This PR adds Signal rows to security_posture.py, security_posture_controls.py and security_posture_sinks_delivery.py, so as a fork PR it needs a takeover. A filled template for this head is in the next comment, ready to paste into the approval.

Thanks!

@bjoernd

bjoernd commented Nov 8, 2026

Copy link
Copy Markdown
Author

For the maintainer taking over Sensitive Change Review: as a fork PR it can't clear the gate itself, so here is the filled template for the current head, ready to paste into an approving review (or to adapt on the takeover branch's head).

## Sensitive change review
- Head commit: ed134b18370983f8abf564f21f3440ea9f9d2c26
- What rule changed: No enforcement rule changed; only the security-posture inventory gains Signal entries so the new channel is classified like iMessage.
- Before -> after (what was allowed/blocked, now): Before, the posture tables had no Signal rows. After, signal_cli/client.py, gateway.py, identifiers.py, transport.py, transport_dispatch.py and doctor_checks/channels.py are listed in NON_EGRESS_REDACTION_MODULES (they call redact_identifier only for log lines and SEL caller fields), signal_cli/renderer.py is a "Signal delivery" row in _DELIVERY_SINKS (it re-scans flattened text through redact_for_display, as the iMessage renderer does), and _AUDIT_SURFACE_DETAIL["signal"] names the audit surface. Nothing is newly allowed or blocked.
- Worst case if wrong (breaks commands / leaks secret / locks user out): A Signal module misclassified as non-egress could send model text without the display-safety screen and leak a credential to the Signal recipient; the renderer is the only Signal module that builds outbound text, and it is registered as a delivery sink.
- Evidence checked (which sandbox result proves it): No sandbox, mask, seal or tool-gate file changed, so there is no sandbox behaviour to re-prove; test_security_posture.py and test_security_posture_facade.py pass on this head, and the Signal renderer tests cover the redact_for_display re-scan of flattened markdown, captions and the approval prompt.
- No regression:
  - Tools still work (which tools/commands were run, result): The full Signal suite (client, gateway, transport, dispatch, approvals, attachments, files, renderer, doctor) and the repo's related-test plan pass locally; remaining local failures also fail on plain main at the same base.
  - Backward compatible (old config / old data / old callers still work, how checked): Rows are only added, none removed or changed, so every existing channel's classification is unchanged; the posture facade tests confirm the public names still resolve.
  - Existing tests (which suites passed on this head): test_security_posture.py, test_security_posture_facade.py, test_ssm_loopback_trust_sites.py, the Signal suites, and the contract/metrics tests touched by this PR.
- How to undo: Revert this PR's commit, or remove the Signal rows from the three security_posture modules together with the signal_cli package.

@bjoernd

bjoernd commented Nov 12, 2026

Copy link
Copy Markdown
Author

For the maintainer taking over Sensitive Change Review: as a fork PR it can't clear the gate itself, so here is the filled template for the current head, ready to paste into an approving review (or to adapt on the takeover branch's head).

## Sensitive change review
- Head commit: b43a77a2adbbd670562fc4d39c8b56508007027d
- What rule changed: No enforcement rule changed; only the security-posture inventory gains Signal entries so the new channel is classified like iMessage.
- Before -> after (what was allowed/blocked, now): Before, the posture tables had no Signal rows. After, signal_cli/client.py, gateway.py, identifiers.py, transport.py, transport_dispatch.py and doctor_checks/channels.py are listed in NON_EGRESS_REDACTION_MODULES (they call redact_identifier only for log lines and SEL caller fields), signal_cli/renderer.py is a "Signal delivery" row in _DELIVERY_SINKS (it re-scans flattened text through redact_for_display, as the iMessage renderer does), and _AUDIT_SURFACE_DETAIL["signal"] names the audit surface. Nothing is newly allowed or blocked.
- Worst case if wrong (breaks commands / leaks secret / locks user out): A Signal module misclassified as non-egress could send model text without the display-safety screen and leak a credential to the Signal recipient; the renderer is the only Signal module that builds outbound text, and it is registered as a delivery sink.
- Evidence checked (which sandbox result proves it): No sandbox, mask, seal or tool-gate file changed, so there is no sandbox behaviour to re-prove; test_security_posture.py and test_security_posture_facade.py pass on this head, and the Signal renderer tests cover the redact_for_display re-scan of flattened markdown, captions and the approval prompt.
- No regression:
  - Tools still work (which tools/commands were run, result): The full Signal suite (client, gateway, transport, dispatch, approvals, attachments, files, renderer, doctor) and the repo's related-test plan pass locally; remaining local failures also fail on plain main at the same base.
  - Backward compatible (old config / old data / old callers still work, how checked): Rows are only added, none removed or changed, so every existing channel's classification is unchanged; the posture facade tests confirm the public names still resolve.
  - Existing tests (which suites passed on this head): test_security_posture.py, test_security_posture_facade.py, test_ssm_loopback_trust_sites.py, the Signal suites, and the contract/metrics tests touched by this PR.
- How to undo: Revert this PR's commit, or remove the Signal rows from the three security_posture modules together with the signal_cli package.

@bjoernd

bjoernd commented Nov 12, 2026

Copy link
Copy Markdown
Author

@KiroCrewCaptain @chenmingwei23 Gentle ping. This needs one of you to review so we can make progess.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 20% chance that this change introduces a defect, above the 12% limit for approving on its own.

Additive Signal channel modelled on the iMessage local-CLI bridge, off by default. Trust boundaries checked in code: the allow-list is deny-by-default and matches on number or ACI; groups are refused; Note to Self needs a trusted self identity at both ends, and no envelope can add itself to that set; the echo check runs after the authorization gates; approvals, steering and every command except /help are operator-only; attachments are fetched only after the governance gate; send_document re-checks the allow-list. The settings PUT works only from the local machine, accepts a fixed set of fields with no binary path, and audits. The binary comes from an environment variable or a fixed source list, following the existing KIROCREW_KIRO_BIN precedent. Signal is added to the pod seed-disabled sections and the AWS-control CHANNEL_SECTIONS. The earlier-head blockers are fixed: close() now reports the disconnect through _set_state, the prompt.md rewrite is gone, and the description now matches the code. Shared-module edits mostly add 'signal' to lists, plus one behaviour-preserving filename-screen refactor. Test coverage is extensive. Test/lint/build CI has not run yet because the fork workf

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit d086f832c6 · 14465 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@bjoernd

bjoernd commented Nov 13, 2026

Copy link
Copy Markdown
Author

Thanks — the config-set note is right: the description was stale. kirocrew config set is unchanged from main (#25036 refuses an unquoted number); this PR only pins that for signal.account in test_cli_config_set_strings.py and documents the quoted form. I've corrected the description. The current head is 249601d, rebased onto main (the recommendation was computed on the earlier merge commit 9cae739; the code is the same).

@bjoernd

bjoernd commented Nov 13, 2026

Copy link
Copy Markdown
Author

Sensitive change review

  • Head commit: cf9cecf
  • What rule changed: No enforcement rule changed; only the security-posture inventory gains Signal entries so the new channel is classified like iMessage.
  • Before -> after (what was allowed/blocked, now): Before, the posture tables had no Signal rows. After, signal_cli/client.py, gateway.py, identifiers.py, transport.py, transport_dispatch.py and doctor_checks/channels.py are listed in NON_EGRESS_REDACTION_MODULES (they call redact_identifier only for log lines and SEL caller fields), signal_cli/renderer.py is a "Signal delivery" row in _DELIVERY_SINKS (it re-scans flattened text through redact_for_display, as the iMessage renderer does), and _AUDIT_SURFACE_DETAIL["signal"] names the audit surface. Nothing is newly allowed or blocked.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A Signal module misclassified as non-egress could send model text without the display-safety screen and leak a credential to the Signal recipient; the renderer is the only Signal module that builds outbound text, and it is registered as a delivery sink.
  • Evidence checked (which sandbox result proves it): No sandbox, mask, seal or tool-gate file changed, so there is no sandbox behaviour to re-prove; test_security_posture.py and test_security_posture_facade.py pass on this head, and the Signal renderer tests cover the redact_for_display re-scan of flattened markdown, captions and the approval prompt.
  • No regression:
    • Tools still work (which tools/commands were run, result): The full Signal suite (client, gateway, transport, dispatch, approvals, attachments, files, renderer, doctor) and the repo's related-test plan pass locally; remaining local failures also fail on plain main at the same base.
    • Backward compatible (old config / old data / old callers still work, how checked): Rows are only added, none removed or changed, so every existing channel's classification is unchanged; the posture facade tests confirm the public names still resolve.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_security_posture_facade.py, test_ssm_loopback_trust_sites.py, the Signal suites, and the contract/metrics tests touched by this PR.
  • How to undo: Revert this PR's commit, or remove the Signal rows from the three security_posture modules together with the signal_cli package.

Add Signal as a messaging channel so Kiro Crew can send notifications
over Signal and the owner can chat with their instance in the same
conversation. The gateway spawns a local signal-cli in jsonRpc mode and
speaks newline-framed JSON-RPC over its stdio, like the iMessage bridge,
so there is no new inbound network surface.

Two setups are supported: a dedicated bot number the owner DMs, or
signal-cli linked as a secondary device of the owner's account using
Note to Self. Access is a deny-by-default allow-list of E.164 numbers
and ACIs; groups and unknown senders get no reply. Note to Self is only
recognised from envelopes whose source is an already trusted self
identity, and an echo ledger keeps the agent from answering its own
replies. A failed start is retried with capped backoff and reported on
System > Services.

The channel matches WhatsApp's feature set: tool approval by typed
reply and /stop, /cancel, /status, /commands, limited to the operator
(the account itself, or the sole allow-listed number); inbound
pictures, voice notes and documents via getAttachment, outbound files
through the shared upload gate, and status reactions; and a Signal
section in kirocrew doctor. Each conversation is bound as its
session's mirror and origin, so send_message, file_send, cron results
and notices reach it.

Signal also appears under Settings > Messaging Channels, with live
status and a panel for the account, the allow-list and enabling the
channel; a save applies without a gateway restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRUQ2gKoHktUBhx3GDgvqT
@bjoernd

bjoernd commented Nov 20, 2026

Copy link
Copy Markdown
Author

Sensitive change review

  • Head commit: 7bddc37
  • What rule changed: No enforcement rule changed. The security-posture inventory gains Signal entries so the new channel is classified like iMessage, and the shared filename screen Signal uses for document names now decides through the same refusal gate upload_filename uses since feat(security): one redaction switch, rule table only, value-only masks #37408.
  • Before -> after (what was allowed/blocked, now): Before, the posture tables had no Signal rows. After, signal_cli/client.py, gateway.py, identifiers.py, transport.py and doctor_checks/channels.py are listed in NON_EGRESS_REDACTION_MODULES (they call redact_identifier only for log lines and SEL caller fields); signal_cli/renderer.py is a "Signal delivery" row and signal_cli/transport_dispatch.py a "Signal session title" row in _DELIVERY_SINKS, matching how feat(redaction): scrub every persisted conversation row #36640 registered every other channel's dispatcher; _AUDIT_SURFACE_DETAIL["signal"] names the audit surface. messaging/outbound_files.filename_passes_screen() now returns not refuses(name, ...), the exact rule upload_filename applies, so a document name holding a credential or a flagged URL is replaced with file; upload_filename's own behaviour is unchanged. The Signal session title is scrubbed with _redact_at_write_boundary("user", ...) before the 40-character cut, as on iMessage and WhatsApp. Nothing is newly allowed.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A Signal module misclassified as non-egress could send model text without the display-safety screen and leak a credential to the Signal recipient; the renderer and the dispatcher's session title are the only Signal modules that build outbound or dashboard-visible text from model or user input, and both are registered as delivery sinks.
  • Evidence checked (which sandbox result proves it): No sandbox, mask, seal or tool-gate file changed, so there is no sandbox behaviour to re-prove. test_security_posture.py, test_security_posture_facade.py and test_autonudge_row_scrub.py (Signal added to _TITLE_SCRUBBERS) pass on this head. New tests fail against the pre-port code: TestSessionTitle in test_signal_dispatch.py (a credential in the first message reached the title) and the beacon-URL cases of test_the_document_name_passes_the_shared_upload_name_screen in test_signal_files.py (the old redacted == name screen let them through after feat(security): one redaction switch, rule table only, value-only masks #37408).
  • No regression:
    • Tools still work (which tools/commands were run, result): All Signal suites (client, gateway, transport, dispatch, approvals, attachments, files, renderer, doctor, e2e, boot path) and the channel-roster tests upstream changed since the last head pass locally: 3,378 passed with no failures.
    • Backward compatible (old config / old data / old callers still work, how checked): Posture rows are only added, apart from moving Signal's own dispatcher from the non-egress list to the delivery sinks; no other channel's classification changes. filename_passes_screen keeps its signature, and its only callers are upload_filename and Signal's document_filename.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_security_posture_facade.py, test_ssm_loopback_trust_sites.py, test_autonudge_row_scrub.py, the Signal suites, and the contract/metrics/channel-roster tests touched by this PR.
  • How to undo: Revert this PR's commit, or remove the Signal rows from the three security_posture modules together with the signal_cli package and the filename_passes_screen helper (upload_filename then inlines the same refuses() call, as on main).

@bjoernd

bjoernd commented Nov 20, 2026

Copy link
Copy Markdown
Author

@KiroCrewCaptain @chenmingwei23 — rebased again and ready for a look; it needs a maintainer to unblock CI.

Head: 7bddc37, still one commit, rebased onto current main and merging cleanly.

Changes since the head the approver recommendation was computed on (d086f83)

  • Session title (feat(redaction): scrub every persisted conversation row #36640): the title Signal derives from a conversation's first message is now scrubbed with _redact_at_write_boundary before the 40-character cut, as on iMessage and WhatsApp. signal_cli/transport_dispatch.py moves from the non-egress list to a "Signal session title" delivery-sink row, and signal_cli joins _TITLE_SCRUBBERS in test_autonudge_row_scrub.py.
  • Document file names (feat(security): one redaction switch, rule table only, value-only masks #37408): filename_passes_screen() now decides through security.exfil.refuses, the same gate upload_filename uses, so a beacon-URL name is still replaced after the value-only URL masking change.
  • Control tags: SignalRenderer.text() strips trailing control-tag lines (keep-visible, deliver:, option-action:) before rendering [OPTIONS:], so none reaches the phone as text.
  • Test fixtures: the Signal redaction tests use synthetic github_classic(seed=…) tokens, as upstream's channel tests now do; the rule table deliberately ignores AKIAIOSFODNN7EXAMPLE.
  • Adapted to main: the count-pin tests upstream replaced with property assertions take upstream's form, and the config builder count is 32.

Every change above has a test that fails against the code before it. Locally on this head: 3,378 backend tests (Signal suites plus the channel-roster tests main changed) and 423 frontend tests pass; mypy, lint, docs, i18n and the line cap are clean.

Needs a maintainer

  1. Approve and run the workflows. The 18 runs for 7bddc37 show "Action required".
  2. Add the posix-only-approved label for PR Policy's cross-platform check, if it flags the signal-cli process code.
  3. Sensitive Change Review. This PR adds Signal rows to security_posture.py, security_posture_controls.py and security_posture_sinks_delivery.py, so as a fork PR it needs a takeover. A filled template for this head is in the next comment.

Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants