Skip to content

feat(desktop): author interaction prompts from the composer - #2

Open
kaykayyali wants to merge 3 commits into
claude/pr-7483-review-coverage-tlbi42from
claude/pr-7483-review-coverage-tlbi42-ask-authoring
Open

feat(desktop): author interaction prompts from the composer#2
kaykayyali wants to merge 3 commits into
claude/pr-7483-review-coverage-tlbi42from
claude/pr-7483-review-coverage-tlbi42-ask-authoring

Conversation

@kaykayyali

Copy link
Copy Markdown
Owner

Summary

Implements the "desktop /ask and /poll authoring" follow-up listed in docs/experimental-interactions.md for block#7483. Stacked on #1 (the review fixes) so it can be merged after it.

An Ask for a decision action appears in the channel composer toolbar when the Interaction cards experimental feature is on. It opens a dialog that composes a buttons, poll or form prompt (kind 40010), signs it with the desktop identity, and publishes it through the normal relay session. The relay's projection then renders as a card for aware clients and as text for everyone else, exactly like a CLI-authored prompt.

  • authoring.ts is a pure builder that mirrors the relay's schema rules (identifier and label shape, per-type option/field counts, choice bounds, close rules, 30-day deadline, tag cap) so people get an actionable message before signing. The relay stays authoritative; if it still rejects (for example the experiment is off on that relay) its reason is shown in the dialog.
  • AskInteractionDialog edits options (label, auto-derived editable ID, style for buttons), fields (label, ID, type, required, comma-separated select choices), poll min/max, close rule, responder rule (members / admins / owners) and deadline presets. Every control is labelled; a failed attempt keeps the draft.
  • AskInteractionButton renders nothing unless the feature is enabled and is memoized into ChannelPane's composer extra actions so the memoized composer keeps its render bailouts.
  • Listed responders and threaded prompts remain CLI-only; a slash-command system was intentionally not introduced.

Related issue

Refs block#7483, block#3261. Depends on #1.

Testing

  • authoring.test.mjs: default schemas, poll bounds and close rules, form fields with select choices, every relay rejection with its message, ID derivation and label rules.
  • interaction-authoring.spec.ts (Playwright smoke, registered in playwright.config.ts): the action is hidden when the feature is off; an empty question is refused without signing; a buttons request with an added option, quorum close, admin responders and a 3-day deadline is signed with the expected tags; a poll with an impossible max shows the message and keeps the draft, then publishes bounded multi-select; a form publishes typed fields and optsel values.
  • pnpm typecheck, pnpm check, pnpm check:file-sizes; pnpm build:e2e then both interaction specs: 15 passed.
  • Screenshot of the dialog is captured at test-results/interaction-authoring.png by the spec; not posted here because gh is unavailable in this session.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV


Generated by Claude Code

Add an "Ask for a decision" composer action, gated by the Interaction cards
experimental feature, that composes, signs and publishes a kind 40010
buttons, poll or form prompt into the open channel. This covers the
"desktop /ask and /poll authoring" follow-up from the interaction slice
without introducing a slash-command system.

- `authoring.ts` builds the unsigned event and mirrors the relay's schema
  rules (identifier and label shape, per-type option and field counts,
  choice bounds, close rules, 30-day deadline, tag cap) so a person sees a
  precise message before signing instead of a relay rejection after. The
  relay stays authoritative; its own reason is shown if it still rejects.
- `AskInteractionDialog` edits options (label, auto-derived editable ID,
  style for buttons), fields (label, ID, type, required, select choices),
  poll min/max, close rule, responder rule and deadline with labelled native
  controls; a failed attempt keeps the draft.
- `AskInteractionButton` renders nothing unless the feature is on and is
  memoized into the channel composer's extra actions so the memoized
  composer does not re-render for a fresh element.

Tests: node tests for the builder (default schemas, poll bounds, form
fields and select choices, every relay rejection with its message, ID
derivation); a Playwright spec proving the action is hidden when the
feature is off, local validation blocks signing and keeps the draft, and
buttons, poll and form events carry the expected tags.

Validation: desktop typecheck, biome, file-size gate, node tests;
`pnpm build:e2e` and the interactions and interaction-authoring smoke
specs (15 passed).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV
Signed-off-by: Claude <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T17:47:03.767370Z 2c9abc3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2c9abc3a87

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/src/features/interactions/AskInteractionDialog.tsx
Comment thread desktop/tests/e2e/interaction-authoring.spec.ts Outdated
…eptance

- The authoring dialog is now opened for a specific channel: it publishes
  only to that channel, closes if the active channel changes underneath it,
  and its draft is keyed per channel so a question written for one channel
  is never signed into another.
- The mock relay records every client-published EVENT and every OK it
  answers, and accepts a `rejectEventKinds` knob that refuses a kind with a
  restricted reason. The authoring spec now asserts on relay acceptance and
  the `h` tag of the published event rather than on signing alone, and adds
  a case where the relay refuses the prompt: the dialog stays open, shows the
  relay's reason, and keeps the draft.

Validation: desktop typecheck, biome, node tests; `pnpm build:e2e` and the
interactions and interaction-authoring smoke specs (16 passed).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV
Signed-off-by: Claude <noreply@anthropic.com>
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.

2 participants