fix(discord): accept relay-lane kwargs in native rename_thread (#78487) - #78495
fix(discord): accept relay-lane kwargs in native rename_thread (#78487)#78495PRATHAMESH75 wants to merge 2 commits into
Conversation
|
Independent reproduction and confirmation of this fix on v0.20.5 (2026.8.19), macOS 26.5.2, native Discord lane (no relay connector). Before the change — the semantic rename is attempted with a correct title, and nothing follows it: No Reproduced on 4/4 native-lane threads. After applying this PR's adapter change locally — same setup, new thread: Discord API confirms the applied state: Two notes that may be useful: The failure is invisible at default log level. The attempt logs at except Exception:
logger.warning("Discord auto-thread rename failed: thread=%s", target_thread_id, exc_info=True)A A signature-compatibility test would prevent recurrence across both adapters — e.g. binding Thanks for the fix — glad to see the regression test included. |
…esearch#78487) The semantic auto-thread rename lane (gateway/run.py _rename_discord_auto_thread_for_session_title) resolves rename_thread polymorphically via getattr(adapter, ...) and passes prefer_connector_created and parent_chat_id unconditionally — the relay sibling (gateway/relay/adapter.py) accepts both, but the native Discord adapter's signature only took only_if_current_name. On the native lane the extra kwargs raised TypeError, which the caller swallows in a bare except -> logger.debug, so native auto-thread renames silently stopped applying while the INFO 'attempt' line still fired. Bring the native signature to parity: accept prefer_connector_created and parent_chat_id and ignore them (they only matter to the relay egress guard; the native lane renames directly via the Discord API).
Add a signature-level contract test (no I/O) that binds each adapter's rename_thread against the exact kwargs gateway/run.py's semantic-rename lane passes, parametrised over the native (DiscordAdapter) and relay (RelayAdapter) lanes. run.py resolves rename_thread polymorphically and passes prefer_connector_created/parent_chat_id unconditionally, so a signature drift in EITHER adapter reintroduces the NousResearch#78487 TypeError that the caller swallows into logger.debug. The existing test proves the native lane accepts the kwargs at runtime; this pins the contract for both lanes at the signature level and fails on the pre-fix narrow signature. Suggested by @MAPE-sub-zero's independent reproduction on NousResearch#78495.
44e0db0 to
5030e96
Compare
|
@MAPE-sub-zero thank you for the thorough independent reproduction — the before/after Discord-API confirmation and the "invisible at default log level" analysis are exactly the diagnosis. Also rebased the branch onto current Signature-compat test — added ( The The signature test you asked for is the higher-leverage half anyway — it makes this class of regression impossible to merge silently again. Appreciate the careful review. |
Summary
Fixes #78487.
Since v0.19.1 the native Discord auto-thread semantic rename silently stopped applying: the gateway logs the
discord auto-thread rename: … lane=nativeattempt, but the thread is never renamed and no completion/error line follows.Root cause is a call-site/callee signature mismatch. The semantic-rename lane resolves
rename_threadpolymorphically and passes the relay sibling's kwargs unconditionally:The relay adapter (
gateway/relay/adapter.py) accepts all three kwargs, but the native Discord adapter'srename_threadonly acceptedonly_if_current_name. On the native lane the extra kwargs raiseTypeError, which is swallowed by the caller'sexcept Exception→logger.debug(...)— so the failure is invisible at INFO even though the "attempt" INFO line fired.Fix
Bring the native
rename_threadsignature to parity with its relay sibling — acceptprefer_connector_createdandparent_chat_idand ignore them. They only mean something to the relay egress guard; the native lane renames the thread directly via the Discord API, so it needs neither. This is the minimal change that keeps the shared polymorphic call site working for both lanes (vs. sprinkling conditional kwargs at the call site).Testing
tests/gateway/test_discord_slash_commands.py::test_rename_thread_accepts_relay_lane_kwargs— calls the nativerename_threadwithprefer_connector_created=/parent_chat_id=present and asserts it no longer raises and still performs the rename. (Fails withTypeErrorbefore this change.)