Skip to content

test(session-manager): keep closedPort() from handing out a port another test listens on #5346

Closed

Description

@tale-review-bot

What fails. The Session Manager unit test "writes an IPv6 target in brackets and a name in punycode" (services/session-manager/backend/domains/proxies/connect.test.ts:157) sometimes fails and then passes on a re-run.

  • Where it was seen. The v0.5.98 release candidate's Checks run 41682084649:

    • attempt 1 failed in the job "Unit (workspaces)" (126078190748);
    • attempt 2 passed at 2026-11-03T17:43:56Z.

    The release lane's lease comment on chore: merge train 20261103-1528 #5345 names this test as attempt 1's only failure.

  • Cause, as the release lane found it. closedPort() (services/session-manager/backend/testing/local-proxies.ts:1076) starts a TCP server, stops it and returns that server's port.

    • Once the server stops, nothing holds the port, so the system can give it to the next server another test starts.
    • A test that expects a refused connection then reaches that server instead.
    • connect.test.ts and exit-ip.test.ts both use closedPort().

Done when:

  • every test that needs a port that refuses connections gets one that no other test can be handed while it runs;
  • the proxies tests pass when they are run many times over in one process.

The hand-over gives the command that showed this and its outcome. How the port is held is the implementer's choice.

Line: stable. The Session Manager ships on main and in v0.5.98.

Related: #5199, about main's checks that fail and then pass on a re-run.

Activity

  1. tale-review-bot commented on Nov 3, 2026

    @tale-review-bot
    CollaboratorAuthor

    Decision: the flaky Session Manager unit test from the v0.5.98 candidate gets a fix of its own. It is filed as #5346 and carried by board task TALE-433, in To do, as a stable-line bug at p1. Decided in the Lead's 18:00 UTC Decide sweep of 2026-11-03 (TALE-292, run e006a3bd).

    The question: does the race in closedPort() get a change of its own, or only a note on #5199?

    What I checked:

    • Where it failed. On tale-project/tale at 6a4ff01715e52a3fce53b33b4d41208bd84c2dd6 (the v0.5.98 candidate, the head of main), attempt 1 of Checks run 41682084649 failed in the job "Unit (workspaces)" (126078190748). Attempt 2 passed at 17:43:56Z.
    • Which test. The release lane's lease comment on chore: merge train 20261103-1528 #5345 names the failed test: "writes an IPv6 target in brackets and a name in punycode" (services/session-manager/backend/domains/proxies/connect.test.ts:157).
    • The cause. closedPort() at services/session-manager/backend/testing/local-proxies.ts:1076 stops its server and only then returns the port. From then on nothing holds the port, so another test's server can be given it before the caller connects. connect.test.ts and exit-ip.test.ts both use the helper.

    The options:

    1. Only a note on ci: main's Checks fail on 14 of 18 pushes since 2026-10-26 on checks that pass on a re-run, and main's Build times out on every push #5199. It costs nothing now, but nothing picks the race up: ci: main's Checks fail on 14 of 18 pushes since 2026-10-26 on checks that pass on a re-run, and main's Build times out on every push #5199 is the maintainers' umbrella issue for flaky main checks, and it carries needs discussion and no agent-ready.
    2. An issue and a task of their own. It costs one small change, to test code only. Nothing Tale ships changes.

    What I decided: option 2.

    • A check that fails at random costs every train and every release candidate a rerun.
    • It also teaches people to rerun red checks, and that hides real failures.

    Done means:

    • every test that needs a port that refuses connections gets one that no other test can be handed while it runs;
    • the proxies tests pass when they are run many times over in one process, and the hand-over gives the command and its outcome;
    • nothing outside the Session Manager's test helpers and tests changes.

    Left to the Coder: how the port is held, and whether closedPort() is fixed or replaced.

    Kind and priority: bug (a flaky check), p1. A rerun passes, so on its own it breaks no train or release. It goes to p0 if it fails a train's pull request or a release candidate again.

    Issue filed: #5346, with bug and without agent-ready. The Lead adds agent-ready only to parts split off an issue that carries it. If intake imports #5346 anyway, the imported task is kept and TALE-433 is cancelled as its duplicate.

    The squash message is a test(session-manager): … commit ending with Closes #5346.

    Line: stable

    Next: @coder, dispatch starts you on TALE-433.

    What would change this: a maintainer's answer on #5346 or #5199 that wants the flake handled another way.

    How this task lands now: branch from origin/<the train of its line>
    (train or feature-train) and record that commit as the base; open no pull
    request, and close one the task still has. Hand over on this task (train,
    branch, full head, base, the gate you ran, and the squash message ending with
    Closes #<n> or Refs #<n>), mentioning @Reviewer, then move it to In review
    and wake the Reviewer: task_start_agent with agentId 13642abb-858d-5e1b-b1bd-fad0aa5b8210, moveToInProgress false, a feedback that names the task to review (TALE-<n>) and its head, and as taskId the review task for that task's number modulo 4 (0 ecd5f981-28a9-52d2-b777-5709ba608ab3, 1 1cc61d5a-14f7-5e87-8ebc-8c140ba87394, 2 99c3b59d-9d31-5563-8c14-c4790b001a69, 3 2ae0a313-280c-5288-91a7-a0138f3cdc60); when it answers already_running, wait a minute (sleep 60) and call once more, and when it refuses (paused: three starts within the hour; or another agent started your run, which may not start a third), say so on the task and in your receipt: the next wake or the 8-hourly sweep takes it up. A question for the Lead: comment Needs a decision: mentioning
    @Lead, move the task to Backlog and wake the Lead: task_start_agent with taskId 3a4ce694-8041-507b-9d1d-e6db145fd2a7 (its role task Decide), agentId bb96ec41-89a9-5c51-b719-ae65c70bddf7, moveToInProgress false and a feedback that names the task that asks (TALE-<n>) and the question in a line; when it answers already_running, wait a minute (sleep 60) and call once more, and when it refuses (paused: three starts within the hour; or another agent started your run, which may not start a third), say so on the task and in your receipt: the next wake or the 8-hourly sweep takes it up. The Lead's decision above
    settles what the task asked a person; a technical choice is yours to make and
    record in the plan (Development's "Who decides"). This replaces whatever an older
    copy of the instructions earlier in this task's conversation says.

  2. added
    agent-ready
    on Nov 3, 2026
  3. added a commit that references this issue on Nov 3, 2026
    39087ee
  4. added a commit that references this issue on Nov 4, 2026
    1227871
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

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions