Skip to content

P5 O10 follow-up: the direct listener reports its addresses again after a restart (status bound after retire and provision) - #320

Merged
SSFSKIM merged 1 commit into
masterfrom
p5-o10-listener-report
Oct 29, 2026
Merged

SSFSKIM merged 1 commit into
masterfrom
p5-o10-listener-report

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 29, 2026

Copy link
Copy Markdown
Owner

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 mawsd on the acceptance VM. Afterwards mawsd endpoint status --json said listener: {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, and stop() never cleared that record.
  • A restart on the same addresses at the fixed port therefore never reported.
  • The endpoint's link status stayed at the {bound: false} that its stop and unenroll write (src/endpoint/endpoint.ts:466, :574).

The hub record was unaffected:

  • EndpointRecords is 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).
  • With the fix, the second report reaches 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

  • Failing first, before the fix:
    • npx vitest run test/endpoint/direct-listener.test.ts gave 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 at expect.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.
    • The fixture's loopback stand-in now answers the port the listener asked for, as a real fixed-port bind does. Before, a fresh ephemeral port on each bind hid the dedupe.
  • After the fix: direct-listener.test.ts 19/19 and provision.test.ts 22/22.
    • The delegated unenroll scene runs with MAWS_ENDPOINT_DIRECT=1 and the direct seam. 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.
    • Retire runs the same unenroll.
  • Neighbouring suites: endpoint-channels 9/9, channels 18/18, status 3/3.
  • Lint and types: eslint and tsc -p tsconfig.node.json are clean.
  • Gate: ci-gate --gates static,unit,probes,e2e:desk-web-hub --class1a pool --runner macos --lane hosted on fe00831. GREEN, run 40801804781, with no coverage warning.
  • Review: reviewer-low found it correct, with no material findings. It also checked a rescan racing stop: #stopped suppresses the report, and queued rescans can't overwrite the reset.

Residue

  • The VM's production mawsd still 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)

…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)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T01:49:36.158054Z fe00831 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit d566215 into master Oct 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 = [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

SSFSKIM added a commit that referenced this pull request Oct 29, 2026
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
SSFSKIM added a commit that referenced this pull request Oct 29, 2026
…; #320 and #321 recorded; flake rows tallied

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Oct 29, 2026
… — 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant