Fix enrolled host daemon port collisions - #1155
Conversation
|
🚨 SLOP COP 🚨 · I am SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, duplication, and end-to-end behavior. I will post one final review after the parallel checks finish. |
SawyerHood
left a comment
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
ELI5
Each daemon needs a different port.
This change chooses one, but some Linux and multi-install cases can still choose or use the wrong port.
Findings
I found four issues:
- High: An active Linux service does not restart after its unit changes.
- Medium: Custom
BB_DATA_DIRdaemons do not reserve their ports globally. - Medium: Concurrent installers can select the same port.
- Medium: The tests require fixed ports that real enrolled daemons can already use.
I left an inline comment for each issue. I would fix these issues before merge.
Security and performance
I found no new critical security boundary.
The allocation race can still cause EADDRINUSE. A failed connection loop can also take about 105 seconds.
Architecture
The shell script now repeats port validation, allocation, URL normalization, and status parsing.
A typed bb-app allocation command could own this policy. A global registry and lock could make reservations complete and atomic.
The daemon protocol version does not need a change because this pull request does not change the server-daemon wire contract.
Validation
Three GPT-5.6-Sol agents reviewed security, quality, performance, architecture, and end-to-end behavior. A final GPT-5.6-Sol gate confirmed the four findings.
- All affected Turbo type checks passed.
- The host-daemon tests passed.
- The bb-app launcher tests passed.
- The server suite passed 1,344 tests and failed two installer tests.
- One failure confirmed the fixed-port defect.
- The other failure exposed incomplete
PATHisolation in the npm fallback fixture. - The live launcher check accepted the correct enrolled daemon in 21 milliseconds.
- The live launcher check rejected a wrong host identity in 207 milliseconds.
- No browser test applied because this change has no browser route.
I used a comment-only review. I did not approve or request changes through GitHub.
2014362 to
83d2be7
Compare
Summary
/status, requiring the expectedhostId, normalizedserverUrl, and an active server connectionEADDRINUSEand service startup failures into actionable bb-authored diagnosticsTesting
sh -n apps/server/src/assets/install-machine.shpnpm exec turbo run typecheck --filter=@bb/host-daemon --filter=bb-app --filter=@bb/serverpnpm exec turbo run test --filter=@bb/host-daemon --force -- --run src/local-api.test.tspnpm exec turbo run test --filter=bb-app --force -- --run test/index.test.tspnpm exec turbo run test --filter=@bb/server --force -- --run test/app/install-machine-script.test.ts test/app/skeleton.test.tsFixes #1121