Files
Huyvux12andColumbina 390535bbd4 fix(minecraft): explain AIRI authentication failures (#2750)
## Summary

Minecraft authentication failures looked like an unavailable AIRI server
and produced duplicate warnings. Report the token setup instructions for
server authentication errors.

- Use the existing server error classifier.
- Report authentication once across `onError` and `connect()` rejection.
- Keep authentication guidance visible after an earlier network failure.
- Clear the warning flags after a successful connection.
- Add `AIRI_WS_TOKEN` to the environment template and setup
instructions.

Related to #2071 and the maintainer's token diagnosis. This change
corrects diagnostics and setup guidance. It does not replace the SDK
authentication or retry policy.

## Behavior evidence

| Scenario | Before | After |
| --- | --- | --- |
| Missing or invalid token | Server-unavailable or generic
stopped-retrying warning | Token setup instructions |
| Same authentication error reaches both callbacks | Two warnings | One
authentication warning |
| Network failure precedes authentication failure | Initial warning
hides the later cause | Authentication guidance remains visible |
| Connection succeeds, then authentication fails again | Generic
connection warning | New token guidance |

## Verification

Updated against `main` at `450c5d81dcf2b63811c2aa554bb562ae6fb758a4`.
Merge commit: `a3967e615a3c6ef1d1166355dc0cb11dfd4c14f7`.
The published tree matches the locally tested tree:
`01799b54b8e264d56a9234488cc8246ce4b2eeb7`.
The PR still changes only the original six files.

Checks on the combined revision:

- `pnpm install --frozen-lockfile --ignore-scripts`: passed.
- `pnpm run build:packages`: 34 tasks passed.
- `pnpm -F @proj-airi/minecraft-bot exec vitest run src/airi`: 3 files,
14 tests passed. Includes real loopback WebSocket handshakes with
missing and invalid tokens.
- `pnpm exec vitest run --config
apps/stage-tamagotchi/vitest.node.config.ts
src/main/services/airi/plugins/index.test.ts`: 64 tests passed.
- `pnpm lint`: passed with 0 errors and 694 warnings.
- `NODE_OPTIONS=--max-old-space-size=4096 pnpm exec turbo run typecheck
--concurrency=1 -F='./packages/*' -F='./apps/*' -F='./server/**'
-F='./services/*' -F='./docs'`: 55 tasks passed. Default parallel runs
exceeded the local memory limits.
- `git diff --check`: passed.

Remaining limits:

- `pnpm -F @proj-airi/minecraft-bot typecheck`: 12 diagnostics outside
the changed files. A detached worktree at the current main commit
reports the identical 12 diagnostics with the same dependencies.
- `pnpm exec vitest run`: 2,455 tests passed, 2 failed, 3 skipped, and 1
browser setup error. One failure needs Chromium. The other is an IPv6
auth rate-limit test timeout. The same timeout also occurs in a detached
worktree at current main. The previous extension-host CI failure did not
recur in this run.
- `pnpm exec playwright install chromium` failed because the browser
download was invalid. The complete `pnpm test:run` browser sequence
remains unverified.
- Local checks used Node 24.19.0 and pnpm 11.25.0. CI uses Node 26.7.0
and the repository package manager.
- A real Minecraft gameplay session was not run.

The new upstream CI run requires maintainer approval before it can
execute:
https://github.com/moeru-ai/airi/actions/runs/37126204012

Co-authored-by: Columbina <140679517+0xSelenicDove@users.noreply.github.com>
2026-10-03 22:57:27 +00:00
..
2026-08-26 20:13:10 +08:00
2026-08-26 20:13:10 +08:00
2026-08-26 20:13:10 +08:00
2026-08-30 02:31:30 +08:00
2026-08-30 02:31:30 +08:00