Skip to content

feat(discord): make interactive view timeout configurable via approvals.discord_prompt_timeout - #45904

Closed
cruzanstx wants to merge 1 commit into
NousResearch:mainfrom
cruzanstx:fix/discord-prompt-timeout-configurable
Closed

feat(discord): make interactive view timeout configurable via approvals.discord_prompt_timeout#45904
cruzanstx wants to merge 1 commit into
NousResearch:mainfrom
cruzanstx:fix/discord-prompt-timeout-configurable

Conversation

@cruzanstx

Copy link
Copy Markdown
Contributor

Summary

Fixes #45903 — Discord interactive views (ExecApprovalView, SlashConfirmView, UpdatePromptView, ClarifyChoiceView) all hardcoded their timeout= to 300s with no config exposure. Users who walk away from a long session for >5 min lose the UI affordance even though the underlying agent thread is still parked.

Adds approvals.discord_prompt_timeout (seconds). Default 300s preserves existing behavior; clamped to [30, 900] so:

  • a typo (e.g. 5) can't make prompts disappear before the user can read them
  • a value beyond Discord's ~15-min interaction-token expiry can't outlive the API's own lifecycle

ModelPickerView intentionally keeps its 120s timeout — that view is a quick-pick UX surface, not a confirmation, and reusing the same knob would make the picker feel sluggish at higher values.

A crashing read_raw_config (corrupt config file) falls through to the historical 300s default rather than blowing up view construction.

Implementation

  • New _read_discord_prompt_timeout() next to _read_dm_role_auth_guild() — same pattern, same defensive shape
  • _DISCORD_PROMPT_TIMEOUT_DEFAULT = 300, _MIN = 30, _MAX = 900 as module constants so tests can assert behavioral parity
  • Four super().__init__(timeout=300) sites replaced with timeout=_read_discord_prompt_timeout()

Test plan

  • 14 new tests in tests/gateway/test_discord_prompt_timeout_config.py covering: default-on-missing-config, default-on-missing-block, default-on-missing-key, explicit int, numeric string, malformed value, clamp-low, clamp-high, zero, negative, empty string, config-read exception, 300s parity assertion, clamp-range-includes-default invariant
  • Full Discord gateway suite passes (479 of 480; 1 pre-existing env-dependent failure unrelated to this change)
  • Live-tested on a Discord gateway — set value of 900s, gateway picks it up, approval views stay clickable for 15 min

Generated with Claude Code via Happy

ExecApprovalView, SlashConfirmView, UpdatePromptView, and ClarifyChoiceView
all hardcoded their button-view lifetime to 300s. Users on long-running
sessions who step away briefly come back to "Prompt expired — no action
taken" with no config knob to extend it.

Add `approvals.discord_prompt_timeout` (seconds). Default 300s preserves
existing behavior; clamped to [30, 900] so a typo can't make prompts
disappear (too short) or outlive Discord's ~15-minute interaction-token
expiry (too long).

ModelPickerView's 120s timeout is intentionally left alone — that view
is a quick-pick UX surface, not a confirmation, and conflating them would
make the picker feel sluggish.

A crashing read_raw_config falls through to the historical default rather
than failing view construction, so a corrupt config file can't lock the
user out of the approval flow.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter P3 Low — cosmetic, nice to have labels Jun 14, 2026
AIalliAI added a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
AIalliAI added a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
teknium1 added a commit that referenced this pull request Jul 7, 2026
Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR #45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
@teknium1

teknium1 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Merged via #60230 - the timeout portion of your PR was reapplied with credit (Co-authored-by, commit afb5808; direct cherry-pick was not possible because the commit was authored under a placeholder identity). The channel-context/embed-backfill changes bundled in the same commit were intentionally excluded - they will be evaluated with the thread-context-backfill PRs. Thanks!

@teknium1 teknium1 closed this Jul 7, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…ch#60230)

Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR NousResearch#45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
justemu pushed a commit to justemu/hermes-agent that referenced this pull request Jul 18, 2026
…ch#60230)

Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR NousResearch#45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…ch#60230)

Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR NousResearch#45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…ch#60230)

Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR NousResearch#45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…ch#60230)

Discord's ExecApprovalView, SlashConfirmView, UpdatePromptView, and
ClarifyChoiceView hardcoded timeout=300, ignoring approval timeout
configuration. All four now read approvals.discord_prompt_timeout from
config.yaml (default 300s, clamped 30-900s — Discord interaction tokens
expire at ~15 min, so values beyond 900s would render dead buttons).

Surgical reapply of the timeout portion of PR NousResearch#45904; the unrelated
channel-context changes bundled in that PR were intentionally excluded.

Co-authored-by: cruzanstx <cruzanstx@users.noreply.github.com>
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 type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord interactive-view timeout is hardcoded to 300s — make it configurable

3 participants