fix(discord): reconcile ambiguous auto-thread creation - #73097
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the ambiguous-success create path. The production premise remains valid on current main: plugins/platforms/discord/adapter.py:6580-6590 catches a direct-create exception and immediately posts the fallback seed / creates its separate thread, with no reconciliation step.
Problems
- The test portion needs manual salvage. This PR is based on
ef267011, while current main pruned the insertion region intests/gateway/test_discord_channel_controls.py(the file now reaches its config section at line 219). GitHub reports the PRCONFLICTING/DIRTY; the added tests cannot apply as-is.
Suggested changes
- Preserve the adapter reconciliation logic and relocate its regression coverage into the remaining Discord auto-thread test surface, adapting the current fixture rather than restoring removed tests.
Automated hermes-sweeper review.
3f9afa9 to
39486ff
Compare
|
Addressed in d55bab7 and 39486ff. |
SummaryNine PRs address or reference this Discord auto-thread complex. Their diffs cover the original seed-message fallback, retry/fail-closed routing, orphan-seed cleanup, and, for #73032, reconciliation of an ambiguous direct-create result before any second thread is created. Related pull requests
Duplicates#20260 was superseded by merged #56108; #48690 duplicates #48685's core recovery mechanism; #52430 duplicates the tested canonical #52423; #73092 is a narrower subset of #73097. The target-fix lineage is #48685 -> #73097. Suggested consolidationKeep #73097 open with a salvage path centered on its adapter reconciliation logic and relocated ambiguous-success regression tests; this preserves the Verify-designated best fix without making a merge recommendation. Close #73092 as a duplicate of #73097 despite its keep_open maintainer-bot verdict because its diff covers only Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I73032(["issue #73032 (open)"])
P73097["PR #73097 (open)"]
P73097 -->|best fix| I73032
class I73032 open
class P73097 open
class P73097 best
class P73097 target
click I73032 "https://github.com/NousResearch/hermes-agent/issues/73032"
click P73097 "https://github.com/NousResearch/hermes-agent/pull/73097"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 9 pull requests and 3 issues in this complex. Each diff was read against this issue; Assessment working set: 60 kB of PR diffs, 33 kB of issue/PR text, 11 kB of discussion (14 comments), 23 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
What does this PR do?
Discord auto-thread creation is a remote side effect:
message.create_thread()can commit on Discord and still raise locally if the response is lost. The existing exception path treats that as a definitive failure and immediately creates a second thread from a fallback seed message.This PR reconciles the original starter-message thread before allowing the fallback. It reuses a matching thread from
message.thread, the client cache, or Discord's channel fetch; retries the lookup briefly for delayed visibility; and skips the fallback when reconciliation itself is inconclusive. A fallback seed is still created when Discord confirms that the original thread is absent.Related Issue
Fixes #73032
Related implementation: #73092 checks the in-memory
message.threadpath. This PR also covers cache misses, REST lookup, delayed visibility, mismatched cached channels, and lookup failures.This preserves the original author commit from the closed #48685 and adapts it to current
main.Type of Change
Changes Made
How to Test
ConnectionError.upstream/main@fae29c841, observe one direct thread plus one fallback thread.Validation
Remaining Risk
The issue's duplicate-reply observation is real, but its separate ingress path was not isolated. Current
mainalready has live-event deduplication, thread-starter pre-seeding, recovery deduplication, and persistent processing claims, so this PR intentionally does not change dispatch behavior without evidence. It fixes the deterministically reproduced duplicate-thread trigger.Checklist
pytest tests/ -qsuite run (focused Discord coverage is reported above).