Skip to content

feat(discord): searchable /model autocomplete - #65931

Open
FixItFoundry wants to merge 1 commit into
NousResearch:mainfrom
FixItFoundry:feat/discord-model-search-autocomplete
Open

feat(discord): searchable /model autocomplete#65931
FixItFoundry wants to merge 1 commit into
NousResearch:mainfrom
FixItFoundry:feat/discord-model-search-autocomplete

Conversation

@FixItFoundry

Copy link
Copy Markdown
Contributor

Supersedes #57796 (auto-closed when the head repo was deleted during my username migration). Addresses the review there: autocomplete catalog read offloaded via asyncio.to_thread, plus regression coverage in the connect/liveness suites.

@tonydwb tonydwb 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.

Code Review Summary

Verdict: Comment

Looks Good

  • Discord /model autocomplete is now searchable (fuzzy filter on model names)
  • Clean addition to cron/jobs.py with corresponding test files
  • No security or performance concerns

Reviewed by Hermes Agent

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/cron Cron scheduler and job management comp/plugins Plugin system and bundled plugins platform/discord Discord bot adapter needs-decision Awaiting maintainer decision before any implementation labels Jul 16, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for bringing searchable Discord /model selection forward; remote main still exposes /model only as a free-text field at plugins/platforms/discord/adapter.py:4247-4250, so the feature is still useful.

Problems

  • plugins/platforms/discord/adapter.py:4392 truncates Choice.value. That changes the /model argument before gateway/slash_commands.py:1480-1487 parses --provider, so a long model ID or foreign-provider selection can no longer identify the intended target.
  • The PR bundles unrelated cron, voice PCM, LoginFailure, and liveness changes. In particular, the new broad handler at plugins/platforms/discord/adapter.py:1345 precedes an existing broad handler at line 1359, leaving the latter unreachable.

Suggested changes

  • Skip choices whose value cannot be represented intact; do not truncate them. Add tests for long values and for complete foreign-provider values.
  • Isolate the /model autocomplete change from the unrelated commits, and consolidate the duplicate exception handling if the LoginFailure work is retained.

Automated hermes-sweeper review.

Comment thread plugins/platforms/discord/adapter.py Outdated
Comment thread plugins/platforms/discord/adapter.py Outdated
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 18, 2026
@FixItFoundry
FixItFoundry force-pushed the feat/discord-model-search-autocomplete branch from d6f9535 to ee4a3c0 Compare July 20, 2026 17:35
@FixItFoundry

Copy link
Copy Markdown
Contributor Author

Thanks for the review — both points addressed, and the branch has been rebuilt on current main as a single commit.

Truncated Choice.value — fixed. You were right that this was silent corruption rather than a cosmetic cap. Values that exceed Discord's 100-character limit are now skipped outright instead of trimmed; the label is still ellipsised since it's display-only. Concretely, the old behaviour turned local-proxy/<long-id> --provider openrouter into …mmmm --provi, which drops the provider flag and resolves to a different target. test_model_autocomplete_preserves_values_verbatim pins it, and I confirmed it fails if the truncation is put back.

Bundled changes — removed. The PR is now only the /model autocomplete work: adapter.py, one line in tests/gateway/conftest.py, and the new tests. The unrelated commits are gone from this branch, which also removes the shadowed handler at the old line 1345 — the duplicate-handler question no longer applies here.

Two of them have been reopened standalone, addressing your point directly rather than dropping them:

The cron and liveness changes were local-only and have been dropped rather than upstreamed.

One correction to the description, for the record: the autocomplete callback offloads the catalog build via asyncio.to_thread, since it reads the on-disk provider cache and doing that inline stalls the gateway on a cold cache.

@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary

Four PRs are grouped with this complex, but only #54338, #61593, and #77380 address Discord category policy; #65931 is unrelated searchable /model autocomplete work. Of the category-policy PRs, #54338 extends existing channel scopes, #61593 introduces separate allowed/free category scopes, and recorded best-fix #77380 implements the issue's free, ignore, and inverse require-mention rules.

