Skip to content

Let the files worker boot: make Redis optional in the management-key guard - #1526

Merged
helpcodeai merged 2 commits into
mainfrom
fix/files-worker-guard-redis
Nov 5, 2026
Merged

helpcodeai merged 2 commits into
mainfrom
fix/files-worker-guard-redis

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

Summary

Since the Cloud deploy of 11-04 19:08 UTC, the File Search worker (amcp-cloud-files-worker) does not start. It has exited with code 1 more than 740 times:

UnknownDependenciesException: Nest can't resolve dependencies of the JwtOrManagementKeyGuard (PrismaService, ?) … RedisService … SettingsModule

b26c477 (management API keys) put JwtOrManagementKeyGuard on the settings controllers. The guard needs RedisService for its per-key rate limit. The worker imports SettingsModule but not RedisModule, and Nest builds a controller's guards when it compiles the module, so the worker stops at boot. Since then no File Search sync has run, and "Test connection" on a file source fails ("files-worker /internal/test failed: fetch failed"). The blue/green deploy check only boots the backend, so the deploy passed anyway.

Changes

  • RedisService is now @Optional() in the guard. Without Redis, the per-key rate limit falls open, which is what it already did when Redis is disconnected. Nothing changes in the backend, which loads RedisModule globally.
  • The guard's doc comment explains why Redis is optional.
  • New spec jwt-or-management-key.guard.boot.spec.ts: it compiles a module with a guarded controller and no RedisModule. Without the fix it fails with the same error as production.
  • No change under ee/.

Type

  • Bug fix

Testing

  • Added/updated unit tests
  • packages/backend: the new spec fails without the fix (Nest can't resolve dependencies of the JwtOrManagementKeyGuard (PrismaService, ?)) and passes with it.
  • npx jest src/auth src/settings: 38 suites pass. jwt-or-management-key.guard.spec.ts fails locally only because it needs a real database (prisma.$connect), which CI provides.
  • eslint on the changed files is clean. Locally, tsc reports only missing modules in my checkout (picomatch types, @aws-sdk/client-s3, basic-ftp, ssh2), none in the changed files. CI runs the full checks.

Checklist

  • My code follows the existing code style
  • I have tested my changes locally
  • I have updated documentation (if applicable): not needed
  • All existing tests pass (CI)
  • This PR has a descriptive title

Related Issues

Found in the 2026-11-05 daily check: Cloud files-worker crash loop.

Deployment: on Cloud this lets amcp-cloud-files-worker start again. On self-hosted it fixes the same crash for anyone who runs the files Compose profile on a build that contains b26c477. The backend behaves the same in both.

@helpcodeai
helpcodeai enabled auto-merge (squash) November 5, 2026 08:18
@helpcodeai
helpcodeai merged commit 62edff9 into main Nov 5, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the fix/files-worker-guard-redis branch November 5, 2026 08:33
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant