Skip to content

fix(social): a friend Bot's held reply shows its approval card (overlay hook crash, in-chat match) (#254) - #256

Merged
Birfy merged 2 commits into
ThinkFlowLab:mainfrom
Birfy:fix/held-reply-approval-card
Oct 18, 2026
Merged

Birfy merged 2 commits into
ThinkFlowLab:mainfrom
Birfy:fix/held-reply-approval-card

Conversation

@Birfy

@Birfy Birfy commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes #254.

Root cause. Not a routing or #233/#239 regression. A's typed line reaches B's Helper as a request from the friend's Bot (shown as the person). Helper's reply is routed back by the host (turns.js → replyRemote → bot.send, role reply, auto-reply) and, by the owner design (Auto-send off), held for B's owner. B's flybot/approvals holds three of these (08:15, 11:00, 11:22 Asia/Shanghai). The card never showed, so nothing released them:

  1. FlyBotApprovals (global overlay) declared a useState after its if (pending.length === 0) return null. First render has no holds, the next has one, and React throws "Rendered more hooks than during the previous render" (reproduced with React 18), so the overlay never drew. Since Approvals: approving a held send skips remaining middleware; approvals store gaps (PR #2 review) #12.
  2. The in-chat ChatApprovalDock matches a hold by the friend's handle or a room id. localHoldView put the friend's handle object into roomId, so approvalsForOpenChat dropped it, and nothing matched the replying Bot's own chat.

Fix. Hooks run on every render in the overlay (test with a stand-in renderer that enforces React's hook-count rule; fails without the fix). localHoldView keeps roomId to real room ids and exposes the writing Bot (fromId, not for lines you typed); the dock lists a local Bot's held reply in that Bot's own chat and in the friend's chat. No Bot Social server change.

Left as designed. The reply stays held until the owner approves (or Auto-send is on for the pair). Owner question: should a reply to a line the friend typed themselves (attested) skip the hold? Not changed.

Docs: social invariant 8, core-client. Client rebuilt, patches regenerated.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 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-10-18T03:35:50.226619Z be4822d 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: be4822d41b

ℹ️ 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 plugins/social/client.js
source: 'local',
from: composer ? 'You' : approval.senderName,
// The local Bot that wrote it (not a line you typed): its own chat shows the card (#254).
...(!composer && typeof approval.request?.from === 'string' ? { fromId: approval.request.from } : {}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle failed approvals in the newly matched dock

When a local Bot Social send reaches failed (for example, approval succeeds but dispatch hits a network error), this newly admitted item is rendered as a fresh pending card: ChatApprovalDock.load() explicitly fetches failed approvals, but localHoldView() drops approval.status, so every offered action sends approve or reject, while approvals.decide() accepts only retry for a failed record. On the next poll the card therefore reappears and all of its controls reject as stale; preserve and handle the failed state (or leave failed entries to the global Retry card).

Useful? React with 👍 / 👎.

@Birfy
Birfy added this pull request to the merge queue Oct 18, 2026
Merged via the queue into ThinkFlowLab:main with commit 3f6dba8 Oct 18, 2026
8 checks passed
@Birfy
Birfy deleted the fix/held-reply-approval-card branch October 18, 2026 03:48
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.

A friend Bot's reply to a typed DM is held on its owner and no approval card ever shows (overlay hook crash, no in-chat card for the replying Bot)

1 participant