Acknowledge Discord FAQ lookups and role changes before slow requests #20

Open
github-bot wants to merge 4 commits from github-bot/gh-20 into main AGit
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 13:25 UTC · original
RavenCurseBurg:fix/faq-reply-timeout → main · +259 −12 · 5 files · 4 commits · open

On a cold FAQ cache, Cal waits up to 15 seconds for the source before sending the first interaction response. Discord requires that response within three seconds. With the pinned discord.py library and a simulated 3.25-second source delay, the first response from the current bot was ready at 3.257 seconds. Discord interaction response deadlines

This change acknowledges a cold lookup with a private loading message. A list or error updates that message. A matching answer goes to the channel and removes the loading message. Warm-cache commands still reply once. Autocomplete waits up to one second and can use the last known choices. A slow refresh continues in the background, so the next keystroke or /faq command can reuse it.

The /updates command also made a network request before acknowledging the interaction. With a simulated 3.25-second role change, both subscribing and unsubscribing completed before the bot first replied. The command now acknowledges privately before adding or removing the role, then edits the private reply with the result. A missing role still gets an immediate reply.

Eight offline tests cover the FAQ and Updates callbacks, including a missing role and a denied role change. With a simulated 3.25-second delay, both role operations acknowledged in under a millisecond and edited the reply after the change. A separate in-memory check captured ten FAQ interactions with discord.py 2.5.2, including a public answer after a slow fetch.

The new regression test first reproduced two FAQ fetches on the previous PR head. With the fix, a timed-out autocomplete and a following command use one request. Against a loopback HTTP server, eight simultaneous lookups also shared one request. Later autocomplete calls found the new FAQ, a delayed HTTP 503 allowed a retry, and closing the bot cancelled an outstanding fetch.

Windows passed all eight bot tests, 44 tooling tests, ten app0 fixtures and three CTests. Linux passed all eight bot tests on Python 3.10.22 and 3.14.10 at ca14e8f. Linux verification jobs

CI now runs the bot tests when a pull request or push to main changes the bot or its test workflow. Upstream bot test run

AI-assisted with Codex + GPT-6.2 Astra (xhigh).

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 13:25 UTC · [original](https://github.com/JamesCicada/GTAVI-Recomp/pull/20) `RavenCurseBurg:fix/faq-reply-timeout` → `main` · +259 −12 · 5 files · 4 commits · open On a cold FAQ cache, Cal waits up to 15 seconds for the source before sending the first interaction response. Discord requires that response within three seconds. With the pinned discord.py library and a simulated 3.25-second source delay, the first response from the current bot was ready at 3.257 seconds. [Discord interaction response deadlines](https://docs.discord.com/developers/interactions/receiving-and-responding) This change acknowledges a cold lookup with a private loading message. A list or error updates that message. A matching answer goes to the channel and removes the loading message. Warm-cache commands still reply once. Autocomplete waits up to one second and can use the last known choices. A slow refresh continues in the background, so the next keystroke or `/faq` command can reuse it. The `/updates` command also made a network request before acknowledging the interaction. With a simulated 3.25-second role change, both subscribing and unsubscribing completed before the bot first replied. The command now acknowledges privately before adding or removing the role, then edits the private reply with the result. A missing role still gets an immediate reply. Eight offline tests cover the FAQ and Updates callbacks, including a missing role and a denied role change. With a simulated 3.25-second delay, both role operations acknowledged in under a millisecond and edited the reply after the change. A separate in-memory check captured ten FAQ interactions with discord.py 2.5.2, including a public answer after a slow fetch. The new regression test first reproduced two FAQ fetches on the previous PR head. With the fix, a timed-out autocomplete and a following command use one request. Against a loopback HTTP server, eight simultaneous lookups also shared one request. Later autocomplete calls found the new FAQ, a delayed HTTP 503 allowed a retry, and closing the bot cancelled an outstanding fetch. Windows passed all eight bot tests, 44 tooling tests, ten app0 fixtures and three CTests. Linux passed all eight bot tests on Python 3.10.22 and 3.14.10 at `ca14e8f`. [Linux verification jobs](https://github.com/RavenCurseBurg/GTAVI-Recomp/actions/runs/45733594469) CI now runs the bot tests when a pull request or push to main changes the bot or its test workflow. [Upstream bot test run](https://github.com/JamesCicada/GTAVI-Recomp/actions/runs/45733500227/job/139621053990) AI-assisted with Codex + GPT-6.2 Astra (xhigh).
Keep cached replies immediate. On a cold cache, acknowledge privately and update that reply for lists and errors. A matching answer still reaches the channel. Bound autocomplete waits and reuse the last good choices when the source is slow.

AI-assisted with Codex + GPT-6.2 Astra (xhigh).
AI-assisted with Codex + GPT-6.2 Astra (xhigh).
Install the pinned bot dependency in a temporary environment and exercise the registered commands on pull requests and main pushes that change bot files.

AI-assisted with Codex + GPT-6.2 Astra (xhigh).
Share each in-flight cache refresh with other callers. An autocomplete timeout can return the previous choices while the fetch finishes, and a following FAQ command can use the same request. Cancel pending refreshes when the bot closes.

AI-assisted with Codex + GPT-6.2 Astra (xhigh).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:44:32 +00:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/20/head:github-bot/gh-20'
git switch 'github-bot/gh-20'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-20'
git switch 'github-bot/gh-20'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-20'
git switch 'github-bot/gh-20'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-20'
git switch 'main'
git merge --squash 'github-bot/gh-20'
git switch 'main'
git merge --ff-only 'github-bot/gh-20'
git switch 'main'
git merge 'github-bot/gh-20'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.