Repository navigation
[WRONG BRANCH] release: promote dev 494c50d02f to main as 2.86.0 #7110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import type { OcxConfig } from "../types"; | ||
| import { AuxiliaryListenerBindError } from "../server/ports"; | ||
| import { createServer } from "node:net"; | ||
|
|
||
| /** | ||
| * Reject impossible auxiliary binds before startup creates private state. On Windows | ||
| * that publication requires several synchronous ACL subprocesses. This is only an | ||
| * early rejection: startServer still owns the actual bind and transactional rollback | ||
| * if another process takes the port between this probe and startup. | ||
| */ | ||
| export async function assertAuxiliaryListenerPortsAvailable(config: OcxConfig): Promise<void> { | ||
| const loopback = config.unauthenticatedLoopbackListener; | ||
| const management = config.runtimeRole === "hub" ? config.hub?.managementIngress : undefined; | ||
| const targets = [ | ||
| { listener: "unauthenticatedLoopbackListener", port: loopback?.enabled ? loopback.port : undefined }, | ||
| { listener: "hub.managementIngress", port: management?.enabled ? management.port : undefined }, | ||
| ] as const; | ||
| // Each probe releases its socket, so two listeners configured for one port would both | ||
| // pass and startup would still fail on the second bind. Reject the collision directly. | ||
| if (targets[0].port !== undefined && targets[0].port === targets[1].port) { | ||
| throw new AuxiliaryListenerBindError( | ||
| "hub.managementIngress", targets[1].port, "127.0.0.1", | ||
| new Error("port is also configured for unauthenticatedLoopbackListener"), | ||
| ); | ||
| } | ||
| for (const { listener, port } of targets) { | ||
| // The port-less companion shares the public bind; it has no independent target. | ||
| if (port === undefined) continue; | ||
| await new Promise<void>((resolve, reject) => { | ||
| const probe = createServer(socket => socket.destroy()); | ||
| const fail = (cause: unknown) => reject(new AuxiliaryListenerBindError(listener, port, "127.0.0.1", cause)); | ||
| probe.once("error", fail); | ||
| probe.once("listening", () => probe.close(error => error ? fail(error) : resolve())); | ||
| try { probe.listen({ port, host: "127.0.0.1" }); } catch (error) { fail(error); } | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /** | ||
| * Fire-and-forget work the process started and nobody awaits. | ||
| * | ||
| * A lazy quota prime or a startup reconcile is deliberately left running behind a | ||
| * request so the request never waits on it. The work still owns files: the pool | ||
| * prime holds the native-main claim database open across ACL hardening and a WHAM | ||
| * read. Whoever later removes the directory those files live in has to wait for the | ||
| * owner. Without a handle on the work there was nothing to wait for: test teardown | ||
| * spun a synchronous retry loop, which blocks the very event loop the owner needs to | ||
| * reach its `finally` and close the file. On Windows every overlap became a 15 s EBUSY. | ||
| * | ||
| * Registering costs one Set entry per in-flight task and changes nothing about how | ||
| * the work runs. Settling is opt-in: test teardown calls it; requests never do. | ||
| */ | ||
|
|
||
| interface BackgroundWork { | ||
| readonly label: string; | ||
| readonly settled: Promise<void>; | ||
| } | ||
|
|
||
| const inFlight = new Set<BackgroundWork>(); | ||
|
|
||
| /** Record `work` until it settles and return it unchanged. Rejections stay the caller's. */ | ||
| export function trackBackgroundWork<T>(label: string, work: Promise<T>): Promise<T> { | ||
| const entry: BackgroundWork = { | ||
| label, | ||
| settled: work.then(() => { inFlight.delete(entry); }, () => { inFlight.delete(entry); }), | ||
| }; | ||
| inFlight.add(entry); | ||
| return work; | ||
| } | ||
|
|
||
| /** Labels of work still running, for diagnostics. */ | ||
| export function pendingBackgroundWork(): string[] { | ||
| return [...inFlight].map(entry => entry.label); | ||
| } | ||
|
|
||
| export interface BackgroundWorkSettlement { | ||
| readonly settled: boolean; | ||
| readonly pending: string[]; | ||
| } | ||
|
|
||
| /** | ||
| * Wait until no tracked work is in flight, including work started by work that was | ||
| * already running. A bounded wait reports what is still running instead of throwing, | ||
| * so the caller decides whether that is fatal. | ||
| */ | ||
| export async function settleBackgroundWork(options: { timeoutMs?: number } = {}): Promise<BackgroundWorkSettlement> { | ||
| const deadline = options.timeoutMs === undefined ? Infinity : Date.now() + options.timeoutMs; | ||
| while (inFlight.size > 0) { | ||
| const remaining = deadline - Date.now(); | ||
| if (remaining <= 0) break; | ||
| const batch = Promise.all([...inFlight].map(entry => entry.settled)).then(() => false); | ||
| if (remaining === Infinity) { | ||
| await batch; | ||
| continue; | ||
| } | ||
| let timer: ReturnType<typeof setTimeout> | undefined; | ||
| const expired = new Promise<boolean>(resolve => { timer = setTimeout(() => resolve(true), remaining); }); | ||
| const timedOut = await Promise.race([batch, expired]); | ||
| clearTimeout(timer); | ||
| if (timedOut) break; | ||
| } | ||
| return { settled: inFlight.size === 0, pending: pendingBackgroundWork() }; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 42896
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 10137
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 21086
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 17200
Reject management-port collisions before public-port selection.
loadConfig()accepts a persisted configuration wherehub.managementIngress.portequals the public port. The load-time schema checks the management port range, but not its relationship toconfig.port.The new preflight checks that the management port is free, then public-port selection can choose that same port. Startup can then fail when both listeners bind it. Reject this collision before selection and exclude the management port from all public-port fallback choices.
🤖 Prompt for AI Agents