Skip to content

feat(desktop): auto-open agent reply threads - #5563

Open
michaelzeyuchen wants to merge 1 commit into
block:mainfrom
michaelzeyuchen:fix/agent-reply-auto-open
Open

feat(desktop): auto-open agent reply threads#5563
michaelzeyuchen wants to merge 1 commit into
block:mainfrom
michaelzeyuchen:fix/agent-reply-auto-open

Conversation

@michaelzeyuchen

Copy link
Copy Markdown

Summary

When a user sends a top-level message targeting a known channel agent, automatically open the originating thread when that agent returns a hidden NIP-10 reply.

Previously, the reply landed correctly but rendered only inside the closed thread panel, so the active exchange appeared to leave the conversation until the user clicked the reply summary.

Behavior

The policy is intentionally narrow:

  • hidden NIP-10 thread replies only (not broadcasts or top-level messages)
  • thread root must exactly match the user's most recent agent-targeted message
  • author must resolve to a known channel agent
  • yields whenever an auxiliary panel is already open
  • deferred opening bails if the active channel changes before the transition runs

Delegated relay attribution remains trust-bound: resolveEventAuthorPubkey accepts actor/p tags only from the relay identity advertised by NIP-11.

Implementation

  • pure decideAgentReplyAutoOpen policy
  • dedicated hook owning the one-shot trigger and live-event subscription
  • optional onLiveEvent callback in useChannelSubscription, consumed only by the dedicated hook
  • send success/failure integration in the channel pane handlers
  • eight focused node:test cases

ChannelScreen.tsx remains within the file-size ratchet at 998/1000 lines.

Verification

From desktop/:

  • pnpm exec biome check (feature files) — pass
  • pnpm run typecheck — pass
  • focused node:test — 8/8 pass
  • pnpm run check:file-sizes — pass
  • pnpm run check:px-text — pass
  • pnpm run check:pubkey-truncation — pass

Not run locally: full Rust/Tauri workspace CI; GitHub Actions will exercise it.

🤖 Generated with Claude Code

Open the originating thread when a known agent returns a hidden NIP-10 reply to the user's most recent agent-targeted message. The policy is exact and one-shot, yields to active auxiliary panels, and guards deferred state changes across channel navigation.

Live events flow through useChannelSubscription with the onLiveEvent hook added solely for this feature; the agent-reply hook owns the subscription so the feature-specific callback does not leak into the general-purpose subscription API.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Michael Ze Yu Chen <michael@Michaels-MacBook-Pro.local>
@michaelzeyuchen
michaelzeyuchen requested a review from a team as a code owner August 11, 2026 12:02
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