Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(cli): wirings create silently skips the agent_destinations side effect — agent sends to the new chat are dropped#2743

Open
sturdy4days wants to merge 1 commit into
nanocoai:main from
sturdy4days:fix/wirings-create-destination-row
Open

fix(cli): wirings create silently skips the agent_destinations side effect — agent sends to the new chat are dropped #2743
sturdy4days wants to merge 1 commit into
nanocoai:main from
sturdy4days:fix/wirings-create-destination-row

Conversation

@sturdy4days

@sturdy4days sturdy4days commented Jun 11, 2026

Copy link
Copy Markdown

Bug

ncl wirings create goes through the generic CRUD layer — a plain INSERT into messaging_group_agents. But creating a wiring has a required side effect that only createMessagingGroupAgent (src/db/messaging-groups.ts) performs: the companion agent_destinations row that deliverSessionMessages' permission check consults.

Result: a CLI-created wiring receives inbound messages normally, but every message the agent addresses to the newly wired chat is silently dropped by the delivery ACL — no error at create time, nothing visible to the agent, no operator-facing signal. Found live while wiring a multi-bot group (#2733 substrate): the bot looked mute for twenty minutes until we traced the missing destination row.

The setup paths (setup/register.ts, scripts/init-first-agent.ts) don't have this bug because they call the helper; only the CLI path bypasses it.

Fix

  • ResourceDef.customInsert: an optional hook letting a resource replace the generic INSERT with a domain helper when row creation has required side effects. (Generalizable: any future resource whose insert needs invariants gets the same escape hatch instead of a one-off handler.)
  • wirings.ts routes create through createMessagingGroupAgent, filling the columns the CLI def leaves optional with the same defaults setup/register.ts uses.

Testing

  • New guard test (src/cli/resources/wirings.test.ts) drives the real dispatch() path and asserts both the wiring row AND the destination row exist — it fails on the generic-INSERT behavior (it actually caught a second issue during development: the helper's named-parameter INSERT requires every column, hence the explicit defaults).
  • pnpm run build clean; full vitest suite green on the patched tree.
  • Verified live: re-creating the wiring with the destination row present un-muted the agent immediately.

🤖 Generated with Claude Code

... row
ncl wirings create used the generic CRUD INSERT into
messaging_group_agents, skipping the side effect createMessagingGroupAgent
performs: the companion agent_destinations row that delivery's ACL checks.
A CLI-created wiring therefore RECEIVES messages fine, but every send the
agent addresses to the newly wired chat is silently dropped — no error at
create time, none visible to the agent. The operator just sees a mute bot.
Fix: add ResourceDef.customInsert (replace the generic INSERT with a
domain helper when row creation has required side effects) and route
wirings-create through createMessagingGroupAgent, filling the columns the
CLI def leaves optional with the same defaults setup/register.ts uses.
The guard test drives the real dispatch path and asserts both the wiring
row and the destination row exist.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gavrielc gavrielc Awaiting requested review from gavrielc gavrielc is a code owner

@gabi-simons gabi-simons Awaiting requested review from gabi-simons gabi-simons is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /