Skip to content

fix(gateway): gate relay-only rename kwargs to the relay lane (#78487) - #80869

Open
WynnD wants to merge 1 commit into
NousResearch:mainfrom
WynnD:fix/discord-native-thread-rename
Open

fix(gateway): gate relay-only rename kwargs to the relay lane (#78487)#80869
WynnD wants to merge 1 commit into
NousResearch:mainfrom
WynnD:fix/discord-native-thread-rename

Conversation

@WynnD

@WynnD WynnD commented Aug 7, 2026

Copy link
Copy Markdown

What does this PR do?

Fixes #78487: native Discord auto-thread semantic renames were silently dying since the connector-guard refactor. gateway/run.py passes prefer_connector_created / parent_chat_id to rename_thread unconditionally, but the native Discord adapter's rename_thread only accepts only_if_current_name. Every native-lane rename raised TypeError, swallowed by the bare except Exception (debug-level log only) — the "rename result" log line never fires and threads keep their initial auto-thread name.

This PR takes the call-site gating approach (option 2 from the issue): the connector-owned kwargs are passed only on the relay lane; the native lane calls with only_if_current_name only.

Why this approach vs #78495

#78495 makes the native adapter silently accept/ignore the connector kwargs (single call-site preserved). This PR instead gates at the call site, keeping the native adapter's signature strict — a future relay/native mismatch will fail loudly at the boundary rather than being papered over by ignored parameters. Both approaches fix the bug; maintainers can pick or combine (the gating + adapter tolerance compose cleanly).

Changes Made

  • gateway/run.py: branch the rename_thread call on use_connector_guard — relay lane keeps prefer_connector_created=True + parent_chat_id; native lane passes only only_if_current_name.
  • tests/gateway/relay/test_native_lane_rename_kwargs.py: regression tests — (1) native lane receives no connector kwargs with the string guard intact, (2) signature-strict native adapter completes without TypeError, (3) relay lane keeps connector-guard behavior.

How to Test

./venv/bin/python -m pytest tests/gateway/relay/test_native_lane_rename_kwargs.py -v
# 3 passed

# Live: restart gateway, create a Discord auto-thread via the native lane,
# confirm "discord auto-thread rename result: ... applied=True" at INFO
# (previously the attempt line fired with no result line).

Checklist

  • Code follows the project's style guidelines
  • Tests added/updated and passing
  • No new dependencies
  • Bug fix verified against live native-lane Discord renames (gateway restarted with this patch; rename result lines present, no TypeError)

The semantic Discord auto-thread rename passed prefer_connector_created /
parent_chat_id unconditionally, but the native Discord plugin adapter's
rename_thread only accepts only_if_current_name. Every native-lane rename
raised TypeError and was swallowed by the generic except — threads were
silently never renamed and no 'rename result' log line was emitted.

Gate the connector kwargs behind use_connector_guard (relay lane only);
the native lane keeps the legacy string guard. Regression tests cover:
native lane receives no connector kwargs, signature-strict adapter
survives, relay lane keeps connector guard behavior.
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 7, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related to #78495: both fix #78487, but this PR gates relay-only kwargs at the call site while #78495 makes the native adapter accept them. Maintainers should choose the contract they prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

3 participants