CopilotKit / CopilotKit/outpost
worker: PORT/HEALTH_PORT precedence is inverted relative to every sibling service
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 3
- Avg merge
- 7d 16h
- Merged PRs (30d)
- 15
Description
Found during the review of #180. Not changed there — altering port precedence on a hotfix risked the live deploy.
apps/worker/src/index.ts resolves process.env.PORT ?? process.env.HEALTH_PORT ?? '3003', preferring PORT. Every other health-serving app reads HEALTH_PORT only (apps/discord-bot, apps/slack-bot, apps/teams-bot, apps/linear-sync), reserving PORT for a separate listener. The worker is the outlier, and docs/deployment.md already documents the asymmetry as known.
Three concrete problems:
- Whenever the platform injects
PORT, the app binds it whileENV HEALTH_PORT=3005andEXPOSE 3005say otherwise. #180 made the Dockerfile HEALTHCHECK follow the same precedence as a stopgap, but the underlying disagreement remains. PORT=""(a cleared platform variable) yieldsparseInt('')→NaN, andlisten(NaN)throwsERR_SOCKET_BAD_PORTsynchronously at module scope — the process dies before binding, producing the same opaque "replicas never became healthy" signal as the original incident.- The code's
3003fallback disagrees with the Dockerfile's 3005 and collides with teams-bot's port.
Also worth fixing alongside: healthServer has no 'error' listener, so EADDRINUSE/EACCES is an uncaught exception with a bare stack trace.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/worker/src/index.ts, then compare port handling with apps/discord-bot, apps/slack-bot, apps/teams-bot, and apps/linear-sync. Review the Dockerfile and docs/deployment.md for the documented port contract. Done means the worker's configured health port, fallback, Docker health check, and server error behavior no longer disagree or fail opaquely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dockerfile, typescript
- Domain
- backend, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100