boardx / boardx/workspacex

chat-read lane:隔离端口全部落在内核临时端口区,且五个替身端口是第二份未探测的声明

Open
#3,343 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 事实

`harness-verify` 的 `chat-read` lane 在 main 上连续红,每趟失败集合都不同。排查中分出两个**独立**缺陷,本 issue 只覆盖端口这一个(另一个见 PR 正文的「不属于本 PR」一节)。

### ① 端口落在内核临时端口区 ⇒ 「红但一条用例都没跑」

run 34454123556 attempt 1(job 102796423046):`next dev -p 47474` 以
`Error: listen EADDRINUSE: address already in use :::47474` 秒死,playwright 报
`Process from config.webServer exited early.`,整趟 **0 个用例执行**、仍报 failure。

该趟 `[test-isolation] pg=22474 redis=27474 sandbox=52474` ⇒ 同一次哈希抽签 m=2474,
于是 api=42474 / web=47474 / model=52474 / deep-agent=53474 / loopback-sandbox=54474 /
asr=57474 / vision=61474 / minio=32474 / minio-console=37474。**没有任何第二个服务会绑 47474。**

抢走它的是内核:Linux 默认 `net.ipv4.ip_local_port_range` = 32768–60999,
macOS/Windows = 49152–65535。区内端口随时被出向连接临时占为源端口(日志里紧挨着的
就是 `docker compose pull`),占着的那一刻 `listen()` 即 EADDRINUSE。
`reserveIsolationPorts` 的 probe-and-bind 挡不住它——探测在起栈**之前**就
`release()` 了,真正 bind 发生在几十秒之后。

旧布局 7 个角色里有 **5 个**(minio / minio-console / api / web / sandbox)整段或半段
落在 32768 以上。

### ② 五个替身端口是第二份声明,且其中一个与既有角色逐位相同

`playwright.chat-read.config.ts` 用 `Number(webPort) + 5_000/6_000/7_000/10_000/14_000`
现算五个 loopback 替身端口;`playwright.fullstack-smoke.config.ts` 同样的角色写成
`+5_000/+10_000/+15_000/−35_000`。这些端口从未被 OS 探测过。

其中 `webPort + 5_000` 与隔离外壳的 `SKILL_SANDBOX_PORT`(`portFrom(hash, 50_000)`)
**逐位相同**——两者都是 `50000 + m`,共用同一次哈希抽签。chat-read 车道只是碰巧不起
真沙箱才没炸;`e2e-up.sh` 那条真实模型链两个都起。

这是本仓「同一事实不得声明在两处」的第 12 例。

## 修法

端口角色收敛成 `lib/test-isolation.ts` 一张 `PORT_BASE` 表(12 个角色、段宽 1000、
全部落在 20000–31999,同时避开两套临时端口区),全部走同一套 probe-and-bind;
两份 playwright config 改为 `required()` 读环境变量,不再算偏移量。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/test-isolation.ts, especially reserveIsolationPorts and the PORT_BASE definition, then inspect playwright.chat-read.config.ts and playwright.fullstack-smoke.config.ts. Run the harness-verify chat-read lane to establish the failure; done means all 12 roles use the shared 20000–31999 allocation and both configs read required environment variables without offset calculations.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.