GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — fix(cli): retry managed service binds after temporary conflicts by kitlangton · Pull Request #50782 · anomalyco/opencode Conversation
|
| What happens after the first bind conflict? | Before | After |
|---|---|---|
| Previous listener releases the port | Original startup still fails; a fresh process is needed | Original startup binds and becomes ready |
| Another OpenCode process registers | Recognize that owner and exit cleanly | Same |
| Unrelated process keeps the port | Bounded wait, then actionable conflict | Same |
| A different startup error occurs | Fail with that error | Same |
sequenceDiagram
participant P as Managed startup
participant L as Previous listener
participant R as Service registration
P->>L: Try to bind its port
L-->>P: EADDRINUSE
L->>L: Release the port
alt Before
loop Until recovery window ends
P->>R: Has another service registered?
R-->>P: No
end
Note over P: Reports conflict although the port is free
else After
P->>R: Has another service registered?
R-->>P: No
P->>P: Retry binding the same port
P->>R: Register this process
Note over P: Original startup becomes ready
end
The regression uses a real unrelated listener and the real CLI process. A stale fixture registration permits incumbent probes. The second probe can only happen after the initial bind has failed; that probe is the release barrier. The test frees the port at that boundary, then requires the original child PID to register and become healthy.
This distinguishes a recovered attempt from merely launching another process. The listener, registration, database, and home/config directories all belong to the test.
| Same positive regression | Observed result |
|---|---|
Base 43f1dad8e1 + the new test |
Fails: original child exits with the occupied-port diagnostic after release; no registration for its PID (17.01s test) |
| Fixed implementation + the same test | Passes: the original child registers and serves authenticated health on that port (4.35s runner) |
The test also stops the recovered service and checks that its registration and listener are released. Existing tests cover persistent/unresponsive occupancy, concurrent starts, a late incumbent, and reuse of an already-failed registered service.
This PR owns temporary bind-conflict recovery. #50784 independently preserves failures across client startup attempts. Free-port fallback admission has a separate ownership problem and proof.
cd packages/cli bun run test test/service.test.ts -t 'the original managed service contender' bun run test test/service.test.ts bun typecheck cd ../.. bun run check bunx prettier --check packages/cli/src/server-process.ts packages/cli/test/service.test.ts git diff --check
EISDIR registration failure during retry propagated immediately with its original diagnostic. These probes supplement the committed regression; they are not Windows/WSL coverage.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
5ffecc1 to
9f70a9e
Compare
9f70a9e to
48aa7cb
Compare
48aa7cb to
c3a48b6
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.