fix: improve gateway intents and auth error messages#328
Conversation
OpenAB PR ScreeningThis is auto-generated by the OpenAB project-screening flow for context collection and reviewer handoff.
Screening report## IntentThis PR is trying to make OpenAB fail clearly when Discord startup is misconfigured, instead of crashing with low-signal Serenity errors. The concrete operator-visible problem is that a bad bot token or missing privileged gateway intents currently leads to a startup failure that looks opaque enough to cause wasted debugging time and, in containerized deploys, repeated FeatThis is primarily a fix with a small docs improvement. Behaviorally, it changes Discord gateway startup so two common failure modes are translated into actionable messages:
It also updates the README to document the required Discord Developer Portal settings. Who It ServesThe primary beneficiary is deployers and maintainers running the Discord gateway, especially anyone standing up OpenAB for the first time or recovering from broken credentials. Secondarily, it helps reviewers and support operators because the failure mode becomes self-diagnosing. Rewritten PromptUpdate the Discord startup path to catch Merge PitchThis is a high-value, low-risk DX fix. It addresses a real startup footgun in the Discord integration and reduces wasted operator time without changing runtime behavior in healthy deployments. The likely reviewer concern is scope creep: whether this should become a broader startup-error framework or configurable intents work. The PR avoids that by targeting only the two highest-frequency misconfigurations and documenting the required setup. Best-Practice ComparisonRelevant OpenClaw principles:
Relevant Hermes Agent principles:
Net: this PR aligns with operational best practice on observability and operator guidance, but it is not a scheduler, persistence, or isolation change. The right comparison is not architecture depth; it is whether OpenAB surfaces actionable failure reasons at the gateway boundary. On that axis, this change is directionally correct. Implementation Options
Comparison Table
RecommendationRecommend the balanced path if the code stays small; otherwise accept the conservative version as-is. The core reason is that the problem is real and narrow, and OpenAB benefits immediately from clearer startup diagnostics. A tiny classification helper gives the next maintainer a cleaner place to add future Discord boot errors without turning this PR into an architecture project. If review pressure is to minimize surface area, merge the conservative form now and split any broader startup diagnostics work into a follow-up issue. |
|
@masami-agent This PR has merge conflicts and is marked git fetch upstream main
git rebase upstream/main
# resolve conflicts in src/main.rs
git push --force-with-lease |
Catch DisallowedGatewayIntents and InvalidAuthentication errors from Discord gateway with actionable error messages instead of cryptic serenity errors. Add prerequisites section to README documenting required Discord Developer Portal settings. Closes openabdev#116
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
|
Rebased onto current Conflicts resolved:
The diff is minimal: +1 import line, +18 lines for the match block in |
obrutjack
left a comment
There was a problem hiding this comment.
Rebased, CI green (all 7 smoke tests pass). Clean fix — catches DisallowedGatewayIntents and InvalidAuthentication with actionable error messages. README prerequisites section is a good addition. LGTM.
|
LGTM ✅ — Clean, minimal fix for a real DX footgun. One non-blocking NIT below. 四問框架 Analysis1. What problem does it solve? Bare 2. How does it solve it? Wraps
README gains a Prerequisites section documenting the required Developer Portal settings. 3. What was considered? Per #116 discussion: making intents configurable was considered and explicitly deferred — openab requires 4. Is this the best approach? Yes for the scope. The match patterns are correct for serenity 0.12.5. Error messages are actionable and include direct URLs. README addition is well-placed before the Quick Start steps. Traffic Light🟢 INFO — Correct 🟢 INFO — README Prerequisites section references existing 🟢 INFO — Minimal diff (+20/-1 in main.rs, +13 in README). No unnecessary changes. 🟡 NIT — // Cleanup
cleanup_handle.abort();
let _ = shutdown_tx.send(true);
// ... slack/gateway/cron handle joinsSince these errors occur at startup (before any sessions or adapters are active), the cleanup is effectively a no-op — so Baseline Check (Step 0)
Review by 超渡法師 · Four-monk collaborative triage in progress |
Summary
Closes #116
Catch
DisallowedGatewayIntentsandInvalidAuthenticationerrors from the Discord gateway with actionable error messages instead of cryptic serenity errors that cause CrashLoopBackOff with no guidance.Changes
src/main.rsclient.start().await?with match block catchingDisallowedGatewayIntentsandInvalidAuthenticationREADME.mdError messages
DisallowedGatewayIntents:
InvalidAuthentication:
What is NOT changed
Per discussion in #116:
config.toml— openab requiresMESSAGE_CONTENTto functionTesting
serenity::Error::Gateway(GatewayError::DisallowedGatewayIntents)andGatewayError::InvalidAuthenticationexist in serenity 0.12.50.7.2-beta.3(see Hardcoded privileged gateway intents cause CrashLoopBackOff with no actionable error message #116 comment)