Skip to content

fix(hermes): send Discord approval cards through the live adapter (RIG-12360) - #247

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-12360-send-discord-approval-cards-through-the
Open

rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-12360-send-discord-approval-cards-through-the

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this do

Sends Discord approval cards, their timeout notice and resume typing through the live delivery adapter, the one replies already use. If the card fails, posts the text prompt in the thread with a mention of the requester only. If both fail, marks the approval undelivered and logs an error instead of withdrawing it silently.

Why do we need it

On macmini (11-23 00:10, 00:20, 00:22Z) every approval card failed with Not connected, and the request was withdrawn, while normal replies reached the same thread. After a reconnect the turn kept the adapter it started with, whose client was gone. Nemo stalled on routine steps with no prompt for Matt.

Summary

  • _render_approval_sync resolves _delivery_adapter_for(ctx.source); the timeout notice and resume typing use the same adapter.
  • Text fallback mentions only the requester (allowed_mentions).
  • A card send that timed out counts as possibly shown, so there is no second text prompt.
  • Test fakes gain AllowedMentions.none(), matching discord.py.

Verification

  • test_approval_uses_same_replacement_adapter_as_reply fails on main with Not connected; passes on head.
  • macpro2013: reconnect and timeout-notice files 83 passed; -k 'approval and discord' 157 passed, 2 skipped; all _render_approval_sync callers 148 passed, 2 failed. Both failures also fail on main ea056ebd.
  • Review round 1: 2H/1M/4L (a ready-flag retry that stalled inbound dispatch; broken fixtures; notice on the stale adapter). Round 2: clean, 0H/0M/3L.
  • Step-up: implement ran 41 min, 116 requests, no commit; finished on implement-hard.

Risks

  • A card that timed out and whose text fallback also failed logs a warning, not an error (as on main).
  • Clarify cards still use the turn's starting adapter; tracked separately.
  • Rollback: revert this commit.

Spec impact

Spec-impact: none

Checks skipped: nebula has no pre-push hook config; GitHub Actions ci.yaml runs its checks

Refs RIG-12360

Co-authored-by: Matt Wilkinson matt@rigel.build

…G-12360)

Approval cards failed with Not connected while replies to the same thread
worked: after a reconnect the turn kept the adapter it started with, and
that adapter's client was gone. Resolve the live delivery adapter for the
card, its timeout notice and resume typing, as the reply path does.

When the card send fails, post the text prompt in the thread and mention
only the requester. If both fail, mark the approval undelivered and log
an error instead of withdrawing silently. A card whose send timed out may
be on screen, so it does not trigger a second text prompt.

Refs: RIG-12360, RIG-12369

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

RIG-12360

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review rounds

Round Head Result
1 97eb890d 2H/1M/4L. H1: 9 tests broke on fixtures lacking _delivery_adapter_for. H2: a READY-wait retry cleared _ready_event on transport errors; a reconnect installs a new adapter, so inbound dispatch stalled 30 s. M1: timeout notice still on the stale adapter.
2 64a4355f Clean, 0H/0M/3L.

What changed for round 2

  • H2: READY retry, on_resumed and every _ready_event.clear() removed. The live-adapter switch is the fix.
  • H1: fixtures gain _delivery_adapter_for.
  • M1: timeout notice and resume typing use the resolved live adapter (test_timeout_notice_uses_the_adapter_that_sent_the_card).
  • L2: a timed-out card send counts as possibly shown; no second text prompt. L4: mention limited to the requester.

Accepted lows

  • L-r2-1: card timeout plus a failed text fallback logs a warning, not an error (as on main).
  • L-r2-2: approval_text_fallback_posted is set even when the text send failed; runner behaviour is correct.
  • L-r2-3: clarify cards still send through the starting adapter; a follow-up issue covers it.

Head cade8c61 is the reviewed tree (only the commit message changed from 64a4355f).

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at cade8c6
Base: main

This branch had an error being deployed

1 failed deployment
ci — cade8c61 Deployed Nov 23, 2026 by rigel-mintaka via CI (aarch64-linux) #1174
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