Skip to content

Wire WORKER_ENABLED into docker-compose so schedules actually run - #151

Merged
buzz-code merged 1 commit into
mainfrom
claude/worker-enabled-env
Aug 23, 2026
Merged

buzz-code merged 1 commit into
mainfrom
claude/worker-enabled-env

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Summary

Root cause of schedules.nextRunAt/lastRunAt staying null forever and jobs never running: WORKER_ENABLED (checked by JobWorkerService.isEnabled(), gates both the schedule heartbeat tick and the job worker poll) was never passed through docker-compose to the server service — it only existed as process.env.WORKER_ENABLED with nothing setting it.

  • .env.template — add WORKER_ENABLED=true (documented, defaulted on for the common single-container deployment)
  • docker-compose.yml / docker-compose-swarm.yml — pass WORKER_ENABLED through to the server service's environment

Note for whoever deploys this

The .env files on actual running hosts (not tracked in git) need WORKER_ENABLED=true added and the server container restarted for this to take effect — this PR only fixes the template/compose wiring.

🤖 Generated with Claude Code


Generated by Claude Code

Schedule.nextRunAt/lastRunAt and the job worker's poll both no-op
unless WORKER_ENABLED=true is set on the server process
(JobWorkerService.isEnabled()) - it wasn't passed through in either
compose file, so schedules (e.g. attendance-cleanup-sweep) never ran
regardless of the schedules table row being correctly configured.

- .env.template: default WORKER_ENABLED=true
- docker-compose.yml / docker-compose-swarm.yml: pass it to the
  server service's environment

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dEYULADLgGNfZ4nv6gz8s
Copilot AI lite review requested due to automatic review settings August 23, 2026 19:02
@buzz-code
buzz-code merged commit e83be57 into main Aug 23, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Compose wiring still disables worker when env var missing (empty string), plus template comment needs scaled-deploy warning to prevent multi-replica schedule double-fire.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Wire WORKER_ENABLED env var into docker-compose server container so job worker poll + schedule heartbeat tick can run in Docker deployments, unblocking schedules.nextRunAt/lastRunAt updates.

Changes:

  • Add WORKER_ENABLED=true to .env.template
  • Pass WORKER_ENABLED into server service env for docker-compose.yml
  • Pass WORKER_ENABLED into server service env for docker-compose-swarm.yml
File summaries
File Description
docker-compose.yml Add WORKER_ENABLED to server container environment
docker-compose-swarm.yml Add WORKER_ENABLED to server container environment (swarm stack)
.env.template Document default WORKER_ENABLED=true for job worker + scheduler
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docker-compose.yml Resolved
Comment thread docker-compose-swarm.yml Resolved
Comment thread .env.template Resolved
buzz-code pushed a commit that referenced this pull request Aug 23, 2026
Addresses Copilot review comments on PR #151: 'WORKER_ENABLED: $WORKER_ENABLED'
substitutes an empty string (not the .env.template-documented default
of true) when the var is missing from the actual deployed .env -
silently disabling the worker/heartbeat. Use Compose's default
interpolation instead, and clarify in .env.template that this must
stay true on only one instance in a scaled deployment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dEYULADLgGNfZ4nv6gz8s
buzz-code added a commit that referenced this pull request Aug 23, 2026
Follow-up to #151, which merged before these Copilot review comments
were addressed: 'WORKER_ENABLED: $WORKER_ENABLED' substitutes an
empty string (not the .env.template-documented default of true) when
the var is missing from the actual deployed .env - silently disabling
the worker/heartbeat. Use Compose's default interpolation instead, and
clarify in .env.template that this must stay true on only one instance
in a scaled deployment.


Claude-Session: https://claude.ai/code/session_011dEYULADLgGNfZ4nv6gz8s

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants