Skip to content

Make no-flag web listener test independent of host port 4620 #1958

Closed

Description

@currentbits

The no-flag listener probe in electron/test/web.test.js fails when a legitimate Solenta process already owns 127.0.0.1:4620. Unchanged main b40f170 and usage integration 0a1420c fail identically; evidence: /tmp/solenta-usage-baseline-port-probe.log and /tmp/solenta-usage-batch-electron.log. No product web files changed in the usage batch.

Deduplication: searched existing issues for 4620, no-flag, and web.test.js. #80 concerns product boot on bind failure; #535/#536 describe older packaging/fixture failures. None tracks this host-port assumption.

Plan:

  • Reproduce in this thread's isolated worktree and confirm import-time behavior.
  • Replace host-port probing with a fresh-child deterministic listener-creation assertion; add positive and foreign-port controls.
  • Run web/serve-web integration coverage, annotate the diff, and report separately from the usage feature PR.

Do not stop the running app, change real settings, or reduce serve-web integration coverage.

Activity

  1. added
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Nov 8, 2026
  2. currentbits commented on Nov 8, 2026

    @currentbits
    OwnerAuthor

    Progress: reproduced the original EADDRINUSE failure on unchanged a7e52e3c in this thread's isolated worktree (branch coder/fix-no-flag-listener-probe). Read-only lsof identified Solenta PID 64963 owning 127.0.0.1:4620; it was left running.

    Implemented a fresh-child import guard at net.Server.prototype.listen, covering HTTP/HTTPS's inherited listen path. The child fails even if the module catches the guard error, and waits through scheduled callbacks. Its HOME/config paths are temporary, inherited CODER_* and NODE_OPTIONS are stripped, and a timeout bounds leaks. Six focused checks pass: actual module imports, default port held by another process, TCP/HTTP startup controls, deferred startup, and caught startup error. Existing real socket coverage is unchanged.

    Plan status: reproduction and implementation done; integration validation and review annotation in progress. Evidence: /tmp/solenta-no-flag-before.log and /tmp/solenta-no-flag-after.log.

  3. currentbits commented on Nov 8, 2026

    @currentbits
    OwnerAuthor

    Validation update: all 78 tests in web.test.js, web-integration.test.js, webAccess.test.js, webDevices.test.js, webScopes.test.js and web-run-artifacts.test.js pass with Node 22.23.2 and sanitized provider environment. /tmp/solenta-web-listener-integration.log.

    A standalone control starts a real HTTP listener on an ephemeral port (exit 0), then importing the same code through the guard rejects it with Unexpected listener creation (exit 1): /tmp/solenta-listener-positive-control.log. The legitimate Solenta process remains on 4620.

    Project-wide npm test is still running. Core (38) and renderer (3,189) pass. Electron has five independently reproduced failures in the unchanged budget-spend.test.js fixed-August-date fixtures, now beyond the 90-day retention window. A separate suggested-work chip records that issue; no usage/product files changed. Evidence: /tmp/solenta-budget-date-baseline.log. Review itinerary written at .solenta/review-itinerary/35257743-c5df-4190-ab76-359bac71617e.json.

  4. added
    plan:done
    and removed
    plan:doing
    on Nov 8, 2026
  5. currentbits commented on Nov 8, 2026

    @currentbits
    OwnerAuthor

    Implemented and validated in independent commit a38fc6e6 on coder/fix-no-flag-listener-probe in this thread's isolated worktree. No changes to product web files or the usage feature PR; this commit has not been merged.

    Completed plan:

    • Reproduced the old assertion while read-only lsof showed the legitimate Solenta app holding 127.0.0.1:4620.
    • Added a fresh-child net.Server.listen guard before module imports, with temporary settings/config paths and a bounded timeout. It rejects even swallowed/deferred listener attempts.
    • Proved actual imports pass with foreign default-port occupancy, TCP/HTTP/deferred/caught-error controls fail as intended, and a standalone real HTTP listener starts normally but is rejected by the guard.
    • All 78 targeted web/serve-web tests pass, including existing real-socket integration coverage. git diff --check passes. Review itinerary written at .solenta/review-itinerary/35257743-c5df-4190-ab76-359bac71617e.json.

    Full npm test completed: core 38/38, renderer 3189/3189, memory 246/246, stats 27/27 pass; Electron 5012 passed, 6 failed, 3 skipped. All six failures independently reproduce in unchanged files:

    1. budget-spend.test.js — recordSpend accumulates into local day key and persists
    2. budget-spend.test.js — recordUsage accumulates per day/provider/model and persists
    3. budget-spend.test.js — recordUsage keeps a kimi all-zero turn (Usage view: kimi is invisible, Claude's tokens are ~1000x under, and the breakdown should go past model #556)
    4. budget-spend.test.js — old usage cells missing cache/waste fields load as 0
    5. budget-spend.test.js — usageThreadsByDay accumulates per thread, labels, persists, and prunes at 90 days
    6. site-llms.test.js — llms-full.txt matches docs.html (run node scripts/build-llms.js)
      The first five use August fixture dates now outside retention; a separate suggested-work chip records them. None was changed here.

    Logs: /tmp/solenta-no-flag-before.log; /tmp/solenta-no-flag-after.log; /tmp/solenta-listener-positive-control.log; /tmp/solenta-web-listener-integration.log; /tmp/solenta-no-listener-full-test.log; /tmp/solenta-budget-date-baseline.log; /tmp/solenta-llms-baseline.log.

    Final read-only lsof still shows the same Solenta PID 64963 listening on 4620. No app stop or real settings changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions