Repository navigation
P5 O10 follow-up: the direct listener reports its addresses again after a restart (status bound after retire and provision) - #320
Conversation
…tart
stop() never cleared what the listener last reported, so a start on the same
address set skipped the report, and the endpoint's status kept the
{bound: false} its unenroll or stop wrote. After a retire or unenroll and a
provision in one mawsd, `endpoint status` read the listener unbound while it
served. stop() now forgets the reported set; the endpoint record is unaffected
(its addresses are kept and re-signed at the next welcome).
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe008315ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await this.#serial(async () => { | ||
| for (const address of [...this.#bound.keys()]) this.#unbind(address); | ||
| for (const client of this.#wss.clients) client.terminate(); | ||
| this.#reported = []; |
There was a problem hiding this comment.
Distinguish an unreported restart from an empty address set
If the listener previously advertised addresses, then stops and restarts after the tailnet disappears or all binds fail, resetting #reported to [] makes #report() suppress the empty-set notification. Endpoint.#unenroll() retains endpointRecords.addresses, and the listener callback is its only updater, so the endpoint continues signing and publishing the old, unreachable URLs on subsequent hub welcomes. Previously, the empty set differed from the remembered addresses and cleared the record. Use an unreported sentinel or force the first post-restart report, including when no addresses bind.
Useful? React with 👍 / 👎.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
… — a listener bound by its sockets counts where the status flag is stale (#320), the lane A log baseline is 0 for a project the hub does not know yet, the stub's check runs as the owner Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
P5 O10 follow-up: after the endpoint's direct listener stops and starts again on the same addresses, it reports them again.
The defect
O14's B1 ran a retire and then a provision in one
mawsdon the acceptance VM. Afterwardsmawsd endpoint status --jsonsaidlistener: {bound: false}, although the log showed the listener rebound to the same addresses (ws://100.116.205.27:47830,[fd7a:115c:a1e0::1734:cd1d]:47830).DirectListener.#report()(src/endpoint/direct-listener.ts) skips a report when the set matches the one it last reported, andstop()never cleared that record.{bound: false}that its stop and unenroll write (src/endpoint/endpoint.ts:466,:574).The hub record was unaffected:
EndpointRecordsis built once per endpoint (endpoint.ts:209), and unenroll leaves it alone, so its addresses survive (listings.ts:295) and every welcome re-signs them (endpoint.ts:181).setAddresses, which sees an unchanged set and sends nothing (listings.ts:322).The fix
stop()clears the last-reported set inside its serialized teardown, after the addresses are let go.Validation Evidence
npx vitest run test/endpoint/direct-listener.test.tsgave 1 failed, 18 passed. The new case runs start, stop, start on the fixed port 47830, and saw one report where it expected two.npx vitest run test/endpoint/provision.test.ts -t 'on a delegated endpoint'failed atexpect.poll(() => endpoint.status().listener.bound).toBe(true), which received false after the re-provision. That is the VM's defect, reproduced against desk-hub's local runner.direct-listener.test.ts19/19 andprovision.test.ts22/22.MAWS_ENDPOINT_DIRECT=1and thedirectseam. It checks that the listener is bound after the first provision,{bound: false}right after the unenroll, and bound again after the re-provision, with the record still naming the URL.endpoint-channels9/9,channels18/18,status3/3.tsc -p tsconfig.node.jsonare clean.ci-gate --gates static,unit,probes,e2e:desk-web-hub --class1a pool --runner macos --lane hostedon fe00831. GREEN, run 40801804781, with no coverage warning.#stoppedsuppresses the report, and queued rescans can't overwrite the reset.Residue
mawsdstill shows the stale flag until it restarts or its release moves to a master with this fix. That is recorded under M11.Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)