Related pull requests

  • fix(discord): allow category-scoped channel policies #54338 partial — (+291/-36) — n/a: Extends the shared channel-key resolver with category IDs for allowed, ignored, free-response, no-mention admission, and slash paths, including channel/thread tests, but does not implement the issue's inverse require_mention_categories behavior. The contributor review says keep_open with medium salvageability after requiring preservation of existing key forms and coverage of the early admission path; the current diff contains those requested changes.
  • feat(discord): add category channel gates #61593 partial — (+612/-22) — n/a: Adds separate allowed_categories and free_response_categories configuration, thread-parent resolution, early admission handling, slash authorization, tests, and documentation, but its visible diff does not add ignored-category or inverse require-mention rules. The contributor review says keep_open with medium salvageability, and the later contributor correction explicitly treats this as a distinct API alternative rather than a duplicate of fix(discord): allow category-scoped channel policies #54338.
  • feat(discord): searchable /model autocomplete #65931 related — (+269/-1) — n/a: Implements authorized, searchable /model autocomplete with threaded catalog loading, filtering, Discord limits, intact model/provider values, and regression tests; it does not concern category mention or ignore rules. Its contributor review says keep_open with medium salvageability, and the visible diff reflects the documented follow-up by isolating autocomplete and skipping overlong values rather than truncating them.
  • feat(discord): support per-category mention and ignore rules #77380 best fix — (+639/-4) — best fix for feat(discord): support per-category mention and ignore rules #38539 and feat(discord): support per-category mention and ignore rules #38540: Adds free_response_categories, ignored_categories, and require_mention_categories, including channel/thread inheritance, precedence, ingress admission, configuration bridging, and focused tests; this directly implements both additive and inverse regional behavior from the issue. It is the recorded best-fix PR for both issues and carries both structural closes edges.

Duplicates

Issues #38539 and #38540 are duplicates, as confirmed by contributor discussion. No exact PR duplicates remain: #54338 overlaps through overloaded channel scopes, #61593 is a contributor-confirmed separate category-API alternative, #77380 is the broader three-rule implementation, and #65931 is unrelated.

Suggested consolidation

Keep #77380 open with a salvage path centered on its complete three-rule contract and tests, because it is the recorded best fix for both duplicate issues; treat #38539 as canonical and close #38540 as its duplicate. Do not close #54338 or #61593 as duplicates without resolving the documented API choice, and keep #65931 outside this complex under its existing keep-open review.

Cross-PR triage: Reviewed 4 pull requests and 2 issues in this complex. Each diff was read against this issue; Assessment working set: 114 kB of PR diffs, 26 kB of issue/PR text, 15 kB of discussion (16 comments), 8 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

/model is currently a free-text field, so switching models means recalling
an exact id. Add an autocomplete callback that live-filters every
authenticated provider's models as the user types, ranking the current
provider first so an empty query still surfaces the likely target.

The catalog is sourced from the same authenticated-provider list the
interactive picker uses, but uncapped, so all models are searchable rather
than the picker's first 50. It is cached briefly because the callback fires
on every keystroke, and the build is offloaded with asyncio.to_thread since
it reads the on-disk provider-model cache -- doing that inline stalls the
gateway on a cold or stale cache.

Choice.value is the literal /model argument and is later parsed for
--provider, so values that exceed Discord's 100-character cap are skipped
rather than truncated: a trimmed value silently becomes a different or
unresolvable switch target. Labels are display-only and are still
ellipsised to fit.

Authorization is pre-checked so the catalog is not leaked to unauthorized
users in the picker, and the callback never raises -- any failure yields an
empty suggestion list instead of a typing-time error popup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@FixItFoundry
FixItFoundry force-pushed the feat/discord-model-search-autocomplete branch from ee4a3c0 to 548f3d6 Compare August 24, 2026 13:18
@FixItFoundry

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (057dcdf236) and conflict-resolved — the single commit is now 548f3d6a12. The adapter change auto-merged cleanly; the only conflict was test-file placement in tests/gateway/test_discord_slash_auth.py (resolved by appending the new tests after the existing skill-handler tests). All 5 autocomplete tests pass (-k autocomplete). Mergeable ✅ — ready for review.

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

Labels

comp/cron Cron scheduler and job management comp/plugins Plugin system and bundled plugins needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have platform/discord Discord bot adapter sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants